Also remove the _minus8 part of the name to be in line with the rest of the decoder, and fix the storage type for pps_palette_predictor_initializer, to support hbd values.
Showing the changes to libavcodec (2 of 2 files). Show all
Unified · Split
| @@ -1538,17 +1538,24 @@ static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, · 1537 unmodified lines | |||
| 1538 | } | 1538 | } |
| 1539 | 1539 | ||
| 1540 | if (pps->pps_palette_predictor_initializers_present_flag = get_bits1(gb)) { | 1540 | if (pps->pps_palette_predictor_initializers_present_flag = get_bits1(gb)) { |
| 1541 | if ((pps->pps_num_palette_predictor_initializers = get_ue_golomb_long(gb)) > 0) { | 1541 | pps->pps_num_palette_predictor_initializers = get_ue_golomb(gb); |
| 1542 | if (pps->pps_num_palette_predictor_initializers > 0) { | ||
| 1543 | if (pps->pps_num_palette_predictor_initializers > HEVC_MAX_PALETTE_PREDICTOR_SIZE) { | ||
| 1544 | av_log(avctx, AV_LOG_ERROR, | ||
| 1545 | "pps_num_palette_predictor_initializers out of range: %u\n", | ||
| 1546 | pps->pps_num_palette_predictor_initializers); | ||
| 1547 | return AVERROR_INVALIDDATA; | ||
| 1548 | } | ||
| 1542 | pps->monochrome_palette_flag = get_bits1(gb); | 1549 | pps->monochrome_palette_flag = get_bits1(gb); |
| 1543 | pps->luma_bit_depth_entry_minus8 = get_ue_golomb_long(gb); | 1550 | pps->luma_bit_depth_entry = get_ue_golomb_31(gb) + 8; |
| 1544 | if (!pps->monochrome_palette_flag) | 1551 | if (!pps->monochrome_palette_flag) |
| 1545 | pps->chroma_bit_depth_entry_minus8 = get_ue_golomb_long(gb); | 1552 | pps->chroma_bit_depth_entry = get_ue_golomb_31(gb) + 8; |
| 1546 | num_comps = pps->monochrome_palette_flag ? 1 : 3; | 1553 | num_comps = pps->monochrome_palette_flag ? 1 : 3; |
| 1547 | for (int comp = 0; comp < num_comps; comp++) | 1554 | for (int comp = 0; comp < num_comps; comp++) { |
| 1555 | int bit_depth = !comp ? pps->luma_bit_depth_entry : pps->chroma_bit_depth_entry; | ||
| 1548 | for (int i = 0; i < pps->pps_num_palette_predictor_initializers; i++) | 1556 | for (int i = 0; i < pps->pps_num_palette_predictor_initializers; i++) |
| 1549 | pps->pps_palette_predictor_initializer[comp][i] = | 1557 | pps->pps_palette_predictor_initializer[comp][i] = get_bits(gb, bit_depth); |
| 1550 | get_bits(gb, 8 + (!comp ? pps->luma_bit_depth_entry_minus8 : | 1558 | } |
| 1551 | pps->chroma_bit_depth_entry_minus8)); | ||
| 1552 | } | 1559 | } |
| 1553 | } | 1560 | } |
| 1554 | 1561 | ||
| @@ -358,9 +358,9 @@ typedef struct HEVCPPS { · 357 unmodified lines | |||
| 358 | uint8_t pps_palette_predictor_initializers_present_flag; | 358 | uint8_t pps_palette_predictor_initializers_present_flag; |
| 359 | uint8_t pps_num_palette_predictor_initializers; | 359 | uint8_t pps_num_palette_predictor_initializers; |
| 360 | uint8_t monochrome_palette_flag; | 360 | uint8_t monochrome_palette_flag; |
| 361 | uint8_t luma_bit_depth_entry_minus8; | 361 | uint8_t luma_bit_depth_entry; |
| 362 | uint8_t chroma_bit_depth_entry_minus8; | 362 | uint8_t chroma_bit_depth_entry; |
| 363 | uint8_t pps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE]; | 363 | uint16_t pps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE]; |
| 364 | 364 | ||
| 365 | // Inferred parameters | 365 | // Inferred parameters |
| 366 | unsigned int *column_width; ///< ColumnWidth | 366 | unsigned int *column_width; ///< ColumnWidth |