Revision 86b0d9cd libavcodec/h264_loopfilter.c
libavcodec/h264_loopfilter.c | ||
---|---|---|
101 | 101 |
}; |
102 | 102 |
|
103 | 103 |
static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) { |
104 |
const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
|
105 |
const int alpha = alpha_table[index_a]; |
|
106 |
const int beta = beta_table[qp + h->slice_beta_offset]; |
|
104 |
const int bit_depth = h->sps.bit_depth_luma; |
|
105 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
106 |
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
107 |
const int alpha = alpha_table[index_a] << (bit_depth-8); |
|
108 |
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
107 | 109 |
if (alpha ==0 || beta == 0) return; |
108 | 110 |
|
109 | 111 |
if( bS[0] < 4 ) { |
110 | 112 |
int8_t tc[4]; |
111 |
tc[0] = tc0_table[index_a][bS[0]]; |
|
112 |
tc[1] = tc0_table[index_a][bS[1]]; |
|
113 |
tc[2] = tc0_table[index_a][bS[2]]; |
|
114 |
tc[3] = tc0_table[index_a][bS[3]]; |
|
113 |
tc[0] = tc0_table[index_a][bS[0]] << (bit_depth-8);
|
|
114 |
tc[1] = tc0_table[index_a][bS[1]] << (bit_depth-8);
|
|
115 |
tc[2] = tc0_table[index_a][bS[2]] << (bit_depth-8);
|
|
116 |
tc[3] = tc0_table[index_a][bS[3]] << (bit_depth-8);
|
|
115 | 117 |
h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc); |
116 | 118 |
} else { |
117 | 119 |
h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta); |
118 | 120 |
} |
119 | 121 |
} |
120 | 122 |
static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
121 |
const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
|
122 |
const int alpha = alpha_table[index_a]; |
|
123 |
const int beta = beta_table[qp + h->slice_beta_offset]; |
|
123 |
const int bit_depth = h->sps.bit_depth_luma; |
|
124 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
125 |
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
126 |
const int alpha = alpha_table[index_a] << (bit_depth-8); |
|
127 |
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
124 | 128 |
if (alpha ==0 || beta == 0) return; |
125 | 129 |
|
126 | 130 |
if( bS[0] < 4 ) { |
127 | 131 |
int8_t tc[4]; |
128 |
tc[0] = tc0_table[index_a][bS[0]]+1;
|
|
129 |
tc[1] = tc0_table[index_a][bS[1]]+1;
|
|
130 |
tc[2] = tc0_table[index_a][bS[2]]+1;
|
|
131 |
tc[3] = tc0_table[index_a][bS[3]]+1;
|
|
132 |
tc[0] = (tc0_table[index_a][bS[0]] << (bit_depth-8))+1;
|
|
133 |
tc[1] = (tc0_table[index_a][bS[1]] << (bit_depth-8))+1;
|
|
134 |
tc[2] = (tc0_table[index_a][bS[2]] << (bit_depth-8))+1;
|
|
135 |
tc[3] = (tc0_table[index_a][bS[3]] << (bit_depth-8))+1;
|
|
132 | 136 |
h->h264dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc); |
133 | 137 |
} else { |
134 | 138 |
h->h264dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta); |
... | ... | |
137 | 141 |
|
138 | 142 |
static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { |
139 | 143 |
int i; |
140 |
int index_a = qp + h->slice_alpha_c0_offset; |
|
141 |
int alpha = alpha_table[index_a]; |
|
142 |
int beta = beta_table[qp + h->slice_beta_offset]; |
|
144 |
const int bit_depth = h->sps.bit_depth_luma; |
|
145 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
146 |
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
147 |
int alpha = alpha_table[index_a] << (bit_depth-8); |
|
148 |
int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
143 | 149 |
for( i = 0; i < 8; i++, pix += stride) { |
144 | 150 |
const int bS_index = (i >> 1) * bsi; |
145 | 151 |
|
... | ... | |
148 | 154 |
} |
149 | 155 |
|
150 | 156 |
if( bS[bS_index] < 4 ) { |
151 |
const int tc0 = tc0_table[index_a][bS[bS_index]]; |
|
157 |
const int tc0 = tc0_table[index_a][bS[bS_index]] << (bit_depth-8);
|
|
152 | 158 |
const int p0 = pix[-1]; |
153 | 159 |
const int p1 = pix[-2]; |
154 | 160 |
const int p2 = pix[-3]; |
... | ... | |
226 | 232 |
} |
227 | 233 |
static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { |
228 | 234 |
int i; |
229 |
int index_a = qp + h->slice_alpha_c0_offset; |
|
230 |
int alpha = alpha_table[index_a]; |
|
231 |
int beta = beta_table[qp + h->slice_beta_offset]; |
|
235 |
const int bit_depth = h->sps.bit_depth_luma; |
|
236 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
237 |
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
238 |
int alpha = alpha_table[index_a] << (bit_depth-8); |
|
239 |
int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
232 | 240 |
for( i = 0; i < 4; i++, pix += stride) { |
233 | 241 |
const int bS_index = i*bsi; |
234 | 242 |
|
... | ... | |
237 | 245 |
} |
238 | 246 |
|
239 | 247 |
if( bS[bS_index] < 4 ) { |
240 |
const int tc = tc0_table[index_a][bS[bS_index]] + 1;
|
|
248 |
const int tc = (tc0_table[index_a][bS[bS_index]] << (bit_depth-8)) + 1;
|
|
241 | 249 |
const int p0 = pix[-1]; |
242 | 250 |
const int p1 = pix[-2]; |
243 | 251 |
const int q0 = pix[0]; |
... | ... | |
271 | 279 |
} |
272 | 280 |
|
273 | 281 |
static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
274 |
const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
|
275 |
const int alpha = alpha_table[index_a]; |
|
276 |
const int beta = beta_table[qp + h->slice_beta_offset]; |
|
282 |
const int bit_depth = h->sps.bit_depth_luma; |
|
283 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
284 |
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
285 |
const int alpha = alpha_table[index_a] << (bit_depth-8); |
|
286 |
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
277 | 287 |
if (alpha ==0 || beta == 0) return; |
278 | 288 |
|
279 | 289 |
if( bS[0] < 4 ) { |
280 | 290 |
int8_t tc[4]; |
281 |
tc[0] = tc0_table[index_a][bS[0]]; |
|
282 |
tc[1] = tc0_table[index_a][bS[1]]; |
|
283 |
tc[2] = tc0_table[index_a][bS[2]]; |
|
284 |
tc[3] = tc0_table[index_a][bS[3]]; |
|
291 |
tc[0] = tc0_table[index_a][bS[0]] << (bit_depth-8);
|
|
292 |
tc[1] = tc0_table[index_a][bS[1]] << (bit_depth-8);
|
|
293 |
tc[2] = tc0_table[index_a][bS[2]] << (bit_depth-8);
|
|
294 |
tc[3] = tc0_table[index_a][bS[3]] << (bit_depth-8);
|
|
285 | 295 |
h->h264dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); |
286 | 296 |
} else { |
287 | 297 |
h->h264dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); |
... | ... | |
289 | 299 |
} |
290 | 300 |
|
291 | 301 |
static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
292 |
const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
|
293 |
const int alpha = alpha_table[index_a]; |
|
294 |
const int beta = beta_table[qp + h->slice_beta_offset]; |
|
302 |
const int bit_depth = h->sps.bit_depth_luma; |
|
303 |
const int qp_bd_offset = 6*(bit_depth-8); |
|
304 |
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; |
|
305 |
const int alpha = alpha_table[index_a] << (bit_depth-8); |
|
306 |
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset] << (bit_depth-8); |
|
295 | 307 |
if (alpha ==0 || beta == 0) return; |
296 | 308 |
|
297 | 309 |
if( bS[0] < 4 ) { |
298 | 310 |
int8_t tc[4]; |
299 |
tc[0] = tc0_table[index_a][bS[0]]+1;
|
|
300 |
tc[1] = tc0_table[index_a][bS[1]]+1;
|
|
301 |
tc[2] = tc0_table[index_a][bS[2]]+1;
|
|
302 |
tc[3] = tc0_table[index_a][bS[3]]+1;
|
|
311 |
tc[0] = (tc0_table[index_a][bS[0]] << (bit_depth-8))+1;
|
|
312 |
tc[1] = (tc0_table[index_a][bS[1]] << (bit_depth-8))+1;
|
|
313 |
tc[2] = (tc0_table[index_a][bS[2]] << (bit_depth-8))+1;
|
|
314 |
tc[3] = (tc0_table[index_a][bS[3]] << (bit_depth-8))+1;
|
|
303 | 315 |
h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); |
304 | 316 |
} else { |
305 | 317 |
h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); |
Also available in: Unified diff