X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fa64multienc.c;h=9dc859b271b84e20b8c1034801a4e6e01e12af3d;hb=f4df5039a791a56de85c64e6b9e4448a221b5c40;hp=91aac0933f14e1e2c9504737bd66c6e56d5ac07c;hpb=ef71ef5f30ddf1cd61e46628a04608892caf76d2;p=ffmpeg diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c index 91aac0933f1..9dc859b271b 100644 --- a/libavcodec/a64multienc.c +++ b/libavcodec/a64multienc.c @@ -60,11 +60,11 @@ typedef struct A64Context { } A64Context; /* gray gradient */ -static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; +static const uint8_t mc_colors[5]={0x0,0xb,0xc,0xf,0x1}; /* other possible gradients - to be tested */ -//static const int mc_colors[5]={0x0,0x8,0xa,0xf,0x7}; -//static const int mc_colors[5]={0x0,0x9,0x8,0xa,0x3}; +//static const uint8_t mc_colors[5]={0x0,0x8,0xa,0xf,0x7}; +//static const uint8_t mc_colors[5]={0x0,0x9,0x8,0xa,0x3}; static void to_meta_with_crop(AVCodecContext *avctx, const AVFrame *p, int *dest) @@ -107,13 +107,16 @@ static void render_charset(AVCodecContext *avctx, uint8_t *charset, uint8_t pix; int lowdiff, highdiff; int *best_cb = c->mc_best_cb; - static uint8_t index1[256]; - static uint8_t index2[256]; - static uint8_t dither[256]; + uint8_t index1[256]; + uint8_t index2[256]; + uint8_t dither[256]; int i; int distance; - /* generate lookup-tables for dither and index before looping */ + /* Generate lookup-tables for dither and index before looping. + * This code relies on c->mc_luma_vals[c->mc_pal_size - 1] being + * the maximum of all the mc_luma_vals values and on the minimum + * being zero; this ensures that dither is properly initialized. */ i = 0; for (a=0; a < 256; a++) { if(i < c->mc_pal_size -1 && a == c->mc_luma_vals[i + 1]) { @@ -396,7 +399,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, } #if CONFIG_A64MULTI_ENCODER -AVCodec ff_a64multi_encoder = { +const AVCodec ff_a64multi_encoder = { .name = "a64multi", .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"), .type = AVMEDIA_TYPE_VIDEO, @@ -407,10 +410,11 @@ AVCodec ff_a64multi_encoder = { .close = a64multi_close_encoder, .pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}, .capabilities = AV_CODEC_CAP_DELAY, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_A64MULTI5_ENCODER -AVCodec ff_a64multi5_encoder = { +const AVCodec ff_a64multi5_encoder = { .name = "a64multi5", .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"), .type = AVMEDIA_TYPE_VIDEO, @@ -421,5 +425,6 @@ AVCodec ff_a64multi5_encoder = { .close = a64multi_close_encoder, .pix_fmts = (const enum AVPixelFormat[]) {AV_PIX_FMT_GRAY8, AV_PIX_FMT_NONE}, .capabilities = AV_CODEC_CAP_DELAY, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE, }; #endif