1 /***************************************************************************** 2 * dct.h: transform and zigzag 3 ***************************************************************************** 4 * Copyright (C) 2004-2014 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 26 #ifndef X264_DCT_H 27 #define X264_DCT_H 28 29 extern const uint32_t x264_dct4_weight_tab[16]; 30 extern const uint32_t x264_dct8_weight_tab[64]; 31 extern const uint32_t x264_dct4_weight2_tab[16]; 32 extern const uint32_t x264_dct8_weight2_tab[64]; 33 34 typedef struct 35 { 36 // pix1 stride = FENC_STRIDE 37 // pix2 stride = FDEC_STRIDE 38 // p_dst stride = FDEC_STRIDE 39 void (*sub4x4_dct) ( dctcoef dct[16], pixel *pix1, pixel *pix2 ); 40 void (*add4x4_idct) ( pixel *p_dst, dctcoef dct[16] ); 41 42 void (*sub8x8_dct) ( dctcoef dct[4][16], pixel *pix1, pixel *pix2 ); 43 void (*sub8x8_dct_dc)( dctcoef dct[4], pixel *pix1, pixel *pix2 ); 44 void (*add8x8_idct) ( pixel *p_dst, dctcoef dct[4][16] ); 45 void (*add8x8_idct_dc) ( pixel *p_dst, dctcoef dct[4] ); 46 47 void (*sub8x16_dct_dc)( dctcoef dct[8], pixel *pix1, pixel *pix2 ); 48 49 void (*sub16x16_dct) ( dctcoef dct[16][16], pixel *pix1, pixel *pix2 ); 50 void (*add16x16_idct)( pixel *p_dst, dctcoef dct[16][16] ); 51 void (*add16x16_idct_dc) ( pixel *p_dst, dctcoef dct[16] ); 52 53 void (*sub8x8_dct8) ( dctcoef dct[64], pixel *pix1, pixel *pix2 ); 54 void (*add8x8_idct8) ( pixel *p_dst, dctcoef dct[64] ); 55 56 void (*sub16x16_dct8) ( dctcoef dct[4][64], pixel *pix1, pixel *pix2 ); 57 void (*add16x16_idct8)( pixel *p_dst, dctcoef dct[4][64] ); 58 59 void (*dct4x4dc) ( dctcoef d[16] ); 60 void (*idct4x4dc)( dctcoef d[16] ); 61 62 void (*dct2x4dc)( dctcoef dct[8], dctcoef dct4x4[8][16] ); 63 64 } x264_dct_function_t; 65 66 typedef struct 67 { 68 void (*scan_8x8)( dctcoef level[64], dctcoef dct[64] ); 69 void (*scan_4x4)( dctcoef level[16], dctcoef dct[16] ); 70 int (*sub_8x8) ( dctcoef level[64], const pixel *p_src, pixel *p_dst ); 71 int (*sub_4x4) ( dctcoef level[16], const pixel *p_src, pixel *p_dst ); 72 int (*sub_4x4ac)( dctcoef level[16], const pixel *p_src, pixel *p_dst, dctcoef *dc ); 73 void (*interleave_8x8_cavlc)( dctcoef *dst, dctcoef *src, uint8_t *nnz ); 74 75 } x264_zigzag_function_t; 76 77 void x264_dct_init( int cpu, x264_dct_function_t *dctf ); 78 void x264_dct_init_weights( void ); 79 void x264_zigzag_init( int cpu, x264_zigzag_function_t *pf_progressive, x264_zigzag_function_t *pf_interlaced ); 80 81 #endif 82