Mercurial > libavcodec.hg
comparison h264_loopfilter.c @ 10979:776dba50775c libavcodec
Move +52 from the loop filter to the alpha/beta offsets in the context.
This should fix a segfault, also it might be faster on systems where the
+52 wasnt free.
author | michael |
---|---|
date | Sat, 23 Jan 2010 18:05:30 +0000 |
parents | 214adf5e303b |
children | 541acd292c48 |
comparison
equal
deleted
inserted
replaced
10978:8754b8361dc9 | 10979:776dba50775c |
---|---|
98 {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, | 98 {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, |
99 {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, | 99 {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, |
100 }; | 100 }; |
101 | 101 |
102 static void av_noinline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) { | 102 static void av_noinline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) { |
103 const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset; | 103 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
104 const int alpha = alpha_table[index_a]; | 104 const int alpha = alpha_table[index_a]; |
105 const int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 105 const int beta = beta_table[qp + h->slice_beta_offset]; |
106 if (alpha ==0 || beta == 0) return; | 106 if (alpha ==0 || beta == 0) return; |
107 | 107 |
108 if( bS[0] < 4 ) { | 108 if( bS[0] < 4 ) { |
109 int8_t tc[4]; | 109 int8_t tc[4]; |
110 tc[0] = tc0_table[index_a][bS[0]]; | 110 tc[0] = tc0_table[index_a][bS[0]]; |
115 } else { | 115 } else { |
116 h->s.dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta); | 116 h->s.dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta); |
117 } | 117 } |
118 } | 118 } |
119 static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { | 119 static void av_noinline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
120 const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset; | 120 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
121 const int alpha = alpha_table[index_a]; | 121 const int alpha = alpha_table[index_a]; |
122 const int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 122 const int beta = beta_table[qp + h->slice_beta_offset]; |
123 if (alpha ==0 || beta == 0) return; | 123 if (alpha ==0 || beta == 0) return; |
124 | 124 |
125 if( bS[0] < 4 ) { | 125 if( bS[0] < 4 ) { |
126 int8_t tc[4]; | 126 int8_t tc[4]; |
127 tc[0] = tc0_table[index_a][bS[0]]+1; | 127 tc[0] = tc0_table[index_a][bS[0]]+1; |
135 } | 135 } |
136 | 136 |
137 static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { | 137 static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { |
138 int i; | 138 int i; |
139 int index_a = qp + h->slice_alpha_c0_offset; | 139 int index_a = qp + h->slice_alpha_c0_offset; |
140 int alpha = (alpha_table+52)[index_a]; | 140 int alpha = alpha_table[index_a]; |
141 int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 141 int beta = beta_table[qp + h->slice_beta_offset]; |
142 for( i = 0; i < 8; i++, pix += stride) { | 142 for( i = 0; i < 8; i++, pix += stride) { |
143 const int bS_index = (i >> 1) * bsi; | 143 const int bS_index = (i >> 1) * bsi; |
144 | 144 |
145 if( bS[bS_index] == 0 ) { | 145 if( bS[bS_index] == 0 ) { |
146 continue; | 146 continue; |
147 } | 147 } |
148 | 148 |
149 if( bS[bS_index] < 4 ) { | 149 if( bS[bS_index] < 4 ) { |
150 const int tc0 = (tc0_table+52)[index_a][bS[bS_index]]; | 150 const int tc0 = tc0_table[index_a][bS[bS_index]]; |
151 const int p0 = pix[-1]; | 151 const int p0 = pix[-1]; |
152 const int p1 = pix[-2]; | 152 const int p1 = pix[-2]; |
153 const int p2 = pix[-3]; | 153 const int p2 = pix[-3]; |
154 const int q0 = pix[0]; | 154 const int q0 = pix[0]; |
155 const int q1 = pix[1]; | 155 const int q1 = pix[1]; |
224 } | 224 } |
225 } | 225 } |
226 static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { | 226 static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { |
227 int i; | 227 int i; |
228 int index_a = qp + h->slice_alpha_c0_offset; | 228 int index_a = qp + h->slice_alpha_c0_offset; |
229 int alpha = (alpha_table+52)[index_a]; | 229 int alpha = alpha_table[index_a]; |
230 int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 230 int beta = beta_table[qp + h->slice_beta_offset]; |
231 for( i = 0; i < 4; i++, pix += stride) { | 231 for( i = 0; i < 4; i++, pix += stride) { |
232 const int bS_index = i*bsi; | 232 const int bS_index = i*bsi; |
233 | 233 |
234 if( bS[bS_index] == 0 ) { | 234 if( bS[bS_index] == 0 ) { |
235 continue; | 235 continue; |
236 } | 236 } |
237 | 237 |
238 if( bS[bS_index] < 4 ) { | 238 if( bS[bS_index] < 4 ) { |
239 const int tc = (tc0_table+52)[index_a][bS[bS_index]] + 1; | 239 const int tc = tc0_table[index_a][bS[bS_index]] + 1; |
240 const int p0 = pix[-1]; | 240 const int p0 = pix[-1]; |
241 const int p1 = pix[-2]; | 241 const int p1 = pix[-2]; |
242 const int q0 = pix[0]; | 242 const int q0 = pix[0]; |
243 const int q1 = pix[1]; | 243 const int q1 = pix[1]; |
244 | 244 |
268 } | 268 } |
269 } | 269 } |
270 } | 270 } |
271 | 271 |
272 static void av_noinline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { | 272 static void av_noinline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
273 const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset; | 273 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
274 const int alpha = alpha_table[index_a]; | 274 const int alpha = alpha_table[index_a]; |
275 const int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 275 const int beta = beta_table[qp + h->slice_beta_offset]; |
276 if (alpha ==0 || beta == 0) return; | 276 if (alpha ==0 || beta == 0) return; |
277 | 277 |
278 if( bS[0] < 4 ) { | 278 if( bS[0] < 4 ) { |
279 int8_t tc[4]; | 279 int8_t tc[4]; |
280 tc[0] = tc0_table[index_a][bS[0]]; | 280 tc[0] = tc0_table[index_a][bS[0]]; |
286 h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); | 286 h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 static void av_noinline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { | 290 static void av_noinline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { |
291 const unsigned int index_a = 52 + qp + h->slice_alpha_c0_offset; | 291 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
292 const int alpha = alpha_table[index_a]; | 292 const int alpha = alpha_table[index_a]; |
293 const int beta = (beta_table+52)[qp + h->slice_beta_offset]; | 293 const int beta = beta_table[qp + h->slice_beta_offset]; |
294 if (alpha ==0 || beta == 0) return; | 294 if (alpha ==0 || beta == 0) return; |
295 | 295 |
296 if( bS[0] < 4 ) { | 296 if( bS[0] < 4 ) { |
297 int8_t tc[4]; | 297 int8_t tc[4]; |
298 tc[0] = tc0_table[index_a][bS[0]]+1; | 298 tc[0] = tc0_table[index_a][bS[0]]+1; |
330 qpc1 = get_chroma_qp( h, 0, qp1 ); | 330 qpc1 = get_chroma_qp( h, 0, qp1 ); |
331 qp0 = (qp + qp0 + 1) >> 1; | 331 qp0 = (qp + qp0 + 1) >> 1; |
332 qp1 = (qp + qp1 + 1) >> 1; | 332 qp1 = (qp + qp1 + 1) >> 1; |
333 qpc0 = (qpc + qpc0 + 1) >> 1; | 333 qpc0 = (qpc + qpc0 + 1) >> 1; |
334 qpc1 = (qpc + qpc1 + 1) >> 1; | 334 qpc1 = (qpc + qpc1 + 1) >> 1; |
335 qp_thresh = 15 - h->slice_alpha_c0_offset; | 335 qp_thresh = 15+52 - h->slice_alpha_c0_offset; |
336 if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && | 336 if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh && |
337 qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) | 337 qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh) |
338 return; | 338 return; |
339 | 339 |
340 if( IS_INTRA(mb_type) ) { | 340 if( IS_INTRA(mb_type) ) { |