[FFmpeg-cvslog] avcodec/magicyuv: Simplify check for RGB

Andreas Rheinhardt git at videolan.org
Sat Apr 26 01:15:19 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Mon Apr 21 12:35:42 2025 +0200| [122f86d8598715d47231de25385ae266504741f2] | committer: Andreas Rheinhardt

avcodec/magicyuv: Simplify check for RGB

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

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

 libavcodec/magicyuv.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/libavcodec/magicyuv.c b/libavcodec/magicyuv.c
index 4a5c0be9e0..e106228757 100644
--- a/libavcodec/magicyuv.c
+++ b/libavcodec/magicyuv.c
@@ -521,7 +521,7 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
     }
     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
     av_assert1(desc);
-    s->decorrelate = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
+    int is_rgb = s->decorrelate = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
     s->hshift[1] = s->hshift[2] = desc->log2_chroma_w;
     s->vshift[1] = s->vshift[2] = desc->log2_chroma_h;
     s->bps = desc->comp[0].depth;
@@ -628,14 +628,7 @@ static int magy_decode_frame(AVCodecContext *avctx, AVFrame *p,
     s->p = p;
     avctx->execute2(avctx, s->magy_decode_slice, NULL, NULL, s->nb_slices);
 
-    if (avctx->pix_fmt == AV_PIX_FMT_GBRP   ||
-        avctx->pix_fmt == AV_PIX_FMT_GBRAP  ||
-        avctx->pix_fmt == AV_PIX_FMT_GBRP10 ||
-        avctx->pix_fmt == AV_PIX_FMT_GBRAP10||
-        avctx->pix_fmt == AV_PIX_FMT_GBRAP12||
-        avctx->pix_fmt == AV_PIX_FMT_GBRAP14||
-        avctx->pix_fmt == AV_PIX_FMT_GBRP12||
-        avctx->pix_fmt == AV_PIX_FMT_GBRP14) {
+    if (is_rgb) {
         FFSWAP(uint8_t*, p->data[0], p->data[1]);
         FFSWAP(int, p->linesize[0], p->linesize[1]);
     } else {



More information about the ffmpeg-cvslog mailing list