[FFmpeg-cvslog] avfilter/vf_cropdetect: support 9-16bit planar formats

Michael Niedermayer git at videolan.org
Tue Dec 30 05:46:04 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Dec 30 05:29:27 2014 +0100| [6ab4812f31c691f8d1729af84aac9e8d45bc6447] | committer: Michael Niedermayer

avfilter/vf_cropdetect: support 9-16bit planar formats

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

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

 libavfilter/vf_cropdetect.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c
index abfbd1d..592eb15 100644
--- a/libavfilter/vf_cropdetect.c
+++ b/libavfilter/vf_cropdetect.c
@@ -51,6 +51,11 @@ static int query_formats(AVFilterContext *ctx)
         AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVJ444P,
         AV_PIX_FMT_YUV411P, AV_PIX_FMT_GRAY8,
         AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV410P,
+        AV_PIX_FMT_YUV420P9 , AV_PIX_FMT_YUV422P9 , AV_PIX_FMT_YUV444P9,
+        AV_PIX_FMT_YUV420P10, AV_PIX_FMT_YUV422P10, AV_PIX_FMT_YUV444P10,
+        AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV444P12,
+        AV_PIX_FMT_YUV420P14, AV_PIX_FMT_YUV422P14, AV_PIX_FMT_YUV444P14,
+        AV_PIX_FMT_YUV420P16, AV_PIX_FMT_YUV422P16, AV_PIX_FMT_YUV444P16,
         AV_PIX_FMT_NV12,    AV_PIX_FMT_NV21,
         AV_PIX_FMT_RGB24,   AV_PIX_FMT_BGR24,
         AV_PIX_FMT_RGBA,    AV_PIX_FMT_BGRA,
@@ -65,6 +70,7 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
 {
     int total = 0;
     int div = len;
+    const uint16_t *src16 = (const uint16_t *)src;
 
     switch (bpp) {
     case 1:
@@ -79,6 +85,19 @@ static int checkline(void *ctx, const unsigned char *src, int stride, int len, i
             src += stride;
         }
         break;
+    case 2:
+        stride >>= 1;
+        while (len >= 8) {
+            total += src16[       0] + src16[  stride] + src16[2*stride] + src16[3*stride]
+                  +  src16[4*stride] + src16[5*stride] + src16[6*stride] + src16[7*stride];
+            src += 8*stride;
+            len -= 8;
+        }
+        while (--len >= 0) {
+            total += src16[0];
+            src += stride;
+        }
+        break;
     case 3:
     case 4:
         while (len >= 4) {



More information about the ffmpeg-cvslog mailing list