1 /*****************************************************************************
2  * quant.h: x86 quantization and level-run
3  *****************************************************************************
4  * Copyright (C) 2005-2014 x264 project
5  *
6  * Authors: Loren Merritt <lorenm@u.washington.edu>
7  *          Fiona Glaser <fiona@x264.com>
8  *          Christian Heine <sennindemokrit@gmx.net>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
23  *
24  * This program is also available under a commercial proprietary license.
25  * For more information, contact us at licensing@x264.com.
26  *****************************************************************************/
27 
28 #ifndef X264_I386_QUANT_H
29 #define X264_I386_QUANT_H
30 
31 int x264_quant_2x2_dc_mmx2( dctcoef dct[4], int mf, int bias );
32 int x264_quant_4x4_dc_mmx2( dctcoef dct[16], int mf, int bias );
33 int x264_quant_4x4_mmx( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
34 int x264_quant_8x8_mmx( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
35 int x264_quant_2x2_dc_sse2( dctcoef dct[16], int mf, int bias );
36 int x264_quant_4x4_dc_sse2( dctcoef dct[16], int mf, int bias );
37 int x264_quant_4x4_sse2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
38 int x264_quant_4x4x4_sse2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
39 int x264_quant_8x8_sse2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
40 int x264_quant_2x2_dc_ssse3( dctcoef dct[4], int mf, int bias );
41 int x264_quant_4x4_dc_ssse3( dctcoef dct[16], int mf, int bias );
42 int x264_quant_4x4_ssse3( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
43 int x264_quant_4x4x4_ssse3( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
44 int x264_quant_8x8_ssse3( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
45 int x264_quant_2x2_dc_sse4( dctcoef dct[16], int mf, int bias );
46 int x264_quant_4x4_dc_sse4( dctcoef dct[16], int mf, int bias );
47 int x264_quant_4x4_sse4( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
48 int x264_quant_4x4x4_sse4( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
49 int x264_quant_8x8_sse4( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
50 int x264_quant_4x4_avx2( dctcoef dct[16], udctcoef mf[16], udctcoef bias[16] );
51 int x264_quant_4x4_dc_avx2( dctcoef dct[16], int mf, int bias );
52 int x264_quant_8x8_avx2( dctcoef dct[64], udctcoef mf[64], udctcoef bias[64] );
53 int x264_quant_4x4x4_avx2( dctcoef dct[4][16], udctcoef mf[16], udctcoef bias[16] );
54 void x264_dequant_4x4_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
55 void x264_dequant_4x4dc_mmx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
56 void x264_dequant_8x8_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
57 void x264_dequant_4x4_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
58 void x264_dequant_4x4dc_sse2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
59 void x264_dequant_8x8_sse2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
60 void x264_dequant_4x4_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
61 void x264_dequant_4x4dc_avx( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
62 void x264_dequant_8x8_avx( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
63 void x264_dequant_4x4_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
64 void x264_dequant_4x4dc_xop( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
65 void x264_dequant_8x8_xop( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
66 void x264_dequant_4x4_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
67 void x264_dequant_4x4dc_avx2( dctcoef dct[16], int dequant_mf[6][16], int i_qp );
68 void x264_dequant_8x8_avx2( dctcoef dct[64], int dequant_mf[6][64], int i_qp );
69 void x264_dequant_4x4_flat16_mmx( int16_t dct[16], int dequant_mf[6][16], int i_qp );
70 void x264_dequant_8x8_flat16_mmx( int16_t dct[64], int dequant_mf[6][64], int i_qp );
71 void x264_dequant_4x4_flat16_sse2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
72 void x264_dequant_8x8_flat16_sse2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
73 void x264_dequant_4x4_flat16_avx2( int16_t dct[16], int dequant_mf[6][16], int i_qp );
74 void x264_dequant_8x8_flat16_avx2( int16_t dct[64], int dequant_mf[6][64], int i_qp );
75 int x264_optimize_chroma_2x2_dc_sse2( dctcoef dct[4], int dequant_mf );
76 int x264_optimize_chroma_2x2_dc_ssse3( dctcoef dct[4], int dequant_mf );
77 int x264_optimize_chroma_2x2_dc_sse4( dctcoef dct[4], int dequant_mf );
78 int x264_optimize_chroma_2x2_dc_avx( dctcoef dct[4], int dequant_mf );
79 void x264_denoise_dct_mmx  ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
80 void x264_denoise_dct_sse2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
81 void x264_denoise_dct_ssse3( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
82 void x264_denoise_dct_avx  ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
83 void x264_denoise_dct_avx2 ( dctcoef *dct, uint32_t *sum, udctcoef *offset, int size );
84 int x264_decimate_score15_mmx2( dctcoef *dct );
85 int x264_decimate_score15_sse2( dctcoef *dct );
86 int x264_decimate_score15_ssse3( dctcoef *dct );
87 int x264_decimate_score16_mmx2( dctcoef *dct );
88 int x264_decimate_score16_sse2( dctcoef *dct );
89 int x264_decimate_score16_ssse3( dctcoef *dct );
90 int x264_decimate_score64_mmx2( dctcoef *dct );
91 int x264_decimate_score64_sse2( dctcoef *dct );
92 int x264_decimate_score64_ssse3( dctcoef *dct );
93 int x264_decimate_score64_avx2( int16_t *dct );
94 int x264_coeff_last4_mmx2( dctcoef *dct );
95 int x264_coeff_last8_mmx2( dctcoef *dct );
96 int x264_coeff_last15_mmx2( dctcoef *dct );
97 int x264_coeff_last16_mmx2( dctcoef *dct );
98 int x264_coeff_last64_mmx2( dctcoef *dct );
99 int x264_coeff_last8_sse2( dctcoef *dct );
100 int x264_coeff_last15_sse2( dctcoef *dct );
101 int x264_coeff_last16_sse2( dctcoef *dct );
102 int x264_coeff_last64_sse2( dctcoef *dct );
103 int x264_coeff_last4_mmx2_lzcnt( dctcoef *dct );
104 int x264_coeff_last8_mmx2_lzcnt( dctcoef *dct );
105 int x264_coeff_last8_sse2_lzcnt( dctcoef *dct );
106 int x264_coeff_last15_sse2_lzcnt( dctcoef *dct );
107 int x264_coeff_last16_sse2_lzcnt( dctcoef *dct );
108 int x264_coeff_last64_sse2_lzcnt( dctcoef *dct );
109 int x264_coeff_last64_avx2_lzcnt( dctcoef *dct );
110 int x264_coeff_level_run16_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
111 int x264_coeff_level_run16_sse2( dctcoef *dct, x264_run_level_t *runlevel );
112 int x264_coeff_level_run16_sse2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
113 int x264_coeff_level_run16_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
114 int x264_coeff_level_run16_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
115 int x264_coeff_level_run16_avx2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
116 int x264_coeff_level_run15_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
117 int x264_coeff_level_run15_sse2( dctcoef *dct, x264_run_level_t *runlevel );
118 int x264_coeff_level_run15_sse2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
119 int x264_coeff_level_run15_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
120 int x264_coeff_level_run15_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
121 int x264_coeff_level_run15_avx2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
122 int x264_coeff_level_run4_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
123 int x264_coeff_level_run4_mmx2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
124 int x264_coeff_level_run4_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
125 int x264_coeff_level_run4_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
126 int x264_coeff_level_run8_mmx2( dctcoef *dct, x264_run_level_t *runlevel );
127 int x264_coeff_level_run8_mmx2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
128 int x264_coeff_level_run8_sse2( dctcoef *dct, x264_run_level_t *runlevel );
129 int x264_coeff_level_run8_sse2_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
130 int x264_coeff_level_run8_ssse3( dctcoef *dct, x264_run_level_t *runlevel );
131 int x264_coeff_level_run8_ssse3_lzcnt( dctcoef *dct, x264_run_level_t *runlevel );
132 int x264_trellis_cabac_4x4_sse2 ( TRELLIS_PARAMS, int b_ac );
133 int x264_trellis_cabac_4x4_ssse3( TRELLIS_PARAMS, int b_ac );
134 int x264_trellis_cabac_8x8_sse2 ( TRELLIS_PARAMS, int b_interlaced );
135 int x264_trellis_cabac_8x8_ssse3( TRELLIS_PARAMS, int b_interlaced );
136 int x264_trellis_cabac_4x4_psy_sse2 ( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
137 int x264_trellis_cabac_4x4_psy_ssse3( TRELLIS_PARAMS, int b_ac, dctcoef *fenc_dct, int i_psy_trellis );
138 int x264_trellis_cabac_8x8_psy_sse2 ( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
139 int x264_trellis_cabac_8x8_psy_ssse3( TRELLIS_PARAMS, int b_interlaced, dctcoef *fenc_dct, int i_psy_trellis );
140 int x264_trellis_cabac_dc_sse2 ( TRELLIS_PARAMS, int i_coefs );
141 int x264_trellis_cabac_dc_ssse3( TRELLIS_PARAMS, int i_coefs );
142 int x264_trellis_cabac_chroma_422_dc_sse2 ( TRELLIS_PARAMS );
143 int x264_trellis_cabac_chroma_422_dc_ssse3( TRELLIS_PARAMS );
144 
145 #endif
146