History

avcodec/dynamic_hdr_vivid: fix three spline params

Zhao Zhili committed 3 years ago

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

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
98 return AVERROR_INVALIDDATA;98 return AVERROR_INVALIDDATA;
99 tm_params->three_Spline_enable_flag = get_bits(gb, 1);99 tm_params->three_Spline_enable_flag = get_bits(gb, 1);
100 if (tm_params->three_Spline_enable_flag) {100 if (tm_params->three_Spline_enable_flag) {
101 AVHDRVivid3SplineParams *three_spline;
102
101 if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1))103 if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1))
102 return AVERROR_INVALIDDATA;104 return AVERROR_INVALIDDATA;
103 tm_params->three_Spline_num = get_bits(gb, 1) + 1;105 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;
104 for (int j = 0; j < tm_params->three_Spline_num; j++) {108 for (int j = 0; j < tm_params->three_Spline_num; j++) {
105 tm_params->three_Spline_TH_mode = get_bits(gb, 2);109 three_spline = &tm_params->three_spline[j];
106 if (tm_params->three_Spline_TH_mode == 0 || tm_params->three_Spline_TH_mode == 2) {110 three_spline->th_mode = get_bits(gb, 2);
111 if (three_spline->th_mode == 0 || three_spline->th_mode == 2) {
107 if (get_bits_left(gb) < 8)112 if (get_bits_left(gb) < 8)
108 return AVERROR_INVALIDDATA;113 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};
110 }115 }
111 tm_params->three_Spline_TH_enable = (AVRational){get_bits(gb, 12), 4095};116 three_spline->th_enable = (AVRational){get_bits(gb, 12), 4095};
112 tm_params->three_Spline_TH_Delta1 = (AVRational){get_bits(gb, 10), 1023};117 three_spline->th_delta1 = (AVRational){get_bits(gb, 10), 1023};
113 tm_params->three_Spline_TH_Delta2 = (AVRational){get_bits(gb, 10), 1023};118 three_spline->th_delta2 = (AVRational){get_bits(gb, 10), 1023};
114 tm_params->three_Spline_enable_Strength = (AVRational){get_bits(gb, 8), 255};119 three_spline->enable_strength = (AVRational){get_bits(gb, 8), 255};
115 }120 }
116 } else {121#if FF_API_HDR_VIVID_THREE_SPLINE
117 tm_params->three_Spline_num = 1;122 three_spline = &tm_params->three_spline[0];
118 tm_params->three_Spline_TH_mode = 0;123FF_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;
130FF_ENABLE_DEPRECATION_WARNINGS
131#endif
119 }132 }
120
121 }133 }
122 }134 }
123 }135 }

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