[FFmpeg-cvslog] snow: add 'memc_only' private option.

Anton Khirnov git at videolan.org
Thu Sep 1 00:03:07 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 27 10:16:14 2011 +0200| [0cc06b9e23bc798b1af3302d095db23f000a97e6] | committer: Anton Khirnov

snow: add 'memc_only' private option.

Deprecate CODEC_FLAG2_MEMC_ONLY

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0cc06b9e23bc798b1af3302d095db23f000a97e6
---

 libavcodec/avcodec.h |    2 ++
 libavcodec/snow.c    |   22 ++++++++++++++++++++--
 libavcodec/version.h |    3 +++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f59b850..2059fd7 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -619,7 +619,9 @@ typedef struct RcOverride{
 #if FF_API_MPEGVIDEO_GLOBAL_OPTS
 #define CODEC_FLAG2_INTRA_VLC     0x00000800 ///< Use MPEG-2 intra VLC table.
 #endif
+#if FF_API_SNOW_GLOBAL_OPTS
 #define CODEC_FLAG2_MEMC_ONLY     0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
+#endif
 #if FF_API_MPEGVIDEO_GLOBAL_OPTS
 #define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format.
 #endif
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 2af5d23..974b7c3 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -19,6 +19,8 @@
  */
 
 #include "libavutil/intmath.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
 #include "avcodec.h"
 #include "dsputil.h"
 #include "dwt.h"
@@ -199,7 +201,7 @@ typedef struct Plane{
 }Plane;
 
 typedef struct SnowContext{
-
+    AVClass *class;
     AVCodecContext *avctx;
     RangeCoder c;
     DSPContext dsp;
@@ -252,6 +254,7 @@ typedef struct SnowContext{
     int me_cache[ME_CACHE_SIZE];
     int me_cache_generation;
     slice_buffer sb;
+    int memc_only;
 
     MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
 
@@ -3518,7 +3521,7 @@ redo_frame:
         int x, y;
 //        int bits= put_bits_count(&s->c.pb);
 
-        if(!(avctx->flags2 & CODEC_FLAG2_MEMC_ONLY)){
+        if (!s->memc_only) {
             //FIXME optimize
             if(pict->data[plane_index]) //FIXME gray hack
                 for(y=0; y<h; y++){
@@ -3676,6 +3679,20 @@ static av_cold int encode_end(AVCodecContext *avctx)
     return 0;
 }
 
+#define OFFSET(x) offsetof(SnowContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+    { "memc_only",      "Only do ME/MC (I frames -> ref, P frame -> ME+MC).",   OFFSET(memc_only), FF_OPT_TYPE_INT, { 0 }, 0, 1, VE },
+    { NULL },
+};
+
+static const AVClass snowenc_class = {
+    .class_name = "snow encoder",
+    .item_name  = av_default_item_name,
+    .option     = options,
+    .version    = LIBAVUTIL_VERSION_INT,
+};
+
 AVCodec ff_snow_encoder = {
     .name           = "snow",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -3685,5 +3702,6 @@ AVCodec ff_snow_encoder = {
     .encode         = encode_frame,
     .close          = encode_end,
     .long_name = NULL_IF_CONFIG_SMALL("Snow"),
+    .priv_class     = &snowenc_class,
 };
 #endif
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 0de224b..7abd993 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -92,5 +92,8 @@
 #ifndef FF_API_LAME_GLOBAL_OPTS
 #define FF_API_LAME_GLOBAL_OPTS  (LIBAVCODEC_VERSION_MAJOR < 54)
 #endif
+#ifndef FF_API_SNOW_GLOBAL_OPTS
+#define FF_API_SNOW_GLOBAL_OPTS  (LIBAVCODEC_VERSION_MAJOR < 54)
+#endif
 
 #endif /* AVCODEC_VERSION_H */



More information about the ffmpeg-cvslog mailing list