diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index a657b1d3d0..b59e836657 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -127,6 +127,7 @@ typedef struct DVBSubContext { int compute_edt; /**< if 1 end display time calculated using pts if 0 (Default) calculated using time out */ int compute_clut; + int clut_count2[257][256]; int substream; int64_t prev_start; DVBSubRegion *region_list; @@ -650,13 +651,17 @@ static int dvbsub_read_8bit_string(AVCodecContext *avctx, return pixels_read; } -static void compute_default_clut(uint8_t *clut, AVSubtitleRect *rect, int w, int h) +static void compute_default_clut(DVBSubContext *ctx, uint8_t *clut, AVSubtitleRect *rect, int w, int h) { uint8_t list[256] = {0}; uint8_t list_inv[256]; int counttab[256] = {0}; + int (*counttab2)[256] = ctx->clut_count2; int count, i, x, y; ptrdiff_t stride = rect->linesize[0]; + + memset(ctx->clut_count2, 0 , sizeof(ctx->clut_count2)); + #define V(x,y) rect->data[0][(x) + (y)*stride] for (y = 0; ydata[0][x + y*stride]; - int v = *d; - int l_m = list[v]; - int l_l = x ? L(-1, 0) : 1; - int l_r = x+1 bestscore) { bestscore = score; bestv = x; @@ -819,7 +825,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou if ((clut == &default_clut && ctx->compute_clut == -1) || ctx->compute_clut == 1) { if (!region->has_computed_clut) { - compute_default_clut(region->computed_clut, rect, rect->w, rect->h); + compute_default_clut(ctx, region->computed_clut, rect, rect->w, rect->h); region->has_computed_clut = 1; }