From 784036e4044c971ecef0c14058f2770ca7d8bcd5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 4 Jul 2006 17:06:43 +0000 Subject: [PATCH] simplify intra prediction mode decoding Originally committed as revision 5612 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/cavs.c | 17 +++++++---------- libavcodec/h264.c | 13 +++---------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index a4f69630bf..996567cbe4 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -885,17 +885,14 @@ static int decode_mb_i(AVSContext *h) { nA = h->pred_mode_Y[pos-1]; nB = h->pred_mode_Y[pos-3]; - if((nA == NOT_AVAIL) || (nB == NOT_AVAIL)) - predpred = 2; - else - predpred = FFMIN(nA,nB); - if(get_bits1(gb)) - h->pred_mode_Y[pos] = predpred; - else { - h->pred_mode_Y[pos] = get_bits(gb,2); - if(h->pred_mode_Y[pos] >= predpred) - h->pred_mode_Y[pos]++; + predpred = FFMIN(nA,nB); + if(predpred == NOT_AVAIL) // if either is not available + predpred = INTRA_L_LP; + if(!get_bits1(gb)){ + int rem_mode= get_bits(gb, 2); + predpred = rem_mode + (rem_mode >= predpred); } + h->pred_mode_Y[pos] = predpred; } pred_mode_uv = get_ue_golomb(gb); if(pred_mode_uv > 6) { diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 9470177d3b..8012ae1ead 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -5258,18 +5258,11 @@ decode_intra_mb: // fill_intra4x4_pred_table(h); for(i=0; i<16; i+=di){ - const int mode_coded= !get_bits1(&s->gb); - const int predicted_mode= pred_intra_mode(h, i); - int mode; + int mode= pred_intra_mode(h, i); - if(mode_coded){ + if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); - if(rem_mode= mode); } if(di==4)