[FFmpeg-devel] [PATCH] libx264: fix -b_qfactor and -chromaoffset

Michael Niedermayer michaelni at gmx.at
Tue Aug 26 20:14:43 CEST 2014


On Tue, Aug 26, 2014 at 02:58:32PM +0800, Hii wrote:
> Hi,
> 
> On 2014-08-25 01:24, Michael Niedermayer wrote:
> > On Sat, Aug 23, 2014 at 08:59:41PM +0800, Hii wrote:
> >> Currently -b_qfactor and -chromaoffset have no effect in libx264,
> >> the attached patch is an attempt to fix the issue.
> >>
> >> Move the corresponding lines after x264_param_default_preset() to
> >> prevent them being overwritten by it, make the two parameters
> >> functional.
> >> Also make b_qfactor changeable by x264's tunings after the move.
> >>
> >> (feel free to edit the commit message as I am not a native
> English speaker.)
> >>
> >>
> >
> >>   libx264.c |    6 ++++--
> >>   1 file changed, 4 insertions(+), 2 deletions(-)
> >> affb26a7840db085fb82ac8e24e5fe5770774113
> 0001-libx264-fix-b_qfactor-and-chromaoffset.patch
> >>  From d8597d3f708c21deae40b21754173763c5a13658 Mon Sep 17 00:00:00 2001
> >> From: Hii <hiiragikei at gmail.com>
> >> Date: Sat, 23 Aug 2014 17:08:02 +0800
> >> Subject: [PATCH] libx264: fix -b_qfactor and -chromaoffset
> >>
> >> ---
> >>   libavcodec/libx264.c | 6 ++++--
> >>   1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> >> index 7793581..8aff14d 100644
> >> --- a/libavcodec/libx264.c
> >> +++ b/libavcodec/libx264.c
> >> @@ -371,8 +371,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
> >>
> >>       x4->params.b_deblocking_filter         = avctx->flags &
> CODEC_FLAG_LOOP_FILTER;
> >>
> >> -    x4->params.rc.f_pb_factor             = avctx->b_quant_factor;
> >> -    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
> >>       if (x4->preset || x4->tune)
> >>           if (x264_param_default_preset(&x4->params, x4->preset,
> x4->tune) < 0) {
> >>               int i;
> >> @@ -430,6 +428,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
> >>
> >>       if (avctx->i_quant_factor > 0)
> >>           x4->params.rc.f_ip_factor         = 1 /
> fabs(avctx->i_quant_factor);
> >> +    if (avctx->b_quant_factor > 0)
> >> +        x4->params.rc.f_pb_factor         = avctx->b_quant_factor;
> >
> >> +    x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
> >
> > i think this would unconditionally override i_chroma_qp_offset
> > from x264_param_default_preset()
> >
> > all others are only overridde when explicitly set by the user
> 
> Here's another try.

>  libx264.c |    7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 20824b7c002625f609c6d6a76de27e0910e2a70e  0001-libx264-fix-b_qfactor-and-chromaoffset.patch
> From 402a0d7752891f1682c30deab2d7052ce35b7303 Mon Sep 17 00:00:00 2001
> From: Hii <hiiragikei at gmail.com>
> Date: Tue, 26 Aug 2014 14:55:14 +0800
> Subject: [PATCH] libx264: fix -b_qfactor and -chromaoffset

applied
thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140826/c2d82516/attachment.asc>


More information about the ffmpeg-devel mailing list