diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-25 04:20:37 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-25 04:33:58 +0200 |
commit | a2f27818b5e87154ea98d7d452dc2785f540dc8b (patch) | |
tree | f4ff6f16f693c3f04e1d1870109df8471158ed01 /libavcodec | |
parent | f2f28861da6a332712eb632e98010d1a7838f43a (diff) | |
download | ffmpeg-a2f27818b5e87154ea98d7d452dc2785f540dc8b.tar.gz |
amvenc: fix quant tables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index c9c67d0e63..14a94154ed 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -44,6 +44,7 @@ #include "mpeg4video.h" #include "internal.h" #include <limits.h> +#include "sp5x.h" //#undef NDEBUG //#include <assert.h> @@ -528,14 +529,9 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) // return -1; } - if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG){ + if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG || s->codec_id==CODEC_ID_AMV){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x s->inter_quant_bias= 0; - }else if(s->codec_id==CODEC_ID_AMV){ - s->intra_quant_bias= 0; - s->inter_quant_bias= 0; - s->fixed_qscale = 1; - s->adaptive_quant = 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x @@ -2099,6 +2095,11 @@ static int encode_thread(AVCodecContext *c, void *arg){ s->current_picture.f.error[i] = 0; } + if(s->codec_id==CODEC_ID_AMV){ + s->last_dc[0] = 128*8/13; + s->last_dc[1] = 128*8/14; + s->last_dc[2] = 128*8/14; + } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); @@ -2941,6 +2942,21 @@ static int encode_picture(MpegEncContext *s, int picture_number) s->intra_matrix, s->intra_quant_bias, 8, 8, 1); s->qscale= 8; } + if(s->codec_id == CODEC_ID_AMV){ + static const uint8_t y[32]={13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13}; + static const uint8_t c[32]={14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14}; + for(i=1;i<64;i++){ + int j= s->dsp.idct_permutation[ff_zigzag_direct[i]]; + + s->intra_matrix[j] = sp5x_quant_table[5*2][i]; + } + s->y_dc_scale_table= y; + s->c_dc_scale_table= c; + s->intra_matrix[0] = 14; + ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, + s->intra_matrix, s->intra_quant_bias, 8, 8, 1); + s->qscale= 8; + } //FIXME var duplication s->current_picture_ptr->f.key_frame = |