av_fast_malloc(&object->rle, &object->rle_buffer_size, rle_bitmap_len);
- if (!object->rle)
+ if (!object->rle) {
+ object->rle_data_len = 0;
+ object->rle_remaining_len = 0;
return AVERROR(ENOMEM);
+ }
memcpy(object->rle, buf, buf_size);
object->rle_data_len = buf_size;
cb = bytestream_get_byte(&buf);
alpha = bytestream_get_byte(&buf);
- YUV_TO_RGB1(cb, cr);
- YUV_TO_RGB2(r, g, b, y);
+ /* Default to BT.709 colorspace. In case of <= 576 height use BT.601 */
+ if (avctx->height <= 0 || avctx->height > 576) {
+ YUV_TO_RGB1_CCIR_BT709(cb, cr);
+ } else {
+ YUV_TO_RGB1_CCIR(cb, cr);
+ }
+
+ YUV_TO_RGB2_CCIR(r, g, b, y);
ff_dlog(avctx, "Color %d := (%d,%d,%d,%d)\n", color_id, r, g, b, alpha);
}
for (i = 0; i < ctx->presentation.object_count; i++) {
PGSSubObject *object;
- AVSubtitleRect *rect;
- int j;
sub->rects[i] = av_mallocz(sizeof(*sub->rects[0]));
if (!sub->rects[i]) {
sub->rects[i]->linesize[0] = object->w;
-#if FF_API_AVPICTURE
-FF_DISABLE_DEPRECATION_WARNINGS
- rect = sub->rects[i];
- for (j = 0; j < 4; j++) {
- rect->pict.data[j] = rect->data[j];
- rect->pict.linesize[j] = rect->linesize[j];
- }
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
if (object->rle) {
if (object->rle_remaining_len) {
av_log(avctx, AV_LOG_ERROR, "RLE data length %u is %u bytes shorter than expected\n",
return AVERROR(ENOMEM);
}
+#if FF_API_AVPICTURE
+FF_DISABLE_DEPRECATION_WARNINGS
+{
+ AVSubtitleRect *rect;
+ int j;
+ rect = sub->rects[i];
+ for (j = 0; j < 4; j++) {
+ rect->pict.data[j] = rect->data[j];
+ rect->pict.linesize[j] = rect->linesize[j];
+ }
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
memcpy(sub->rects[i]->data[1], palette->clut, sub->rects[i]->nb_colors * sizeof(uint32_t));
}