History

avcodec/dynamic_hdr_vivid: fix three spline params

Zhao Zhili committed 3 years ago

Commit 0f2bef21 parent 3be46ee1 file · +23 −11Browse files

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

Unified · Split

libavcodec/dynamic_hdr_vivid.c+23−11
@@ -98,26 +98,38 @@ int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t · 97 unmodified lines
9898 return AVERROR_INVALIDDATA;
9999 tm_params->three_Spline_enable_flag = get_bits(gb, 1);
100100 if (tm_params->three_Spline_enable_flag) {
101+ AVHDRVivid3SplineParams *three_spline;
102+
101103 if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1))
102104 return AVERROR_INVALIDDATA;
103105 tm_params->three_Spline_num = get_bits(gb, 1) + 1;
106+ if (tm_params->three_Spline_num > FF_ARRAY_ELEMS(tm_params->three_spline))
107+ return AVERROR_INVALIDDATA;
104108 for (int j = 0; j < tm_params->three_Spline_num; j++) {
105− tm_params->three_Spline_TH_mode = get_bits(gb, 2);
106− if (tm_params->three_Spline_TH_mode == 0 || tm_params->three_Spline_TH_mode == 2) {
109+ three_spline = &tm_params->three_spline[j];
110+ three_spline->th_mode = get_bits(gb, 2);
111+ if (three_spline->th_mode == 0 || three_spline->th_mode == 2) {
107112 if (get_bits_left(gb) < 8)
108113 return AVERROR_INVALIDDATA;
109− tm_params->three_Spline_TH_enable_MB = (AVRational){get_bits(gb, 8), 255};
114+ three_spline->th_enable_mb = (AVRational){get_bits(gb, 8), 255};
110115 }
111− tm_params->three_Spline_TH_enable = (AVRational){get_bits(gb, 12), 4095};
112− tm_params->three_Spline_TH_Delta1 = (AVRational){get_bits(gb, 10), 1023};
113− tm_params->three_Spline_TH_Delta2 = (AVRational){get_bits(gb, 10), 1023};
114− tm_params->three_Spline_enable_Strength = (AVRational){get_bits(gb, 8), 255};
116+ three_spline->th_enable = (AVRational){get_bits(gb, 12), 4095};
117+ three_spline->th_delta1 = (AVRational){get_bits(gb, 10), 1023};
118+ three_spline->th_delta2 = (AVRational){get_bits(gb, 10), 1023};
119+ three_spline->enable_strength = (AVRational){get_bits(gb, 8), 255};
115120 }
116− } else {
117− tm_params->three_Spline_num = 1;
118− tm_params->three_Spline_TH_mode = 0;
121+#if FF_API_HDR_VIVID_THREE_SPLINE
122+ three_spline = &tm_params->three_spline[0];
123+FF_DISABLE_DEPRECATION_WARNINGS
124+ tm_params->three_Spline_TH_mode = three_spline->th_mode;
125+ tm_params->three_Spline_TH_enable_MB = three_spline->th_enable_mb;
126+ tm_params->three_Spline_TH_enable = three_spline->th_enable;
127+ tm_params->three_Spline_TH_Delta1 = three_spline->th_delta1;
128+ tm_params->three_Spline_TH_Delta2 = three_spline->th_delta2;
129+ tm_params->three_Spline_enable_Strength = three_spline->enable_strength;
130+FF_ENABLE_DEPRECATION_WARNINGS
131+#endif
119132 }
120−
121133 }
122134 }
123135 }

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