[FFmpeg-cvslog] avfilter/vf_thumbnail: add support for rest of packed rgb formats

Paul B Mahol git at videolan.org
Mon Feb 8 14:01:54 EET 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Feb  8 12:58:12 2021 +0100| [a773455c4f02558e3cd24ae79616edee146da146] | committer: Paul B Mahol

avfilter/vf_thumbnail: add support for rest of packed rgb formats

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

 libavfilter/vf_thumbnail.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c
index a0561683aa..e49b70c3b3 100644
--- a/libavfilter/vf_thumbnail.c
+++ b/libavfilter/vf_thumbnail.c
@@ -157,6 +157,32 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
             p += frame->linesize[0];
         }
         break;
+    case AV_PIX_FMT_RGB0:
+    case AV_PIX_FMT_BGR0:
+    case AV_PIX_FMT_RGBA:
+    case AV_PIX_FMT_BGRA:
+        for (j = 0; j < inlink->h; j++) {
+            for (i = 0; i < inlink->w; i++) {
+                hist[0*256 + p[i*4    ]]++;
+                hist[1*256 + p[i*4 + 1]]++;
+                hist[2*256 + p[i*4 + 2]]++;
+            }
+            p += frame->linesize[0];
+        }
+        break;
+    case AV_PIX_FMT_0RGB:
+    case AV_PIX_FMT_0BGR:
+    case AV_PIX_FMT_ARGB:
+    case AV_PIX_FMT_ABGR:
+        for (j = 0; j < inlink->h; j++) {
+            for (i = 0; i < inlink->w; i++) {
+                hist[0*256 + p[i*4 + 1]]++;
+                hist[1*256 + p[i*4 + 2]]++;
+                hist[2*256 + p[i*4 + 3]]++;
+            }
+            p += frame->linesize[0];
+        }
+        break;
     default:
         for (int plane = 0; plane < 3; plane++) {
             const uint8_t *p = frame->data[plane];
@@ -222,6 +248,10 @@ static int query_formats(AVFilterContext *ctx)
 {
     static const enum AVPixelFormat pix_fmts[] = {
         AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
+        AV_PIX_FMT_RGBA,  AV_PIX_FMT_BGRA,
+        AV_PIX_FMT_RGB0,  AV_PIX_FMT_BGR0,
+        AV_PIX_FMT_ABGR,  AV_PIX_FMT_ARGB,
+        AV_PIX_FMT_0BGR,  AV_PIX_FMT_0RGB,
         AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
         AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
         AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,



More information about the ffmpeg-cvslog mailing list