Mercurial > libavcodec.hg
changeset 1150:dde68a430ba9 libavcodec
user setable quantizer bias
author | michaelni |
---|---|
date | Sat, 22 Mar 2003 12:09:02 +0000 |
parents | b48bf370ff44 |
children | 1d2ced5e79f3 |
files | avcodec.h h263.c mjpeg.c mpeg12.c mpegvideo.c mpegvideo.h utils.c |
diffstat | 7 files changed, 38 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/avcodec.h Sat Mar 22 07:59:36 2003 +0000 +++ b/avcodec.h Sat Mar 22 12:09:02 2003 +0000 @@ -15,8 +15,8 @@ #define LIBAVCODEC_VERSION_INT 0x000406 #define LIBAVCODEC_VERSION "0.4.6" -#define LIBAVCODEC_BUILD 4662 -#define LIBAVCODEC_BUILD_STR "4662" +#define LIBAVCODEC_BUILD 4663 +#define LIBAVCODEC_BUILD_STR "4663" #define LIBAVCODEC_IDENT "FFmpeg" LIBAVCODEC_VERSION "b" LIBAVCODEC_BUILD_STR @@ -1038,8 +1038,23 @@ * - decoding: set by lavc. * @todo move this after frame_rate */ + int frame_rate_base; - + /** + * intra quantizer bias. + * - encoding: set by user. + * - decoding: unused + */ + int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * inter quantizer bias. + * - encoding: set by user. + * - decoding: unused + */ + int inter_quant_bias; + } AVCodecContext;
--- a/h263.c Sat Mar 22 07:59:36 2003 +0000 +++ b/h263.c Sat Mar 22 12:09:02 2003 +0000 @@ -1484,14 +1484,6 @@ s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; } - - if(s->mpeg_quant){ - s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x - s->inter_quant_bias= 0; - }else{ - s->intra_quant_bias=0; - s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x - } } /**
--- a/mjpeg.c Sat Mar 22 07:59:36 2003 +0000 +++ b/mjpeg.c Sat Mar 22 12:09:02 2003 +0000 @@ -251,7 +251,6 @@ s->min_qcoeff=-1023; s->max_qcoeff= 1023; - s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x /* build all the huffman tables */ build_huffman_codes(m->huff_size_dc_luminance,
--- a/mpeg12.c Sat Mar 22 07:59:36 2003 +0000 +++ b/mpeg12.c Sat Mar 22 12:09:02 2003 +0000 @@ -702,8 +702,6 @@ s->fcode_tab= fcode_tab; s->min_qcoeff=-255; s->max_qcoeff= 255; - s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x - s->inter_quant_bias= 0; s->intra_ac_vlc_length= s->inter_ac_vlc_length= uni_mpeg1_ac_vlc_len; }
--- a/mpegvideo.c Sat Mar 22 07:59:36 2003 +0000 +++ b/mpegvideo.c Sat Mar 22 12:09:02 2003 +0000 @@ -551,6 +551,22 @@ s->progressive_sequence= !(avctx->flags & CODEC_FLAG_INTERLACED_DCT); + if(s->codec_id==CODEC_ID_MJPEG){ + s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); //(a + x/2)/x + s->inter_quant_bias= 0; + }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO){ + s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x + s->inter_quant_bias= 0; + }else{ + s->intra_quant_bias=0; + s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x + } + + if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) + s->intra_quant_bias= avctx->intra_quant_bias; + if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) + s->inter_quant_bias= avctx->inter_quant_bias; + switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1;
--- a/mpegvideo.h Sat Mar 22 07:59:36 2003 +0000 +++ b/mpegvideo.h Sat Mar 22 12:09:02 2003 +0000 @@ -360,7 +360,7 @@ uint16_t chroma_intra_matrix[64]; uint16_t inter_matrix[64]; uint16_t chroma_inter_matrix[64]; -#define QUANT_BIAS_SHIFT 4 +#define QUANT_BIAS_SHIFT 8 int intra_quant_bias; ///< bias for the quantizer int inter_quant_bias; ///< bias for the quantizer int min_qcoeff; ///< minimum encodable coefficient
--- a/utils.c Sat Mar 22 07:59:36 2003 +0000 +++ b/utils.c Sat Mar 22 12:09:02 2003 +0000 @@ -244,6 +244,9 @@ s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->me_subpel_quality=8; + + s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; + s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; } /**