mirror of https://git.ffmpeg.org/ffmpeg.git
qmin/qmax cleanup
Originally committed as revision 1689 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
6c949d129b
commit
c5a9ab69c2
|
@ -515,8 +515,6 @@ int MPV_encode_init(AVCodecContext *avctx)
|
||||||
s->rtp_payload_size = avctx->rtp_payload_size;
|
s->rtp_payload_size = avctx->rtp_payload_size;
|
||||||
if (avctx->rtp_callback)
|
if (avctx->rtp_callback)
|
||||||
s->rtp_callback = avctx->rtp_callback;
|
s->rtp_callback = avctx->rtp_callback;
|
||||||
s->qmin= avctx->qmin;
|
|
||||||
s->qmax= avctx->qmax;
|
|
||||||
s->max_qdiff= avctx->max_qdiff;
|
s->max_qdiff= avctx->max_qdiff;
|
||||||
s->qcompress= avctx->qcompress;
|
s->qcompress= avctx->qcompress;
|
||||||
s->qblur= avctx->qblur;
|
s->qblur= avctx->qblur;
|
||||||
|
|
|
@ -208,8 +208,6 @@ typedef struct MpegEncContext {
|
||||||
int fixed_qscale; ///< fixed qscale if non zero
|
int fixed_qscale; ///< fixed qscale if non zero
|
||||||
float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
|
float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0)
|
||||||
float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
|
float qblur; ///< amount of qscale smoothing over time (0.0-1.0)
|
||||||
int qmin; ///< min qscale
|
|
||||||
int qmax; ///< max qscale
|
|
||||||
int max_qdiff; ///< max qscale difference between frames
|
int max_qdiff; ///< max qscale difference between frames
|
||||||
int encoding; ///< true if we are encoding (vs decoding)
|
int encoding; ///< true if we are encoding (vs decoding)
|
||||||
int flags; ///< AVCodecContext.flags (HQ, MV4, ...)
|
int flags; ///< AVCodecContext.flags (HQ, MV4, ...)
|
||||||
|
|
|
@ -356,8 +356,8 @@ static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, doubl
|
||||||
* gets the qmin & qmax for pict_type
|
* gets the qmin & qmax for pict_type
|
||||||
*/
|
*/
|
||||||
static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type){
|
static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type){
|
||||||
int qmin= s->qmin;
|
int qmin= s->avctx->qmin;
|
||||||
int qmax= s->qmax;
|
int qmax= s->avctx->qmax;
|
||||||
|
|
||||||
if(pict_type==B_TYPE){
|
if(pict_type==B_TYPE){
|
||||||
qmin= (int)(qmin*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
|
qmin= (int)(qmin*ABS(s->avctx->b_quant_factor)+s->avctx->b_quant_offset + 0.5);
|
||||||
|
@ -368,7 +368,7 @@ static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pic
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qmin<1) qmin=1;
|
if(qmin<1) qmin=1;
|
||||||
if(qmin==1 && s->qmin>1) qmin=2; //avoid qmin=1 unless the user wants qmin=1
|
if(qmin==1 && s->avctx->qmin>1) qmin=2; //avoid qmin=1 unless the user wants qmin=1
|
||||||
|
|
||||||
if(qmin<3 && s->max_qcoeff<=128 && pict_type==I_TYPE) qmin=3; //reduce cliping problems
|
if(qmin<3 && s->max_qcoeff<=128 && pict_type==I_TYPE) qmin=3; //reduce cliping problems
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue