[FFmpeg-cvslog] Merge commit 'c19830aa2c19f9713b612f7e2fdb437df91ba266'

Clément Bœsch git at videolan.org
Thu Mar 23 12:40:23 EET 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Thu Mar 23 11:33:27 2017 +0100| [5f044d23726375f451463ae443bb9a33827374be] | committer: Clément Bœsch

Merge commit 'c19830aa2c19f9713b612f7e2fdb437df91ba266'

* commit 'c19830aa2c19f9713b612f7e2fdb437df91ba266':
  rscc: Support palette format

See 11777eb8142117864bff0c8060f17b4089434143

Merged-by: Clément Bœsch <u at pkh.me>

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

 libavcodec/rscc.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index f13706c..ebacd3f 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -31,7 +31,7 @@
  * and it can be deflated or not. Similarly, pixel data comes after the header
  * and a variable size value, and it can be deflated or just raw.
  *
- * Supports: BGRA, BGR24, RGB555, PAL8
+ * Supports: PAL8, BGRA, BGR24, RGB555
  */
 
 #include <stdint.h>
@@ -58,7 +58,8 @@ typedef struct RsccContext {
     Tile *tiles;
     unsigned int tiles_size;
     int component_size;
-    uint32_t pal[AVPALETTE_COUNT];
+
+    uint8_t palette[AVPALETTE_SIZE];
 
     /* zlib interaction */
     uint8_t *inflated_buf;
@@ -309,19 +310,22 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
     } else {
         frame->pict_type = AV_PICTURE_TYPE_P;
     }
+
+    /* Palette handling */
     if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
         int size;
-        const uint8_t *pal = av_packet_get_side_data(avpkt,
-                                                     AV_PKT_DATA_PALETTE,
-                                                     &size);
-        if (pal && size == AVPALETTE_SIZE) {
+        const uint8_t *palette = av_packet_get_side_data(avpkt,
+                                                         AV_PKT_DATA_PALETTE,
+                                                         &size);
+        if (palette && size == AVPALETTE_SIZE) {
             frame->palette_has_changed = 1;
-            memcpy(ctx->pal, pal, AVPALETTE_SIZE);
-        } else if (pal) {
+            memcpy(ctx->palette, palette, AVPALETTE_SIZE);
+        } else if (palette) {
             av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
         }
-        memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
+        memcpy (frame->data[1], ctx->palette, AVPALETTE_SIZE);
     }
+
     *got_frame = 1;
 
     ret = avpkt->size;


======================================================================

diff --cc libavcodec/rscc.c
index f13706c,dfc2338..ebacd3f
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@@ -31,7 -31,7 +31,7 @@@
   * and it can be deflated or not. Similarly, pixel data comes after the header
   * and a variable size value, and it can be deflated or just raw.
   *
-  * Supports: BGRA, BGR24, RGB555, PAL8
 - * Supports: PAL8, BGRA, BGR24, RGB555, RGB8
++ * Supports: PAL8, BGRA, BGR24, RGB555
   */
  
  #include <stdint.h>
@@@ -309,22 -293,21 +310,25 @@@ static int rscc_decode_frame(AVCodecCon
      } else {
          frame->pict_type = AV_PICTURE_TYPE_P;
      }
+ 
+     /* Palette handling */
      if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
 +        int size;
-         const uint8_t *pal = av_packet_get_side_data(avpkt,
-                                                      AV_PKT_DATA_PALETTE,
-                                                      &size);
-         if (pal && size == AVPALETTE_SIZE) {
+         const uint8_t *palette = av_packet_get_side_data(avpkt,
+                                                          AV_PKT_DATA_PALETTE,
 -                                                         NULL);
 -        if (palette) {
++                                                         &size);
++        if (palette && size == AVPALETTE_SIZE) {
              frame->palette_has_changed = 1;
-             memcpy(ctx->pal, pal, AVPALETTE_SIZE);
-         } else if (pal) {
+             memcpy(ctx->palette, palette, AVPALETTE_SIZE);
++        } else if (palette) {
 +            av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
          }
-         memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
 -        memcpy(frame->data[1], ctx->palette, AVPALETTE_SIZE);
++        memcpy (frame->data[1], ctx->palette, AVPALETTE_SIZE);
      }
+ 
      *got_frame = 1;
  
 +    ret = avpkt->size;
  end:
      av_free(inflated_tiles);
      return ret;



More information about the ffmpeg-cvslog mailing list