diff mbox series

[FFmpeg-devel,v2,31/32] avfilter/paletteuse: move r, g, b computation in a more local scope

Message ID 20221227231814.2520181-32-u@pkh.me
State Accepted
Commit 1340fe7caf6e3396ba412b0883859135d2602151
Headers show
Series [FFmpeg-devel,v2,01/32] avfilter/palettegen: allow a minimum of 2 colors | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Clément Bœsch Dec. 27, 2022, 11:18 p.m. UTC
---
 libavfilter/vf_paletteuse.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_paletteuse.c b/libavfilter/vf_paletteuse.c
index 33b8e70293..e3462b4abb 100644
--- a/libavfilter/vf_paletteuse.c
+++ b/libavfilter/vf_paletteuse.c
@@ -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,
                                               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;
     const int dstx = color_get(s, c);
     if (dstx < 0)
@@ -273,6 +270,9 @@  static av_always_inline int get_dst_color_err(PaletteUseContext *s,
     if (dstx == s->transparency_index) {
         *er = *eg = *eb = 0;
     } 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);
         *eg = (int)g - (int)(dstc >>  8 & 0xff);
         *eb = (int)b - (int)(dstc       & 0xff);