[FFmpeg-cvslog] avcodec/ffv1enc: Fix RCT with RGB64
Michael Niedermayer
git at videolan.org
Fri Jan 3 20:02:46 EET 2025
ffmpeg | branch: release/7.1 | Michael Niedermayer <michael at niedermayer.cc> | Thu Oct 10 22:14:41 2024 +0200| [4ca3f5102f5d99b1d52b909b3d5d9b2d33c84d6b] | committer: Michael Niedermayer
avcodec/ffv1enc: Fix RCT with RGB64
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c1edec3a24306f8fa31bebe67644183741cbf0e0)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ca3f5102f5d99b1d52b909b3d5d9b2d33c84d6b
---
libavcodec/ffv1enc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index 96beb86cfa..3e8f6ee445 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -980,6 +980,9 @@ static void choose_rct_params(const FFV1Context *f, FFV1SliceContext *sc,
int x, y, i, p, best;
int16_t *sample[3];
int lbd = f->bits_per_raw_sample <= 8;
+ int packed = !src[1];
+ int transparency = f->transparency;
+ int packed_size = (3 + transparency)*2;
for (y = 0; y < h; y++) {
int lastr=0, lastg=0, lastb=0;
@@ -994,6 +997,11 @@ static void choose_rct_params(const FFV1Context *f, FFV1SliceContext *sc,
b = v & 0xFF;
g = (v >> 8) & 0xFF;
r = (v >> 16) & 0xFF;
+ } else if (packed) {
+ const uint16_t *p = ((const uint16_t*)(src[0] + x*packed_size + stride[0]*y));
+ r = p[0];
+ g = p[1];
+ b = p[2];
} else {
b = *((const uint16_t*)(src[0] + x*2 + stride[0]*y));
g = *((const uint16_t*)(src[1] + x*2 + stride[1]*y));
More information about the ffmpeg-cvslog
mailing list