1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

avfilter/paletteuse: move r,g,b computation in a more local scope

This commit is contained in:
Clément Bœsch
2022-12-27 18:08:21 +01:00
parent 1ae1b707e2
commit 1340fe7caf

View File

@@ -262,9 +262,6 @@ static av_always_inline int color_get(PaletteUseContext *s, uint32_t color)
static av_always_inline int get_dst_color_err(PaletteUseContext *s, static av_always_inline int get_dst_color_err(PaletteUseContext *s,
uint32_t c, int *er, int *eg, int *eb) uint32_t c, int *er, int *eg, int *eb)
{ {
const uint8_t r = c >> 16 & 0xff;
const uint8_t g = c >> 8 & 0xff;
const uint8_t b = c & 0xff;
uint32_t dstc; uint32_t dstc;
const int dstx = color_get(s, c); const int dstx = color_get(s, c);
if (dstx < 0) if (dstx < 0)
@@ -273,6 +270,9 @@ static av_always_inline int get_dst_color_err(PaletteUseContext *s,
if (dstx == s->transparency_index) { if (dstx == s->transparency_index) {
*er = *eg = *eb = 0; *er = *eg = *eb = 0;
} else { } else {
const uint8_t r = c >> 16 & 0xff;
const uint8_t g = c >> 8 & 0xff;
const uint8_t b = c & 0xff;
*er = (int)r - (int)(dstc >> 16 & 0xff); *er = (int)r - (int)(dstc >> 16 & 0xff);
*eg = (int)g - (int)(dstc >> 8 & 0xff); *eg = (int)g - (int)(dstc >> 8 & 0xff);
*eb = (int)b - (int)(dstc & 0xff); *eb = (int)b - (int)(dstc & 0xff);