[FFmpeg-cvslog] swscale: Allow chroma samples to be above and to the left of luma samples

Michael Niedermayer git at videolan.org
Sun Sep 21 12:47:17 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 21 12:12:50 2014 +0200| [61af6bebb457c8d9bb00baaccd65a39632437bcd] | committer: Michael Niedermayer

swscale: Allow chroma samples to be above and to the left of luma samples

Found-by: Kierank
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswscale/options.c |    8 ++++----
 libswscale/utils.c   |    2 +-
 libswscale/version.h |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libswscale/options.c b/libswscale/options.c
index 5433d55..4d49c3e 100644
--- a/libswscale/options.c
+++ b/libswscale/options.c
@@ -64,10 +64,10 @@ static const AVOption swscale_options[] = {
     { "param0",          "scaler param 0",                OFFSET(param[0]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX,        VE },
     { "param1",          "scaler param 1",                OFFSET(param[1]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX,        VE },
 
-    { "src_v_chr_pos",   "source vertical chroma position in luma grid/256"  , OFFSET(src_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
-    { "src_h_chr_pos",   "source horizontal chroma position in luma grid/256", OFFSET(src_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
-    { "dst_v_chr_pos",   "destination vertical chroma position in luma grid/256"  , OFFSET(dst_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
-    { "dst_h_chr_pos",   "destination horizontal chroma position in luma grid/256", OFFSET(dst_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -1            }, -1,      512,             VE },
+    { "src_v_chr_pos",   "source vertical chroma position in luma grid/256"  ,      OFFSET(src_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513,      512,             VE },
+    { "src_h_chr_pos",   "source horizontal chroma position in luma grid/256",      OFFSET(src_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513,      512,             VE },
+    { "dst_v_chr_pos",   "destination vertical chroma position in luma grid/256"  , OFFSET(dst_v_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513,      512,             VE },
+    { "dst_h_chr_pos",   "destination horizontal chroma position in luma grid/256", OFFSET(dst_h_chr_pos), AV_OPT_TYPE_INT, { .i64 = -513 }, -513,      512,             VE },
 
     { "sws_dither",      "set dithering algorithm",       OFFSET(dither),    AV_OPT_TYPE_INT,    { .i64  = SWS_DITHER_AUTO    }, 0,       NB_SWS_DITHER,  VE, "sws_dither" },
     { "auto",            "leave choice to sws",           0,                 AV_OPT_TYPE_CONST,  { .i64  = SWS_DITHER_AUTO    }, INT_MIN, INT_MAX,        VE, "sws_dither" },
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 06fd358..5615700 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -266,7 +266,7 @@ static double getSplineCoeff(double a, double b, double c, double d,
 
 static av_cold int get_local_pos(SwsContext *s, int chr_subsample, int pos, int dir)
 {
-    if (pos < 0) {
+    if (pos == -1 || pos <= -513) {
         pos = (128 << chr_subsample) - 128;
     }
     pos += 128; // relative to ideal left edge
diff --git a/libswscale/version.h b/libswscale/version.h
index b764883..77c374e 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -27,7 +27,7 @@
 #include "libavutil/version.h"
 
 #define LIBSWSCALE_VERSION_MAJOR 3
-#define LIBSWSCALE_VERSION_MINOR 0
+#define LIBSWSCALE_VERSION_MINOR 1
 #define LIBSWSCALE_VERSION_MICRO 100
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list