From 0d8e09f8bffd2e193bf2060199aa72b19eeff10b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 8 May 2004 14:15:45 +0000 Subject: [PATCH] using pointers so the code could eventually be used for P frames a few const modifiers to make gcc happier Originally committed as revision 3120 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/svq1.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c index 97b9495aba..103148bfac 100644 --- a/libavcodec/svq1.c +++ b/libavcodec/svq1.c @@ -67,6 +67,7 @@ typedef struct SVQ1Context { AVCodecContext *avctx; DSPContext dsp; AVFrame picture; + AVFrame ref_picture[2]; PutBitContext pb; GetBitContext gb; @@ -1318,7 +1319,23 @@ static int encode_block(SVQ1Context *s, uint8_t *src, int stride, int level, int int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; - + const int intra= 1; + const int8_t *codebook_sum, *codebook; + const uint16_t (*mean_vlc)[2]; + const uint8_t (*multistage_vlc)[2]; + + if(intra){ + codebook_sum= svq1_intra_codebook_sum[level]; + codebook= svq1_intra_codebooks[level]; + mean_vlc= svq1_intra_mean_vlc; + multistage_vlc= svq1_intra_multistage_vlc[level]; + }else{ + codebook_sum= svq1_inter_codebook_sum[level]; + codebook= svq1_inter_codebooks[level]; + mean_vlc= svq1_inter_mean_vlc; + multistage_vlc= svq1_inter_multistage_vlc[level]; + } + best_score=0; for(y=0; yreorder_pb[level], - svq1_intra_multistage_vlc[level][1 + best_count][1], - svq1_intra_multistage_vlc[level][1 + best_count][0]); - put_bits(&s->reorder_pb[level], svq1_intra_mean_vlc[best_mean][1], - svq1_intra_mean_vlc[best_mean][0]); + multistage_vlc[1 + best_count][1], + multistage_vlc[1 + best_count][0]); + put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], + mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); @@ -1653,7 +1670,7 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, *p = *pict; p->pict_type = I_TYPE; - p->key_frame = 1; + p->key_frame = p->pict_type == I_TYPE; svq1_write_header(s, p->pict_type); svq1_encode_plane(s, s->picture.data[0], s->frame_width, s->frame_height,