Browse code

avfilter/vf_stereo3d: BGR24 support for anaglyphs

Signed-off-by: Paul B Mahol <onemda@gmail.com>

Paul B Mahol authored on 2013/09/16 19:33:04
Showing 1 changed files
... ...
@@ -25,6 +25,7 @@
25 25
 #include "libavutil/parseutils.h"
26 26
 #include "libavutil/pixdesc.h"
27 27
 #include "avfilter.h"
28
+#include "drawutils.h"
28 29
 #include "formats.h"
29 30
 #include "internal.h"
30 31
 #include "video.h"
... ...
@@ -192,7 +193,11 @@ static const AVOption stereo3d_options[] = {
192 192
 
193 193
 AVFILTER_DEFINE_CLASS(stereo3d);
194 194
 
195
-static const enum AVPixelFormat anaglyph_pix_fmts[] = { AV_PIX_FMT_RGB24, AV_PIX_FMT_NONE };
195
+static const enum AVPixelFormat anaglyph_pix_fmts[] = {
196
+    AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
197
+    AV_PIX_FMT_NONE
198
+};
199
+
196 200
 static const enum AVPixelFormat other_pix_fmts[] = {
197 201
     AV_PIX_FMT_RGB24, AV_PIX_FMT_BGR24,
198 202
     AV_PIX_FMT_RGB48BE, AV_PIX_FMT_BGR48BE,
... ...
@@ -388,11 +393,15 @@ static int config_output(AVFilterLink *outlink)
388 388
     case ANAGLYPH_YB_GRAY:
389 389
     case ANAGLYPH_YB_HALF:
390 390
     case ANAGLYPH_YB_COLOR:
391
-    case ANAGLYPH_YB_DUBOIS:
392
-        s->ana_matrix[0] = &ana_coeff[s->out.format][0][0];
393
-        s->ana_matrix[1] = &ana_coeff[s->out.format][1][0];
394
-        s->ana_matrix[2] = &ana_coeff[s->out.format][2][0];
391
+    case ANAGLYPH_YB_DUBOIS: {
392
+        uint8_t rgba_map[4];
393
+
394
+        ff_fill_rgba_map(rgba_map, outlink->format);
395
+        s->ana_matrix[rgba_map[0]] = &ana_coeff[s->out.format][0][0];
396
+        s->ana_matrix[rgba_map[1]] = &ana_coeff[s->out.format][1][0];
397
+        s->ana_matrix[rgba_map[2]] = &ana_coeff[s->out.format][2][0];
395 398
         break;
399
+    }
396 400
     case SIDE_BY_SIDE_2_LR:
397 401
         aspect.den      *= 2;
398 402
     case SIDE_BY_SIDE_LR: