Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -98,26 +98,38 @@ int ff_parse_itu_t_t35_to_dynamic_hdr_vivid(AVDynamicHDRVivid *s, const uint8_t · 97 unmodified lines | ||
| 98 | 98 | return AVERROR_INVALIDDATA; |
| 99 | 99 | tm_params->three_Spline_enable_flag = get_bits(gb, 1); |
| 100 | 100 | if (tm_params->three_Spline_enable_flag) { |
| 101 | + AVHDRVivid3SplineParams *three_spline; | |
| 102 | + | |
| 101 | 103 | if (get_bits_left(gb) < 1 + tm_params->three_Spline_num * (2 + 12 + 28 + 1)) |
| 102 | 104 | return AVERROR_INVALIDDATA; |
| 103 | 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 | 108 | 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) { | |
| 107 | 112 | if (get_bits_left(gb) < 8) |
| 108 | 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}; | |
| 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}; | |
| 115 | 120 | } |
| 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 | |
| 119 | 132 | } |
| 120 | − | |
| 121 | 133 | } |
| 122 | 134 | } |
| 123 | 135 | } |