Mercurial > libavcodec.hg
comparison dvdsubdec.c @ 10069:8ac9bc10b485 libavcodec
Always allocate a buffer of AVPALETTE_SIZE for palette in the subtitle
decoders instead of as small as possible.
This avoids completely unnecessary issues with e.g. libswscale.
author | reimar |
---|---|
date | Thu, 20 Aug 2009 18:54:50 +0000 |
parents | e73c688ca84c |
children | 8a4984c5cacc |
comparison
equal
deleted
inserted
replaced
10068:770294452eaf | 10069:8ac9bc10b485 |
---|---|
316 sub_header->rects[0]->pict.data[0] = bitmap; | 316 sub_header->rects[0]->pict.data[0] = bitmap; |
317 decode_rle(bitmap, w * 2, w, (h + 1) / 2, | 317 decode_rle(bitmap, w * 2, w, (h + 1) / 2, |
318 buf, offset1, buf_size, is_8bit); | 318 buf, offset1, buf_size, is_8bit); |
319 decode_rle(bitmap + w, w * 2, w, h / 2, | 319 decode_rle(bitmap + w, w * 2, w, h / 2, |
320 buf, offset2, buf_size, is_8bit); | 320 buf, offset2, buf_size, is_8bit); |
321 sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE); | |
321 if (is_8bit) { | 322 if (is_8bit) { |
322 if (yuv_palette == 0) | 323 if (yuv_palette == 0) |
323 goto fail; | 324 goto fail; |
324 sub_header->rects[0]->pict.data[1] = av_malloc(256 * 4); | |
325 sub_header->rects[0]->nb_colors = 256; | 325 sub_header->rects[0]->nb_colors = 256; |
326 yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256); | 326 yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256); |
327 } else { | 327 } else { |
328 sub_header->rects[0]->pict.data[1] = av_malloc(4 * 4); | |
329 sub_header->rects[0]->nb_colors = 4; | 328 sub_header->rects[0]->nb_colors = 4; |
330 guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1], | 329 guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1], |
331 colormap, alpha, 0xffff00); | 330 colormap, alpha, 0xffff00); |
332 } | 331 } |
333 sub_header->rects[0]->x = x1; | 332 sub_header->rects[0]->x = x1; |