Mercurial > libavcodec.hg
comparison h264_loopfilter.c @ 11499:2a4dc3c0b012 libavcodec
Move H264 dsputil functions into their own struct
This moves the H264-specific functions from DSPContext to the new
H264DSPContext. The code is made conditional on CONFIG_H264DSP
which is set by the codecs requiring it.
The qpel and chroma MC functions are not moved as these are used by
non-h264 code.
author | mru |
---|---|
date | Tue, 16 Mar 2010 01:17:00 +0000 |
parents | 98970e51365a |
children | 7dd2a45249a9 |
comparison
equal
deleted
inserted
replaced
11498:8e889ce0d616 | 11499:2a4dc3c0b012 |
---|---|
110 int8_t tc[4]; | 110 int8_t tc[4]; |
111 tc[0] = tc0_table[index_a][bS[0]]; | 111 tc[0] = tc0_table[index_a][bS[0]]; |
112 tc[1] = tc0_table[index_a][bS[1]]; | 112 tc[1] = tc0_table[index_a][bS[1]]; |
113 tc[2] = tc0_table[index_a][bS[2]]; | 113 tc[2] = tc0_table[index_a][bS[2]]; |
114 tc[3] = tc0_table[index_a][bS[3]]; | 114 tc[3] = tc0_table[index_a][bS[3]]; |
115 h->s.dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc); | 115 h->h264dsp.h264_h_loop_filter_luma(pix, stride, alpha, beta, tc); |
116 } else { | 116 } else { |
117 h->s.dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta); | 117 h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta); |
118 } | 118 } |
119 } | 119 } |
120 static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { | 120 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; | 121 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
122 const int alpha = alpha_table[index_a]; | 122 const int alpha = alpha_table[index_a]; |
127 int8_t tc[4]; | 127 int8_t tc[4]; |
128 tc[0] = tc0_table[index_a][bS[0]]+1; | 128 tc[0] = tc0_table[index_a][bS[0]]+1; |
129 tc[1] = tc0_table[index_a][bS[1]]+1; | 129 tc[1] = tc0_table[index_a][bS[1]]+1; |
130 tc[2] = tc0_table[index_a][bS[2]]+1; | 130 tc[2] = tc0_table[index_a][bS[2]]+1; |
131 tc[3] = tc0_table[index_a][bS[3]]+1; | 131 tc[3] = tc0_table[index_a][bS[3]]+1; |
132 h->s.dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc); | 132 h->h264dsp.h264_h_loop_filter_chroma(pix, stride, alpha, beta, tc); |
133 } else { | 133 } else { |
134 h->s.dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta); | 134 h->h264dsp.h264_h_loop_filter_chroma_intra(pix, stride, alpha, beta); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { | 138 static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) { |
139 int i; | 139 int i; |
280 int8_t tc[4]; | 280 int8_t tc[4]; |
281 tc[0] = tc0_table[index_a][bS[0]]; | 281 tc[0] = tc0_table[index_a][bS[0]]; |
282 tc[1] = tc0_table[index_a][bS[1]]; | 282 tc[1] = tc0_table[index_a][bS[1]]; |
283 tc[2] = tc0_table[index_a][bS[2]]; | 283 tc[2] = tc0_table[index_a][bS[2]]; |
284 tc[3] = tc0_table[index_a][bS[3]]; | 284 tc[3] = tc0_table[index_a][bS[3]]; |
285 h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); | 285 h->h264dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); |
286 } else { | 286 } else { |
287 h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); | 287 h->h264dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) { | 291 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; | 292 const unsigned int index_a = qp + h->slice_alpha_c0_offset; |
298 int8_t tc[4]; | 298 int8_t tc[4]; |
299 tc[0] = tc0_table[index_a][bS[0]]+1; | 299 tc[0] = tc0_table[index_a][bS[0]]+1; |
300 tc[1] = tc0_table[index_a][bS[1]]+1; | 300 tc[1] = tc0_table[index_a][bS[1]]+1; |
301 tc[2] = tc0_table[index_a][bS[2]]+1; | 301 tc[2] = tc0_table[index_a][bS[2]]+1; |
302 tc[3] = tc0_table[index_a][bS[3]]+1; | 302 tc[3] = tc0_table[index_a][bS[3]]+1; |
303 h->s.dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); | 303 h->h264dsp.h264_v_loop_filter_chroma(pix, stride, alpha, beta, tc); |
304 } else { | 304 } else { |
305 h->s.dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); | 305 h->h264dsp.h264_v_loop_filter_chroma_intra(pix, stride, alpha, beta); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { | 309 void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) { |
310 MpegEncContext * const s = &h->s; | 310 MpegEncContext * const s = &h->s; |
312 int mb_type, left_type; | 312 int mb_type, left_type; |
313 int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; | 313 int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh; |
314 | 314 |
315 mb_xy = h->mb_xy; | 315 mb_xy = h->mb_xy; |
316 | 316 |
317 if(!h->top_type || !s->dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { | 317 if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) { |
318 ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); | 318 ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize); |
319 return; | 319 return; |
320 } | 320 } |
321 assert(!FRAME_MBAFF); | 321 assert(!FRAME_MBAFF); |
322 left_type= h->left_type[0]; | 322 left_type= h->left_type[0]; |
379 } else { | 379 } else { |
380 int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; | 380 int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0; |
381 int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[0] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; | 381 int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[0] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0; |
382 int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; | 382 int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1; |
383 edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; | 383 edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4; |
384 s->dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, | 384 h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache, |
385 h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); | 385 h->list_count==2, edges, step, mask_edge0, mask_edge1, FIELD_PICTURE); |
386 } | 386 } |
387 if( IS_INTRA(left_type) ) | 387 if( IS_INTRA(left_type) ) |
388 AV_WN64A(bS[0][0], 0x0004000400040004ULL); | 388 AV_WN64A(bS[0][0], 0x0004000400040004ULL); |
389 if( IS_INTRA(h->top_type) ) | 389 if( IS_INTRA(h->top_type) ) |