[FFmpeg-cvslog] swscale: Forward colorspace updates to the 2nd cascaded context in case of alphablend

Michael Niedermayer git at videolan.org
Thu Sep 10 17:31:08 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Thu Sep 10 17:01:47 2015 +0200| [d730dd8c53f58b067de27348b759f7d089f05487] | committer: Michael Niedermayer

swscale: Forward colorspace updates to the 2nd cascaded context in case of alphablend

The first just does the blending and wouldnt do anything with the colorspace values

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libswscale/swscale_internal.h |    1 +
 libswscale/utils.c            |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 9676d46..721a9ca 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -322,6 +322,7 @@ typedef struct SwsContext {
     uint8_t *cascaded_tmp[4];
     int cascaded1_tmpStride[4];
     uint8_t *cascaded1_tmp[4];
+    int cascaded_mainindex;
 
     double gamma_value;
     int gamma_flag;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 5265157..eb1c940 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -858,8 +858,8 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
     c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
     c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
 
-    if (c->cascaded_context[0])
-        return sws_setColorspaceDetails(c->cascaded_context[0],inv_table, srcRange,table, dstRange, brightness,  contrast, saturation);
+    if (c->cascaded_context[c->cascaded_mainindex])
+        return sws_setColorspaceDetails(c->cascaded_context[c->cascaded_mainindex],inv_table, srcRange,table, dstRange, brightness,  contrast, saturation);
 
     if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat))) {
         if (!c->cascaded_context[0] &&
@@ -1485,6 +1485,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
             usesHFilter || usesVFilter ||
             c->srcRange != c->dstRange
         ) {
+            c->cascaded_mainindex = 1;
             ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
                                 srcW, srcH, tmpFormat, 64);
             if (ret < 0)



More information about the ffmpeg-cvslog mailing list