diff mbox series

[FFmpeg-devel] avcodec/8bps: switch to planar RGB formats

Message ID CAPYw7P41mHRcm5OdTg3_JrtCoYJbTAqXb2D_YaQGvvqqiz05zQ@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/8bps: switch to planar RGB formats | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Paul B Mahol Sept. 10, 2023, 8:48 p.m. UTC
Attached.

Comments

Paul B Mahol Sept. 11, 2023, 2:01 p.m. UTC | #1
Gonna apply soon.
diff mbox series

Patch

From 3b7f86ff244692b77d5f9f6e48f70138b0405181 Mon Sep 17 00:00:00 2001
From: Paul B Mahol <onemda@gmail.com>
Date: Sun, 10 Sep 2023 22:19:19 +0200
Subject: [PATCH 1/2] avcodec/8bps: use uint8/uint16 where possible

Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavcodec/8bps.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c
index af98f62fad..15c236f114 100644
--- a/libavcodec/8bps.c
+++ b/libavcodec/8bps.c
@@ -45,8 +45,8 @@  static const enum AVPixelFormat pixfmt_rgb24[] = {
 typedef struct EightBpsContext {
     AVCodecContext *avctx;
 
-    unsigned char planes;
-    unsigned char planemap[4];
+    uint8_t planes;
+    uint8_t planemap[4];
 } EightBpsContext;
 
 static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
@@ -55,15 +55,15 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
     EightBpsContext * const c = avctx->priv_data;
-    const unsigned char *encoded = buf;
-    unsigned char *pixptr, *pixptr_end;
+    const uint8_t *encoded = buf;
+    uint8_t *pixptr, *pixptr_end;
     unsigned int height = avctx->height; // Real image height
     unsigned int dlen, p, row;
-    const unsigned char *lp, *dp, *ep;
-    unsigned char count;
+    const uint8_t *lp, *dp, *ep;
+    uint8_t count;
     unsigned int px_inc;
     unsigned int planes     = c->planes;
-    unsigned char *planemap = c->planemap;
+    uint8_t *planemap = c->planemap;
     int ret;
 
     if (buf_size < planes * height * 2)
@@ -89,7 +89,7 @@  static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
             pixptr_end = pixptr + frame->linesize[0];
             if (ep - lp < row * 2 + 2)
                 return AVERROR_INVALIDDATA;
-            dlen = av_be2ne16(*(const unsigned short *)(lp + row * 2));
+            dlen = av_be2ne16(*(const uint16_t *)(lp + row * 2));
             /* Decode a row of this plane */
             while (dlen > 0) {
                 if (ep - dp <= 1)
-- 
2.39.1