[FFmpeg-devel] [PATCH] vf_scale: ensure the palette is set for output.
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sun Apr 8 16:00:16 CEST 2012
Since those are pseudo-palette formats, swscale does not write
into data[1], swscale must initialize the palette properly itself.
This lead to frames that actually decoded as all-gray before.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
libavfilter/vf_scale.c | 3 +++
tests/ref/lavfi/pixfmts_crop | 2 +-
tests/ref/lavfi/pixfmts_null | 2 +-
tests/ref/lavfi/pixfmts_scale | 2 +-
tests/ref/lavfi/pixfmts_vflip | 2 +-
tests/ref/vsynth1/zmbv | 4 ++--
tests/ref/vsynth2/zmbv | 4 ++--
7 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index 00f2ed1..86be86f 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -28,6 +28,7 @@
#include "libavutil/eval.h"
#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "libswscale/swscale.h"
@@ -279,6 +280,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
outpicref->video->h = outlink->h;
outlink->out_buf = outpicref;
+ if(scale->output_is_pal)
+ ff_set_systematic_pal2(outpicref->data[1], outlink->format == PIX_FMT_PAL8 ? PIX_FMT_BGR8 : outlink->format);
av_reduce(&outpicref->video->sample_aspect_ratio.num, &outpicref->video->sample_aspect_ratio.den,
(int64_t)picref->video->sample_aspect_ratio.num * outlink->h * link->w,
diff --git a/tests/ref/lavfi/pixfmts_crop b/tests/ref/lavfi/pixfmts_crop
index b84e1b8..7d135ab 100644
--- a/tests/ref/lavfi/pixfmts_crop
+++ b/tests/ref/lavfi/pixfmts_crop
@@ -13,7 +13,7 @@ bgra 395c9f706fccda721471acaa5c96c16c
gray 8c4850e66562a587a292dc728a65ea4a
gray16be 257b4339925b0e672f552d8c9511f2c3
gray16le 67cf7b26cda55356cc25e0f4e42cc136
-pal8 d6c1b598244f41e2f005e42407d234d2
+pal8 0a7c8a7029b77619a6d847cf6f6ad0ac
rgb24 3b90ed64b687d3dc186c6ef521dc71a8
rgb48be e6fd353c0eb9bea889423954414bea35
rgb48le 68a1723da11ce08b502d42e204376503
diff --git a/tests/ref/lavfi/pixfmts_null b/tests/ref/lavfi/pixfmts_null
index 1bae05e..a69cd23 100644
--- a/tests/ref/lavfi/pixfmts_null
+++ b/tests/ref/lavfi/pixfmts_null
@@ -22,7 +22,7 @@ monob 668ebe8b8103b9046b251b2fa8a1d88f
monow 9251497f3b0634f1165d12d5a289d943
nv12 e0af357888584d36eec5aa0f673793ef
nv21 9a3297f3b34baa038b1f37cb202b512f
-pal8 dec8ed2258ec89b8a796f21cad4df867
+pal8 09b4a6a3167576627fe0540994c3eb24
rgb0 1ed8e8027126d283e6ed7359e81c56e4
rgb24 b41eba9651e1b5fe386289b506188105
rgb444be 9e89db334568c6b2e3d5d0540f4ba960
diff --git a/tests/ref/lavfi/pixfmts_scale b/tests/ref/lavfi/pixfmts_scale
index 0da314e..7a12d08 100644
--- a/tests/ref/lavfi/pixfmts_scale
+++ b/tests/ref/lavfi/pixfmts_scale
@@ -22,7 +22,7 @@ monob cb62f31b701c6e987b574974d1b31e32
monow fd5d417ab7728acddffc06870661df61
nv12 4676d59db43d657dc12841f6bc3ab452
nv21 69c699510ff1fb777b118ebee1002f14
-pal8 6324fa058e1bc157ed7132bfe4022317
+pal8 0e7e9aee9f4f02f50cb72bee640843df
rgb0 a01995946117e77b20e851506d64688c
rgb24 13ff53ebeab74dc05492836f1cfbd2c1
rgb444be 46e466b2709f62b2fffc63708063eaaf
diff --git a/tests/ref/lavfi/pixfmts_vflip b/tests/ref/lavfi/pixfmts_vflip
index e09697f..78b7474 100644
--- a/tests/ref/lavfi/pixfmts_vflip
+++ b/tests/ref/lavfi/pixfmts_vflip
@@ -22,7 +22,7 @@ monob d0cf8732677a5360b6160133043590d8
monow ff9869d067ecb94eb9d90c9750c31fea
nv12 046f00f598ce14d9854a3534a5c99114
nv21 01ea369dd2d0d3ed7451dc5c8d61497f
-pal8 47ed19a7e128b0e33c25d2a463b0611a
+pal8 f20e2ccf7e884d31a6766d45a73c2cdf
rgb0 972c4ed97786aa30b7137b083b0e0afc
rgb24 eaefabc168d0b14576bab45bc1e56e1e
rgb444be 06722e03f8404e7d2226665ed2444a32
diff --git a/tests/ref/vsynth1/zmbv b/tests/ref/vsynth1/zmbv
index 8e01707..e49cb26 100644
--- a/tests/ref/vsynth1/zmbv
+++ b/tests/ref/vsynth1/zmbv
@@ -1,3 +1,3 @@
5112508 ./tests/data/vsynth1/zmbv.avi
-cfbec364e41d70c9b177435b5655d8af *./tests/data/zmbv.vsynth1.out.yuv
-stddev: 46.47 PSNR: 14.79 MAXDIFF: 129 bytes: 7603200/ 7603200
+4ad1ca9de7c65eab68a619c54fffaec8 *./tests/data/zmbv.vsynth1.out.yuv
+stddev: 8.61 PSNR: 29.43 MAXDIFF: 64 bytes: 7603200/ 7603200
diff --git a/tests/ref/vsynth2/zmbv b/tests/ref/vsynth2/zmbv
index 4562b5a..6d7d614 100644
--- a/tests/ref/vsynth2/zmbv
+++ b/tests/ref/vsynth2/zmbv
@@ -1,3 +1,3 @@
5116352 ./tests/data/vsynth2/zmbv.avi
-cfbec364e41d70c9b177435b5655d8af *./tests/data/zmbv.vsynth2.out.yuv
-stddev: 42.07 PSNR: 15.65 MAXDIFF: 112 bytes: 7603200/ 7603200
+ee68a5292fd0745834246b4ec0d85e9b *./tests/data/zmbv.vsynth2.out.yuv
+stddev: 8.12 PSNR: 29.94 MAXDIFF: 32 bytes: 7603200/ 7603200
--
1.7.9.5
More information about the ffmpeg-devel
mailing list