[FFmpeg-cvslog] avcodec/escape124: Simplify unpack_codebook()
Michael Niedermayer
git at videolan.org
Mon Mar 13 00:03:39 EET 2023
ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sun Mar 5 22:43:56 2023 +0100| [f669dd4dff83024ac80d79a4a5d7089902236a00] | committer: Michael Niedermayer
avcodec/escape124: Simplify unpack_codebook()
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f669dd4dff83024ac80d79a4a5d7089902236a00
---
libavcodec/escape124.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c
index 064a4e6bf5..e8a8395f4b 100644
--- a/libavcodec/escape124.c
+++ b/libavcodec/escape124.c
@@ -97,15 +97,12 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth,
cb.size = size;
for (i = 0; i < size; i++) {
unsigned mask_bits = get_bits(gb, 4);
- unsigned color0 = get_bits(gb, 15);
- unsigned color1 = get_bits(gb, 15);
-
- for (j = 0; j < 4; j++) {
- if (mask_bits & (1 << j))
- cb.blocks[i].pixels[j] = color1;
- else
- cb.blocks[i].pixels[j] = color0;
- }
+ unsigned color[2];
+ color[0] = get_bits(gb, 15);
+ color[1] = get_bits(gb, 15);
+
+ for (j = 0; j < 4; j++)
+ cb.blocks[i].pixels[j] = color[(mask_bits>>j) & 1];
}
return cb;
}
More information about the ffmpeg-cvslog
mailing list