diff options
-rw-r--r-- | video/image_writer.c | 15 | ||||
-rw-r--r-- | video/mp_image.c | 6 |
2 files changed, 8 insertions, 13 deletions
diff --git a/video/image_writer.c b/video/image_writer.c index 8f5f4ed877..62dd34f288 100644 --- a/video/image_writer.c +++ b/video/image_writer.c @@ -136,19 +136,18 @@ static void prepare_avframe(AVFrame *pic, AVCodecContext *avctx, pic->format = avctx->pix_fmt; pic->width = avctx->width; pic->height = avctx->height; - avctx->color_range = pic->color_range = - pl_levels_to_av(image->params.repr.levels); + pl_avframe_set_repr(pic, image->params.repr); + avctx->colorspace = pic->colorspace; + avctx->color_range = pic->color_range; if (!tag_csp) return; - avctx->color_primaries = pic->color_primaries = - pl_primaries_to_av(image->params.color.primaries); - avctx->color_trc = pic->color_trc = - pl_transfer_to_av(image->params.color.transfer); - avctx->colorspace = pic->colorspace = - pl_system_to_av(image->params.repr.sys); + pl_avframe_set_color(pic, image->params.color); + avctx->color_primaries = pic->color_primaries; + avctx->color_trc = pic->color_trc; avctx->chroma_sample_location = pic->chroma_location = pl_chroma_to_av(image->params.chroma_location); + mp_dbg(log, "mapped color params:\n" " trc = %s\n" " primaries = %s\n" diff --git a/video/mp_image.c b/video/mp_image.c index a8c0262aa7..609fb17bf0 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -1203,11 +1203,7 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *src) if (src->fields & MP_IMGFIELD_REPEAT_FIRST) dst->repeat_pict = 1; - dst->colorspace = pl_system_to_av(src->params.repr.sys); - dst->color_range = pl_levels_to_av(src->params.repr.levels); - dst->color_primaries = - pl_primaries_to_av(src->params.color.primaries); - dst->color_trc = pl_transfer_to_av(src->params.color.transfer); + pl_avframe_set_repr(dst, src->params.repr); dst->chroma_location = pl_chroma_to_av(src->params.chroma_location); |