[FFmpeg-cvslog] dvdsubdec: Move colormap and alpha to context
Joakim Plate
git at videolan.org
Tue Sep 13 00:27:48 CEST 2011
ffmpeg | branch: master | Joakim Plate <elupus at ecce.se> | Mon Sep 12 21:11:15 2011 +0200| [32c0c562e7f2102f4123334ef388224cdd072d3b] | committer: Joakim Plate
dvdsubdec: Move colormap and alpha to context
This makes it rememember old values should the stream not
contain new values for these for each subtitle.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32c0c562e7f2102f4123334ef388224cdd072d3b
---
libavcodec/dvdsubdec.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c
index 27e2f3d..9eb5665 100644
--- a/libavcodec/dvdsubdec.c
+++ b/libavcodec/dvdsubdec.c
@@ -29,6 +29,8 @@ typedef struct DVDSubContext
{
uint32_t palette[16];
int has_palette;
+ uint8_t colormap[4];
+ uint8_t alpha[256];
} DVDSubContext;
static void yuv_a_to_rgba(const uint8_t *ycbcr, const uint8_t *alpha, uint32_t *rgba, int num_values)
@@ -123,8 +125,6 @@ static int decode_rle(uint8_t *bitmap, int linesize, int w, int h,
static void guess_palette(uint32_t *rgba_palette,
DVDSubContext* ctx,
- uint8_t *colormap,
- uint8_t *alpha,
uint32_t subtitle_color)
{
static const uint8_t level_map[4][4] = {
@@ -137,6 +137,7 @@ static void guess_palette(uint32_t *rgba_palette,
};
uint8_t color_used[16];
int nb_opaque_colors, i, level, j, r, g, b;
+ uint8_t *colormap = ctx->colormap, *alpha = ctx->alpha;
if(ctx->has_palette) {
for(i = 0; i < 4; i++)
@@ -188,7 +189,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos;
int big_offsets, offset_size, is_8bit = 0;
const uint8_t *yuv_palette = 0;
- uint8_t colormap[4], alpha[256];
+ uint8_t *colormap = ctx->colormap, *alpha = ctx->alpha;
int date;
int i;
int is_menu = 0;
@@ -348,7 +349,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
} else {
sub_header->rects[0]->nb_colors = 4;
guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1], ctx,
- colormap, alpha, 0xffff00);
+ 0xffff00);
}
sub_header->rects[0]->x = x1;
sub_header->rects[0]->y = y1;
More information about the ffmpeg-cvslog
mailing list