diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-07-21 18:44:57 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-07-21 18:44:57 +0000 |
commit | 4b30289ec962733582ffef85409e7309d533b6f5 (patch) | |
tree | 9b65010721e568444110ec6b3c968913b83b5aa8 /libavcodec/h264.c | |
parent | 932f396f50fbabd9a13ec9341638c56b6667d905 (diff) | |
download | ffmpeg-4b30289ec962733582ffef85409e7309d533b6f5.tar.gz |
SI/SP slice support. (not bitexact)
SI untested as I did not find any samples.
Originally committed as revision 14325 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index f40e1ad53d..84679f6aa2 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4216,7 +4216,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ } if( s->avctx->skip_loop_filter >= AVDISCARD_ALL - ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type != FF_I_TYPE) + ||(s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && h->slice_type_nos != FF_I_TYPE) ||(s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && h->slice_type == FF_B_TYPE) ||(s->avctx->skip_loop_filter >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) h->deblocking_filter= 0; @@ -4554,7 +4554,7 @@ static int decode_mb_cavlc(H264Context *h){ mb_type -= 23; goto decode_intra_mb; } - }else if(h->slice_type == FF_P_TYPE /*|| h->slice_type == FF_SP_TYPE */){ + }else if(h->slice_type_nos == FF_P_TYPE){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; @@ -4563,7 +4563,9 @@ static int decode_mb_cavlc(H264Context *h){ goto decode_intra_mb; } }else{ - assert(h->slice_type == FF_I_TYPE); + assert(h->slice_type_nos == FF_I_TYPE); + if(h->slice_type == FF_SI_TYPE && mb_type) + mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_pict_type_char(h->slice_type), s->mb_x, s->mb_y); @@ -5059,9 +5061,9 @@ static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_sl static int decode_cabac_mb_type( H264Context *h ) { MpegEncContext * const s = &h->s; - if( h->slice_type == FF_I_TYPE ) { + if( h->slice_type_nos == FF_I_TYPE ) { return decode_cabac_intra_mb_type(h, 3, 1); - } else if( h->slice_type == FF_P_TYPE ) { + } else if( h->slice_type_nos == FF_P_TYPE ) { if( get_cabac_noinline( &h->cabac, &h->cabac_state[14] ) == 0 ) { /* P-type */ if( get_cabac_noinline( &h->cabac, &h->cabac_state[15] ) == 0 ) { @@ -5690,7 +5692,7 @@ static int decode_mb_cabac(H264Context *h) { mb_type -= 23; goto decode_intra_mb; } - } else if( h->slice_type == FF_P_TYPE ) { + } else if( h->slice_type_nos == FF_P_TYPE ) { if( mb_type < 5) { partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; @@ -5699,7 +5701,9 @@ static int decode_mb_cabac(H264Context *h) { goto decode_intra_mb; } } else { - assert(h->slice_type == FF_I_TYPE); + if(h->slice_type == FF_SI_TYPE && mb_type) + mb_type--; + assert(h->slice_type_nos == FF_I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; @@ -6820,7 +6824,7 @@ static int decode_slice(struct AVCodecContext *avctx, H264Context *h){ /* calculate pre-state */ for( i= 0; i < 460; i++ ) { int pre; - if( h->slice_type == FF_I_TYPE ) + if( h->slice_type_nos == FF_I_TYPE ) pre = av_clip( ((cabac_context_init_I[i][0] * s->qscale) >>4 ) + cabac_context_init_I[i][1], 1, 126 ); else pre = av_clip( ((cabac_context_init_PB[h->cabac_init_idc][i][0] * s->qscale) >>4 ) + cabac_context_init_PB[h->cabac_init_idc][i][1], 1, 126 ); @@ -7587,7 +7591,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) - && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==FF_I_TYPE) + && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; @@ -7612,7 +7616,7 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ && s->hurry_up < 5 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type!=FF_B_TYPE) - && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type==FF_I_TYPE) + && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; |