History

avcodec/pngdec: respect side data preference

Niklas Haas committed 2 years ago

Commit 454691a1 parent ffb8dc71 file · +10 −5Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/pngdec.c+10−5
@@ -660,6 +660,7 @@ static int decode_phys_chunk(AVCodecContext *avctx, PNGDecContext *s, · 659 unmodified lines
660static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame)660static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame)
661{661{
662 PNGDecContext *s = avctx->priv_data;662 PNGDecContext *s = avctx->priv_data;
663 int ret;
663 664
664 if (s->have_cicp) {665 if (s->have_cicp) {
665 if (s->cicp_primaries >= AVCOL_PRI_NB)666 if (s->cicp_primaries >= AVCOL_PRI_NB)
@@ -678,11 +679,15 @@ static int populate_avctx_color_fields(AVCodecContext *avctx, AVFrame *frame) · 12 unmodified lines
678 avctx->color_range = frame->color_range = AVCOL_RANGE_UNSPECIFIED;679 avctx->color_range = frame->color_range = AVCOL_RANGE_UNSPECIFIED;
679 }680 }
680 } else if (s->iccp_data) {681 } else if (s->iccp_data) {
681 AVFrameSideData *sd = av_frame_new_side_data(frame, AV_FRAME_DATA_ICC_PROFILE, s->iccp_data_len);682 AVFrameSideData *sd;
682 if (!sd)683 ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_ICC_PROFILE,
683 return AVERROR(ENOMEM);684 s->iccp_data_len, &sd);
684 memcpy(sd->data, s->iccp_data, s->iccp_data_len);685 if (ret < 0)
685 av_dict_set(&sd->metadata, "name", s->iccp_name, 0);686 return ret;
687 if (sd) {
688 memcpy(sd->data, s->iccp_data, s->iccp_data_len);
689 av_dict_set(&sd->metadata, "name", s->iccp_name, 0);
690 }
686 } else if (s->have_srgb) {691 } else if (s->have_srgb) {
687 avctx->color_primaries = frame->color_primaries = AVCOL_PRI_BT709;692 avctx->color_primaries = frame->color_primaries = AVCOL_PRI_BT709;
688 avctx->color_trc = frame->color_trc = AVCOL_TRC_IEC61966_2_1;693 avctx->color_trc = frame->color_trc = AVCOL_TRC_IEC61966_2_1;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t