| @@ -231,7 +231,6 @@ struct stack_node { · 230 unmodified lines |
| 231 | */ | 231 | */ |
| 232 | static av_always_inline int color_get(PaletteUseContext *s, uint32_t color) | 232 | static av_always_inline int color_get(PaletteUseContext *s, uint32_t color) |
| 233 | { | 233 | { |
| 234 | int i; | | |
| 235 | struct color_info clrinfo; | 234 | struct color_info clrinfo; |
| 236 | const uint32_t hash = ff_lowbias32(color) & (CACHE_SIZE - 1); | 235 | const uint32_t hash = ff_lowbias32(color) & (CACHE_SIZE - 1); |
| 237 | struct cache_node *node = &s->cache[hash]; | 236 | struct cache_node *node = &s->cache[hash]; |
| @@ -242,7 +241,7 @@ static av_always_inline int color_get(PaletteUseContext *s, uint32_t color) · 4 unmodified lines |
| 242 | return s->transparency_index; | 241 | return s->transparency_index; |
| 243 | } | 242 | } |
| 244 | | 243 | |
| 245 | for (i = 0; i < node->nb_entries; i++) { | 244 | for (int i = 0; i < node->nb_entries; i++) { |
| 246 | e = &node->entries[i]; | 245 | e = &node->entries[i]; |
| 247 | if (e->color == color) | 246 | if (e->color == color) |
| 248 | return e->pal_entry; | 247 | return e->pal_entry; |
| @@ -284,7 +283,6 @@ static av_always_inline int set_frame(PaletteUseContext *s, AVFrame *out, AVFram · 35 unmodified lines |
| 284 | int x_start, int y_start, int w, int h, | 283 | int x_start, int y_start, int w, int h, |
| 285 | enum dithering_mode dither) | 284 | enum dithering_mode dither) |
| 286 | { | 285 | { |
| 287 | int x, y; | | |
| 288 | const int src_linesize = in ->linesize[0] >> 2; | 286 | const int src_linesize = in ->linesize[0] >> 2; |
| 289 | const int dst_linesize = out->linesize[0]; | 287 | const int dst_linesize = out->linesize[0]; |
| 290 | uint32_t *src = ((uint32_t *)in ->data[0]) + y_start*src_linesize; | 288 | uint32_t *src = ((uint32_t *)in ->data[0]) + y_start*src_linesize; |
| @@ -293,8 +291,8 @@ static av_always_inline int set_frame(PaletteUseContext *s, AVFrame *out, AVFram · 2 unmodified lines |
| 293 | w += x_start; | 291 | w += x_start; |
| 294 | h += y_start; | 292 | h += y_start; |
| 295 | | 293 | |
| 296 | for (y = y_start; y < h; y++) { | 294 | for (int y = y_start; y < h; y++) { |
| 297 | for (x = x_start; x < w; x++) { | 295 | for (int x = x_start; x < w; x++) { |
| 298 | int er, eg, eb; | 296 | int er, eg, eb; |
| 299 | | 297 | |
| 300 | if (dither == DITHERING_BAYER) { | 298 | if (dither == DITHERING_BAYER) { |
| @@ -467,7 +465,7 @@ static int get_next_color(const uint8_t *color_used, const uint32_t *palette, · 166 unmodified lines |
| 467 | int *component, const struct color_rect *box) | 465 | int *component, const struct color_rect *box) |
| 468 | { | 466 | { |
| 469 | int wL, wa, wb; | 467 | int wL, wa, wb; |
| 470 | int i, longest = 0; | 468 | int longest = 0; |
| 471 | unsigned nb_color = 0; | 469 | unsigned nb_color = 0; |
| 472 | struct color_rect ranges; | 470 | struct color_rect ranges; |
| 473 | struct color tmp_pal[256]; | 471 | struct color tmp_pal[256]; |
| @@ -476,7 +474,7 @@ static int get_next_color(const uint8_t *color_used, const uint32_t *palette, · 2 unmodified lines |
| 476 | ranges.min[0] = ranges.min[1] = ranges.min[2] = 0xffff; | 474 | ranges.min[0] = ranges.min[1] = ranges.min[2] = 0xffff; |
| 477 | ranges.max[0] = ranges.max[1] = ranges.max[2] = -0xffff; | 475 | ranges.max[0] = ranges.max[1] = ranges.max[2] = -0xffff; |
| 478 | | 476 | |
| 479 | for (i = 0; i < AVPALETTE_COUNT; i++) { | 477 | for (int i = 0; i < AVPALETTE_COUNT; i++) { |
| 480 | const uint32_t c = palette[i]; | 478 | const uint32_t c = palette[i]; |
| 481 | const uint8_t a = c >> 24; | 479 | const uint8_t a = c >> 24; |
| 482 | const struct Lab lab = ff_srgb_u8_to_oklab_int(c); | 480 | const struct Lab lab = ff_srgb_u8_to_oklab_int(c); |
| @@ -571,7 +569,7 @@ static int cmp_pal_entry(const void *a, const void *b) · 88 unmodified lines |
| 571 | | 569 | |
| 572 | static void load_colormap(PaletteUseContext *s) | 570 | static void load_colormap(PaletteUseContext *s) |
| 573 | { | 571 | { |
| 574 | int i, nb_used = 0; | 572 | int nb_used = 0; |
| 575 | uint8_t color_used[AVPALETTE_COUNT] = {0}; | 573 | uint8_t color_used[AVPALETTE_COUNT] = {0}; |
| 576 | uint32_t last_color = 0; | 574 | uint32_t last_color = 0; |
| 577 | struct color_rect box; | 575 | struct color_rect box; |
| @@ -583,7 +581,7 @@ static void load_colormap(PaletteUseContext *s) · 5 unmodified lines |
| 583 | /* disable transparent colors and dups */ | 581 | /* disable transparent colors and dups */ |
| 584 | qsort(s->palette, AVPALETTE_COUNT-(s->transparency_index >= 0), sizeof(*s->palette), cmp_pal_entry); | 582 | qsort(s->palette, AVPALETTE_COUNT-(s->transparency_index >= 0), sizeof(*s->palette), cmp_pal_entry); |
| 585 | | 583 | |
| 586 | for (i = 0; i < AVPALETTE_COUNT; i++) { | 584 | for (int i = 0; i < AVPALETTE_COUNT; i++) { |
| 587 | const uint32_t c = s->palette[i]; | 585 | const uint32_t c = s->palette[i]; |
| 588 | if (i != 0 && c == last_color) { | 586 | if (i != 0 && c == last_color) { |
| 589 | color_used[i] = 1; | 587 | color_used[i] = 1; |
| @@ -874,10 +872,9 @@ static av_cold int init(AVFilterContext *ctx) · 284 unmodified lines |
| 874 | s->set_frame = set_frame_lut[s->dither]; | 872 | s->set_frame = set_frame_lut[s->dither]; |
| 875 | | 873 | |
| 876 | if (s->dither == DITHERING_BAYER) { | 874 | if (s->dither == DITHERING_BAYER) { |
| 877 | int i; | | |
| 878 | const int delta = 1 << (5 - s->bayer_scale); // to avoid too much luma | 875 | const int delta = 1 << (5 - s->bayer_scale); // to avoid too much luma |
| 879 | | 876 | |
| 880 | for (i = 0; i < FF_ARRAY_ELEMS(s->ordered_dither); i++) | 877 | for (int i = 0; i < FF_ARRAY_ELEMS(s->ordered_dither); i++) |
| 881 | s->ordered_dither[i] = (dither_value(i) >> s->bayer_scale) - delta; | 878 | s->ordered_dither[i] = (dither_value(i) >> s->bayer_scale) - delta; |
| 882 | } | 879 | } |
| 883 | | 880 | |
| @@ -892,11 +889,10 @@ static int activate(AVFilterContext *ctx) · 8 unmodified lines |
| 892 | | 889 | |
| 893 | static av_cold void uninit(AVFilterContext *ctx) | 890 | static av_cold void uninit(AVFilterContext *ctx) |
| 894 | { | 891 | { |
| 895 | int i; | | |
| 896 | PaletteUseContext *s = ctx->priv; | 892 | PaletteUseContext *s = ctx->priv; |
| 897 | | 893 | |
| 898 | ff_framesync_uninit(&s->fs); | 894 | ff_framesync_uninit(&s->fs); |
| 899 | for (i = 0; i < CACHE_SIZE; i++) | 895 | for (int i = 0; i < CACHE_SIZE; i++) |
| 900 | av_freep(&s->cache[i].entries); | 896 | av_freep(&s->cache[i].entries); |
| 901 | av_frame_free(&s->last_in); | 897 | av_frame_free(&s->last_in); |
| 902 | av_frame_free(&s->last_out); | 898 | av_frame_free(&s->last_out); |