comparison h264.c @ 8590:7a463923ecd1 libavcodec

Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1.
author aurel
date Tue, 13 Jan 2009 23:44:16 +0000
parents 6687083ec76a
children 68e959302527
comparison
equal deleted inserted replaced
8589:a29b5b5c3c9d 8590:7a463923ecd1
34 #include "golomb.h" 34 #include "golomb.h"
35 #include "rectangle.h" 35 #include "rectangle.h"
36 #include "vdpau_internal.h" 36 #include "vdpau_internal.h"
37 37
38 #include "cabac.h" 38 #include "cabac.h"
39 #ifdef ARCH_X86 39 #if ARCH_X86
40 #include "x86/h264_i386.h" 40 #include "x86/h264_i386.h"
41 #endif 41 #endif
42 42
43 //#undef NDEBUG 43 //#undef NDEBUG
44 #include <assert.h> 44 #include <assert.h>
1378 #if 0 1378 #if 0
1379 for(i=0; i<length; i++) 1379 for(i=0; i<length; i++)
1380 printf("%2X ", src[i]); 1380 printf("%2X ", src[i]);
1381 #endif 1381 #endif
1382 1382
1383 #ifdef HAVE_FAST_UNALIGNED 1383 #if HAVE_FAST_UNALIGNED
1384 # ifdef HAVE_FAST_64BIT 1384 # if HAVE_FAST_64BIT
1385 # define RS 7 1385 # define RS 7
1386 for(i=0; i+1<length; i+=9){ 1386 for(i=0; i+1<length; i+=9){
1387 if(!((~*(uint64_t*)(src+i) & (*(uint64_t*)(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) 1387 if(!((~*(uint64_t*)(src+i) & (*(uint64_t*)(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL))
1388 # else 1388 # else
1389 # define RS 3 1389 # define RS 3
5222 5222
5223 uint8_t *significant_coeff_ctx_base; 5223 uint8_t *significant_coeff_ctx_base;
5224 uint8_t *last_coeff_ctx_base; 5224 uint8_t *last_coeff_ctx_base;
5225 uint8_t *abs_level_m1_ctx_base; 5225 uint8_t *abs_level_m1_ctx_base;
5226 5226
5227 #ifndef ARCH_X86 5227 #if !ARCH_X86
5228 #define CABAC_ON_STACK 5228 #define CABAC_ON_STACK
5229 #endif 5229 #endif
5230 #ifdef CABAC_ON_STACK 5230 #ifdef CABAC_ON_STACK
5231 #define CC &cc 5231 #define CC &cc
5232 CABACContext cc; 5232 CABACContext cc;
5283 }\ 5283 }\
5284 if( last == max_coeff -1 ) {\ 5284 if( last == max_coeff -1 ) {\
5285 index[coeff_count++] = last;\ 5285 index[coeff_count++] = last;\
5286 } 5286 }
5287 const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD]; 5287 const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
5288 #if defined(ARCH_X86) && defined(HAVE_7REGS) && defined(HAVE_EBX_AVAILABLE) && !defined(BROKEN_RELOCATIONS) 5288 #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE && !defined(BROKEN_RELOCATIONS)
5289 coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off); 5289 coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index, sig_off);
5290 } else { 5290 } else {
5291 coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index); 5291 coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index);
5292 #else 5292 #else
5293 DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] ); 5293 DECODE_SIGNIFICANCE( 63, sig_off[last], last_coeff_flag_offset_8x8[last] );
5358 h->cabac.bytestream= cc.bytestream; 5358 h->cabac.bytestream= cc.bytestream;
5359 #endif 5359 #endif
5360 5360
5361 } 5361 }
5362 5362
5363 #ifndef CONFIG_SMALL 5363 #if !CONFIG_SMALL
5364 static void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) { 5364 static void decode_cabac_residual_dc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
5365 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 1); 5365 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 1);
5366 } 5366 }
5367 5367
5368 static void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) { 5368 static void decode_cabac_residual_nondc( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
5369 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0); 5369 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, 0);
5370 } 5370 }
5371 #endif 5371 #endif
5372 5372
5373 static void decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) { 5373 static void decode_cabac_residual( H264Context *h, DCTELEM *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff ) {
5374 #ifdef CONFIG_SMALL 5374 #if CONFIG_SMALL
5375 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, cat == 0 || cat == 3); 5375 decode_cabac_residual_internal(h, block, cat, n, scantable, qmul, max_coeff, cat == 0 || cat == 3);
5376 #else 5376 #else
5377 if( cat == 0 || cat == 3 ) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff); 5377 if( cat == 0 || cat == 3 ) decode_cabac_residual_dc(h, block, cat, n, scantable, qmul, max_coeff);
5378 else decode_cabac_residual_nondc(h, block, cat, n, scantable, qmul, max_coeff); 5378 else decode_cabac_residual_nondc(h, block, cat, n, scantable, qmul, max_coeff);
5379 #endif 5379 #endif
6570 filter_mb_mbaff_edgev ( h, &img_y [0], linesize, bS, qp ); 6570 filter_mb_mbaff_edgev ( h, &img_y [0], linesize, bS, qp );
6571 filter_mb_mbaff_edgecv( h, &img_cb[0], uvlinesize, bS, bqp ); 6571 filter_mb_mbaff_edgecv( h, &img_cb[0], uvlinesize, bS, bqp );
6572 filter_mb_mbaff_edgecv( h, &img_cr[0], uvlinesize, bS, rqp ); 6572 filter_mb_mbaff_edgecv( h, &img_cr[0], uvlinesize, bS, rqp );
6573 } 6573 }
6574 6574
6575 #ifdef CONFIG_SMALL 6575 #if CONFIG_SMALL
6576 for( dir = 0; dir < 2; dir++ ) 6576 for( dir = 0; dir < 2; dir++ )
6577 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, dir); 6577 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, dir ? 0 : first_vertical_edge_done, dir);
6578 #else 6578 #else
6579 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, 0); 6579 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, first_vertical_edge_done, 0);
6580 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, 1); 6580 filter_mb_dir(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize, mb_xy, mb_type, mvy_limit, 0, 1);
8021 /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY, 8021 /*CODEC_CAP_DRAW_HORIZ_BAND |*/ CODEC_CAP_DR1 | CODEC_CAP_DELAY,
8022 .flush= flush_dpb, 8022 .flush= flush_dpb,
8023 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), 8023 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
8024 }; 8024 };
8025 8025
8026 #ifdef CONFIG_H264_VDPAU_DECODER 8026 #if CONFIG_H264_VDPAU_DECODER
8027 AVCodec h264_vdpau_decoder = { 8027 AVCodec h264_vdpau_decoder = {
8028 "h264_vdpau", 8028 "h264_vdpau",
8029 CODEC_TYPE_VIDEO, 8029 CODEC_TYPE_VIDEO,
8030 CODEC_ID_H264_VDPAU, 8030 CODEC_ID_H264_VDPAU,
8031 sizeof(H264Context), 8031 sizeof(H264Context),
8037 .flush= flush_dpb, 8037 .flush= flush_dpb,
8038 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"), 8038 .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (VDPAU acceleration)"),
8039 }; 8039 };
8040 #endif 8040 #endif
8041 8041
8042 #ifdef CONFIG_SVQ3_DECODER 8042 #if CONFIG_SVQ3_DECODER
8043 #include "svq3.c" 8043 #include "svq3.c"
8044 #endif 8044 #endif