[FFmpeg-devel] Minor cleanup/fixes

Etienne Buira etienne.buira.lists at free.fr
Thu May 26 21:14:37 CEST 2011


Hi all.

$subject

Regards.
-------------- next part --------------
>From 1b1645e2fdf8ac6573e65b849bde88f51a12b9f4 Mon Sep 17 00:00:00 2001
From: Etienne Buira <etienne.buira.lists at free.fr>
Date: Thu, 26 May 2011 19:48:59 +0200
Subject: [PATCH 1/4] Minor cleanup in libx264.c

Not needed as overwritten later on (look for "// update AVCodecContext
with x264 parameters"), and not accessed inbetween.
---
 libavcodec/libx264.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index d9bac17..d2e7c75 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -222,7 +222,6 @@ static av_cold int X264_init(AVCodecContext *avctx)
     x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
     x4->params.i_bframe_bias     = avctx->bframebias;
     x4->params.i_bframe_pyramid  = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? X264_B_PYRAMID_NORMAL : X264_B_PYRAMID_NONE;
-    avctx->has_b_frames          = avctx->flags2 & CODEC_FLAG2_BPYRAMID ? 2 : !!avctx->max_b_frames;
 
     x4->params.i_keyint_min = avctx->keyint_min;
     if (x4->params.i_keyint_min > x4->params.i_keyint_max)
-- 
1.7.3.4

-------------- next part --------------
>From c7f6f5e69db8c400a1fdee3e1f050a128103e007 Mon Sep 17 00:00:00 2001
From: Etienne Buira <etienne.buira.lists at free.fr>
Date: Thu, 26 May 2011 19:52:16 +0200
Subject: [PATCH 2/4] Remove specific note when not specific

---
 libavcodec/options.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/options.c b/libavcodec/options.c
index ccf1b87..78a7bc8 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -353,8 +353,8 @@ static const AVOption options[]={
 {"brd_scale", "downscales frames for dynamic B-frame decision", OFFSET(brd_scale), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, 10, V|E},
 {"crf", "enables constant quality mode, and selects the quality (x264/VP8)", OFFSET(crf), FF_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 63, V|E},
 {"cqp", "constant quantization parameter rate control method", OFFSET(cqp), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, V|E},
-{"keyint_min", "minimum interval between IDR-frames (x264)", OFFSET(keyint_min), FF_OPT_TYPE_INT, {.dbl = 25 }, INT_MIN, INT_MAX, V|E},
-{"refs", "reference frames to consider for motion compensation (Snow)", OFFSET(refs), FF_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E},
+{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), FF_OPT_TYPE_INT, {.dbl = 25 }, INT_MIN, INT_MAX, V|E},
+{"refs", "reference frames to consider for motion compensation", OFFSET(refs), FF_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E},
 {"chromaoffset", "chroma qp offset from luma", OFFSET(chromaoffset), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"bframebias", "influences how often B-frames are used", OFFSET(bframebias), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"trellis", "rate-distortion optimal quantization", OFFSET(trellis), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
-- 
1.7.3.4

-------------- next part --------------
>From eedeac5c433523ca2f0dbb436018f51c100f5f85 Mon Sep 17 00:00:00 2001
From: Etienne Buira <etienne.buira.lists at free.fr>
Date: Thu, 26 May 2011 21:00:37 +0200
Subject: [PATCH 3/4] Fix typo

---
 libavcodec/libx264.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index d2e7c75..1276737 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -194,7 +194,7 @@ static void check_default_settings(AVCodecContext *avctx)
     if (score >= 5) {
         av_log(avctx, AV_LOG_ERROR, "Default settings detected, using medium profile\n");
         x4->preset = av_strdup("medium");
-        if (avctx->bit_rate == 200*100)
+        if (avctx->bit_rate == 200*1000)
             avctx->crf = 23;
     }
 }
-- 
1.7.3.4

-------------- next part --------------
>From 517636f9fb01de17ec24d137022d045fac644f6d Mon Sep 17 00:00:00 2001
From: Etienne Buira <etienne.buira.lists at free.fr>
Date: Thu, 26 May 2011 21:02:50 +0200
Subject: [PATCH 4/4] Fix memleak

---
 libavcodec/libx264.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 1276737..22bffce 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -170,6 +170,7 @@ static av_cold int X264_close(AVCodecContext *avctx)
     av_free(x4->level);
     av_free(x4->stats);
     av_free(x4->weightp);
+    av_free(x4->x264opts);
 
     return 0;
 }
-- 
1.7.3.4



More information about the ffmpeg-devel mailing list