dct.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*****************************************************************************
  2. * dct.h: transform and zigzag
  3. *****************************************************************************
  4. * Copyright (C) 2004-2018 x264 project
  5. *
  6. * Authors: Loren Merritt <lorenm@u.washington.edu>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
  21. *
  22. * This program is also available under a commercial proprietary license.
  23. * For more information, contact us at licensing@x264.com.
  24. *****************************************************************************/
  25. #ifndef X264_DCT_H
  26. #define X264_DCT_H
  27. typedef struct
  28. {
  29. // pix1 stride = FENC_STRIDE
  30. // pix2 stride = FDEC_STRIDE
  31. // p_dst stride = FDEC_STRIDE
  32. void (*sub4x4_dct) ( dctcoef dct[16], pixel *pix1, pixel *pix2 );
  33. void (*add4x4_idct)( pixel *p_dst, dctcoef dct[16] );
  34. void (*sub8x8_dct) ( dctcoef dct[4][16], pixel *pix1, pixel *pix2 );
  35. void (*sub8x8_dct_dc) ( dctcoef dct[4], pixel *pix1, pixel *pix2 );
  36. void (*add8x8_idct) ( pixel *p_dst, dctcoef dct[4][16] );
  37. void (*add8x8_idct_dc)( pixel *p_dst, dctcoef dct[4] );
  38. void (*sub8x16_dct_dc)( dctcoef dct[8], pixel *pix1, pixel *pix2 );
  39. void (*sub16x16_dct) ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 );
  40. void (*add16x16_idct) ( pixel *p_dst, dctcoef dct[16][16] );
  41. void (*add16x16_idct_dc)( pixel *p_dst, dctcoef dct[16] );
  42. void (*sub8x8_dct8) ( dctcoef dct[64], pixel *pix1, pixel *pix2 );
  43. void (*add8x8_idct8)( pixel *p_dst, dctcoef dct[64] );
  44. void (*sub16x16_dct8) ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 );
  45. void (*add16x16_idct8)( pixel *p_dst, dctcoef dct[4][64] );
  46. void (*dct4x4dc) ( dctcoef d[16] );
  47. void (*idct4x4dc)( dctcoef d[16] );
  48. void (*dct2x4dc)( dctcoef dct[8], dctcoef dct4x4[8][16] );
  49. } x264_dct_function_t;
  50. typedef struct
  51. {
  52. void (*scan_8x8)( dctcoef level[64], dctcoef dct[64] );
  53. void (*scan_4x4)( dctcoef level[16], dctcoef dct[16] );
  54. int (*sub_8x8) ( dctcoef level[64], const pixel *p_src, pixel *p_dst );
  55. int (*sub_4x4) ( dctcoef level[16], const pixel *p_src, pixel *p_dst );
  56. int (*sub_4x4ac)( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc );
  57. void (*interleave_8x8_cavlc)( dctcoef *dst, dctcoef *src, uint8_t *nnz );
  58. } x264_zigzag_function_t;
  59. #define x264_dct_init x264_template(dct_init)
  60. void x264_dct_init( int cpu, x264_dct_function_t *dctf );
  61. #define x264_zigzag_init x264_template(zigzag_init)
  62. void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced );
  63. #endif