On Sun, Jun 19, 2016 at 9:33 AM, Luca Barbato <lu_z...@gentoo.org> wrote:
> On 19/06/16 00:23, Vittorio Giovara wrote:
>> From: Paul B Mahol <one...@gmail.com>
>>
>> Signed-off-by: Paul B Mahol <one...@gmail.com>
>> Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com>
>> ---
>>  Changelog               |   1 +
>>  configure               |   1 +
>>  doc/general.texi        |   1 +
>>  libavcodec/Makefile     |   1 +
>>  libavcodec/allcodecs.c  |   1 +
>>  libavcodec/avcodec.h    |   1 +
>>  libavcodec/codec_desc.c |   7 +
>>  libavcodec/magicyuv.c   | 484 
>> ++++++++++++++++++++++++++++++++++++++++++++++++
>>  libavformat/isom.c      |   8 +
>>  libavformat/riff.c      |   1 +
>>  10 files changed, 506 insertions(+)
>>  create mode 100644 libavcodec/magicyuv.c
>>
>
> Possibly OK.

i was thinking of adding

diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index accd128..310ead4 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -22,6 +22,8 @@
 #include <stdlib.h>
 #include <string.h>

+#include "../libavutil/pixdesc.h"
+
 #include "avcodec.h"
 #include "bytestream.h"
 #include "get_bits.h"
@@ -269,26 +271,21 @@ static int magy_decode_frame(AVCodecContext
*avctx, void *data,
     case 0x65:
         avctx->pix_fmt = AV_PIX_FMT_GBRP;
         s->decorrelate = 1;
-        s->planes = 3;
         break;
     case 0x66:
         avctx->pix_fmt = AV_PIX_FMT_GBRAP;
         s->decorrelate = 1;
-        s->planes = 4;
         break;
     case 0x67:
         avctx->pix_fmt = AV_PIX_FMT_YUV444P;
-        s->planes = 3;
         break;
     case 0x68:
         avctx->pix_fmt = AV_PIX_FMT_YUV422P;
-        s->planes = 3;
         s->hshift[1] =
         s->hshift[2] = 1;
         break;
     case 0x69:
         avctx->pix_fmt = AV_PIX_FMT_YUV420P;
-        s->planes = 3;
         s->hshift[1] =
         s->vshift[1] =
         s->hshift[2] =
@@ -296,16 +293,15 @@ static int magy_decode_frame(AVCodecContext
*avctx, void *data,
         break;
     case 0x6a:
         avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
-        s->planes = 4;
         break;
     case 0x6b:
         avctx->pix_fmt = AV_PIX_FMT_GRAY8;
-        s->planes = 1;
         break;
     default:
         avpriv_request_sample(avctx, "Format 0x%X", format);
         return AVERROR_PATCHWELCOME;
     }
+    s->planes = av_pix_fmt_count_planes(avctx->pix_fmt);

     bytestream2_skip(&gbyte, 2);
     s->interlaced = !!(bytestream2_get_byte(&gbyte) & 2);


is it still ok?
-- 
Vittorio
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to