mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2025-02-09 05:47:24 +00:00
user setable quantizer bias
Originally committed as revision 1701 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
65f7062dfa
commit
1984f6359e
@ -15,8 +15,8 @@ extern "C" {
|
||||
|
||||
#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 @@ typedef struct AVCodecContext {
|
||||
* - decoding: set by lavc.
|
||||
* @todo move this after frame_rate
|
||||
*/
|
||||
int frame_rate_base;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
@ -1484,14 +1484,6 @@ void h263_encode_init(MpegEncContext *s)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,7 +251,6 @@ int mjpeg_init(MpegEncContext *s)
|
||||
|
||||
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,
|
||||
|
@ -702,8 +702,6 @@ void ff_mpeg1_encode_init(MpegEncContext *s)
|
||||
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;
|
||||
}
|
||||
|
@ -551,6 +551,22 @@ int MPV_encode_init(AVCodecContext *avctx)
|
||||
|
||||
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;
|
||||
|
@ -360,7 +360,7 @@ typedef struct MpegEncContext {
|
||||
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
|
||||
|
@ -244,6 +244,9 @@ void avcodec_get_context_defaults(AVCodecContext *s){
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user