You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavc/libzvbi-teletextdec: remove cmax variable
Use VBI_NB_COLORS instead. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@@ -229,18 +229,16 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa
|
|||||||
{
|
{
|
||||||
int resx = page->columns * BITMAP_CHAR_WIDTH;
|
int resx = page->columns * BITMAP_CHAR_WIDTH;
|
||||||
int resy = (page->rows - chop_top) * BITMAP_CHAR_HEIGHT;
|
int resy = (page->rows - chop_top) * BITMAP_CHAR_HEIGHT;
|
||||||
uint8_t ci, cmax = 0;
|
uint8_t ci;
|
||||||
vbi_char *vc = page->text + (chop_top * page->columns);
|
vbi_char *vc = page->text + (chop_top * page->columns);
|
||||||
vbi_char *vcend = page->text + (page->rows * page->columns);
|
vbi_char *vcend = page->text + (page->rows * page->columns);
|
||||||
|
|
||||||
for (; vc < vcend; vc++) {
|
for (; vc < vcend; vc++) {
|
||||||
if (vc->opacity != VBI_TRANSPARENT_SPACE) {
|
if (vc->opacity != VBI_TRANSPARENT_SPACE)
|
||||||
cmax = VBI_NB_COLORS;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (cmax == 0) {
|
if (vc >= vcend) {
|
||||||
av_log(ctx, AV_LOG_DEBUG, "dropping empty page %3x\n", page->pgno);
|
av_log(ctx, AV_LOG_DEBUG, "dropping empty page %3x\n", page->pgno);
|
||||||
sub_rect->type = SUBTITLE_NONE;
|
sub_rect->type = SUBTITLE_NONE;
|
||||||
return 0;
|
return 0;
|
||||||
@@ -261,13 +259,13 @@ static int gen_sub_bitmap(TeletextContext *ctx, AVSubtitleRect *sub_rect, vbi_pa
|
|||||||
sub_rect->y = ctx->y_offset + chop_top * BITMAP_CHAR_HEIGHT;
|
sub_rect->y = ctx->y_offset + chop_top * BITMAP_CHAR_HEIGHT;
|
||||||
sub_rect->w = resx;
|
sub_rect->w = resx;
|
||||||
sub_rect->h = resy;
|
sub_rect->h = resy;
|
||||||
sub_rect->nb_colors = cmax;
|
sub_rect->nb_colors = VBI_NB_COLORS;
|
||||||
sub_rect->data[1] = av_mallocz(AVPALETTE_SIZE);
|
sub_rect->data[1] = av_mallocz(AVPALETTE_SIZE);
|
||||||
if (!sub_rect->data[1]) {
|
if (!sub_rect->data[1]) {
|
||||||
av_freep(&sub_rect->data[0]);
|
av_freep(&sub_rect->data[0]);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
for (ci = 0; ci < cmax; ci++) {
|
for (ci = 0; ci < VBI_NB_COLORS; ci++) {
|
||||||
int r, g, b, a;
|
int r, g, b, a;
|
||||||
|
|
||||||
r = VBI_R(page->color_map[ci]);
|
r = VBI_R(page->color_map[ci]);
|
||||||
|
Reference in New Issue
Block a user