diff mbox

[FFmpeg-devel,v4] avcodec/snowenc: fix setting motion_est option

Message ID 20170827015310.2812-1-jamrial@gmail.com
State Accepted
Commit 95a6de5674ab8f5116241cfa4bb02a0954b843d8
Headers show

Commit Message

James Almer Aug. 27, 2017, 1:53 a.m. UTC
Remove usage of FF_MPV_COMMON_OPTS, and set SnowContext.motion_est directly.
Based on code from svq1enc.c

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/snow.h    |  3 ++-
 libavcodec/snowenc.c | 11 +++++++----
 2 files changed, 9 insertions(+), 5 deletions(-)

Comments

Michael Niedermayer Aug. 29, 2017, 12:13 a.m. UTC | #1
On Sat, Aug 26, 2017 at 10:53:10PM -0300, James Almer wrote:
> Remove usage of FF_MPV_COMMON_OPTS, and set SnowContext.motion_est directly.
> Based on code from svq1enc.c
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/snow.h    |  3 ++-
>  libavcodec/snowenc.c | 11 +++++++----
>  2 files changed, 9 insertions(+), 5 deletions(-)

couldnt find another failure

thx

[...]
James Almer Aug. 29, 2017, 12:37 a.m. UTC | #2
On 8/28/2017 9:13 PM, Michael Niedermayer wrote:
> On Sat, Aug 26, 2017 at 10:53:10PM -0300, James Almer wrote:
>> Remove usage of FF_MPV_COMMON_OPTS, and set SnowContext.motion_est directly.
>> Based on code from svq1enc.c
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/snow.h    |  3 ++-
>>  libavcodec/snowenc.c | 11 +++++++----
>>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> couldnt find another failure
> 
> thx

Pushed, thanks.
diff mbox

Patch

diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index f7ed1f82e7..41a3bef4de 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -32,10 +32,11 @@ 
 #include "rangecoder.h"
 #include "mathops.h"
 
-#define FF_MPV_OFFSET(x) (offsetof(MpegEncContext, x) + offsetof(SnowContext, m))
 #include "mpegvideo.h"
 #include "h264qpel.h"
 
+#define FF_ME_ITER 3
+
 #define MID_STATE 128
 
 #define MAX_PLANES 4
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index e03877a96c..bb113d0a2b 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -33,8 +33,6 @@ 
 #include "mpegvideo.h"
 #include "h263.h"
 
-#define FF_ME_ITER 50
-
 static av_cold int encode_init(AVCodecContext *avctx)
 {
     SnowContext *s = avctx->priv_data;
@@ -86,6 +84,8 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
     s->m.avctx   = avctx;
     s->m.bit_rate= avctx->bit_rate;
+    s->m.lmin    = avctx->mb_lmin;
+    s->m.lmax    = avctx->mb_lmax;
 
     s->m.me.temp      =
     s->m.me.scratchpad= av_mallocz_array((avctx->width+64), 2*16*2*sizeof(uint8_t));
@@ -1929,8 +1929,11 @@  static av_cold int encode_end(AVCodecContext *avctx)
 #define OFFSET(x) offsetof(SnowContext, x)
 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
-    FF_MPV_COMMON_OPTS
-    { "iter",           NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ITER }, 0, 0, FF_MPV_OPT_FLAGS, "motion_est" },
+    {"motion_est", "motion estimation algorithm", OFFSET(motion_est), AV_OPT_TYPE_INT, {.i64 = FF_ME_EPZS }, FF_ME_ZERO, FF_ME_ITER, VE, "motion_est" },
+    { "zero", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ZERO }, 0, 0, VE, "motion_est" },
+    { "epzs", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_EPZS }, 0, 0, VE, "motion_est" },
+    { "xone", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_XONE }, 0, 0, VE, "motion_est" },
+    { "iter", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = FF_ME_ITER }, 0, 0, VE, "motion_est" },
     { "memc_only",      "Only do ME/MC (I frames -> ref, P frame -> ME+MC).",   OFFSET(memc_only), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
     { "no_bitstream",   "Skip final bitstream writeout.",                    OFFSET(no_bitstream), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
     { "intra_penalty",  "Penalty for intra blocks in block decission",      OFFSET(intra_penalty), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },