[FFmpeg-devel,1/2] libavcodec/zmbv: change 24-bit decoder channel order, from RGB24 to BGR24

Submitted by matthew.w.fearnley@gmail.com on March 26, 2019, 10:13 p.m.

Details

Message ID 20190326221306.1004-1-matthew.w.fearnley@gmail.com
State New
Headers show

Commit Message

matthew.w.fearnley@gmail.com March 26, 2019, 10:13 p.m.
This brings the channel order in line with that used in 32-bit mode (BGR0).

24-bit decoding is disabled by default (#ifdef ZMBV_ENABLE_24BPP), and no
prior encoders or sample videos are known to exist for this bit depth, so
I consider this change in implementation is unlikely to affect anyone.

The decision has been made in agreement with the DOSBox Development Team
(dosbox.crew@gmail.com), specifically with harekiet, who wrote the original
codec.

Additional minor fix: use PTRDIFF_SPECIFIER for `src - c->decomp_buf`.
Other bit depths saw this change in ced0d6c14d, but this instance was
missed, presumably because of the #ifdef block.
---
 libavcodec/zmbv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Tomas Härdin March 27, 2019, 9:42 a.m.
tis 2019-03-26 klockan 22:13 +0000 skrev Matthew Fearnley:
> This brings the channel order in line with that used in 32-bit mode (BGR0).
> 
> 24-bit decoding is disabled by default (#ifdef ZMBV_ENABLE_24BPP), and no
> prior encoders or sample videos are known to exist for this bit depth, so
> I consider this change in implementation is unlikely to affect anyone.
> 
> The decision has been made in agreement with the DOSBox Development Team
> > (dosbox.crew@gmail.com), specifically with harekiet, who wrote the original
> codec.

I can confirm this

> Additional minor fix: use PTRDIFF_SPECIFIER for `src - c->decomp_buf`.
> Other bit depths saw this change in ced0d6c14d, but this instance was
> missed, presumably because of the #ifdef block.

I think it'd be best to split this off into its own patch, even if it's
trivial

/Tomas

Patch hide | download patch | download mbox

diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index e07009d0fb..898b62d065 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -303,7 +303,7 @@  static int zmbv_decode_xor_24(ZmbvContext *c)
         prev += stride * c->bh;
     }
     if (src - c->decomp_buf != c->decomp_len)
-        av_log(c->avctx, AV_LOG_ERROR, "Used %i of %i bytes\n",
+        av_log(c->avctx, AV_LOG_ERROR, "Used %"PTRDIFF_SPECIFIER" of %i bytes\n",
                src-c->decomp_buf, c->decomp_len);
     return 0;
 }
@@ -473,7 +473,7 @@  static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
             c->bpp = 24;
             decode_intra = zmbv_decode_intra;
             c->decode_xor = zmbv_decode_xor_24;
-            avctx->pix_fmt = AV_PIX_FMT_RGB24;
+            avctx->pix_fmt = AV_PIX_FMT_BGR24;
             c->stride = c->width * 3;
             break;
 #endif //ZMBV_ENABLE_24BPP