| @@ -1377,6 +1377,58 @@ int ff_vvc_intra_chroma_pred_mode(VVCLocalContext *lc) · 1376 unmodified lines |
| 1377 | 1377 | return (get_cabac_bypass(&lc->ep->cc) << 1) | get_cabac_bypass(&lc->ep->cc); |
| 1378 | 1378 | } |
| 1379 | 1379 | |
| 1380 | +int ff_vvc_palette_predictor_run(VVCLocalContext *lc) |
| 1381 | +{ |
| 1382 | + return kth_order_egk_decode(&lc->ep->cc, 0); |
| 1383 | +} |
| 1384 | + |
| 1385 | +int ff_vvc_num_signalled_palette_entries(VVCLocalContext *lc) |
| 1386 | +{ |
| 1387 | + return kth_order_egk_decode(&lc->ep->cc, 0); |
| 1388 | +} |
| 1389 | + |
| 1390 | +int ff_vvc_new_palette_entries(VVCLocalContext *lc, const int bit_depth) |
| 1391 | +{ |
| 1392 | + return fixed_length_decode(&lc->ep->cc, bit_depth); |
| 1393 | +} |
| 1394 | + |
| 1395 | +bool ff_vvc_palette_escape_val_present_flag(VVCLocalContext *lc) |
| 1396 | +{ |
| 1397 | + return get_cabac_bypass(&lc->ep->cc); |
| 1398 | +} |
| 1399 | + |
| 1400 | +bool ff_vvc_palette_transpose_flag(VVCLocalContext *lc) |
| 1401 | +{ |
| 1402 | + return GET_CABAC(PALETTE_TRANSPOSE_FLAG); |
| 1403 | +} |
| 1404 | + |
| 1405 | +bool ff_vvc_run_copy_flag(VVCLocalContext *lc, const int prev_run_type, const int prev_run_position, const int cur_pos) |
| 1406 | +{ |
| 1407 | + uint8_t run_left_lut[] = { 0, 1, 2, 3, 4 }; |
| 1408 | + uint8_t run_top_lut[] = { 5, 6, 6, 7, 7 }; |
| 1409 | + |
| 1410 | + int bin_dist = cur_pos - prev_run_position - 1; |
| 1411 | + uint8_t *run_lut = prev_run_type == 1 ? run_top_lut : run_left_lut; |
| 1412 | + uint8_t ctx_inc = bin_dist <= 4 ? run_lut[bin_dist] : run_lut[4]; |
| 1413 | + |
| 1414 | + return GET_CABAC(RUN_COPY_FLAG + ctx_inc); |
| 1415 | +} |
| 1416 | + |
| 1417 | +bool ff_vvc_copy_above_palette_indices_flag(VVCLocalContext *lc) |
| 1418 | +{ |
| 1419 | + return GET_CABAC(COPY_ABOVE_PALETTE_INDICES_FLAG); |
| 1420 | +} |
| 1421 | + |
| 1422 | +int ff_vvc_palette_idx_idc(VVCLocalContext *lc, const int max_palette_index, const bool adjust) |
| 1423 | +{ |
| 1424 | + return truncated_binary_decode(lc, max_palette_index - adjust); |
| 1425 | +} |
| 1426 | + |
| 1427 | +int ff_vvc_palette_escape_val(VVCLocalContext *lc) |
| 1428 | +{ |
| 1429 | + return kth_order_egk_decode(&lc->ep->cc, 5); |
| 1430 | +} |
| 1431 | + |
| 1380 | 1432 | int ff_vvc_general_merge_flag(VVCLocalContext *lc) |
| 1381 | 1433 | { |
| 1382 | 1434 | return GET_CABAC(GENERAL_MERGE_FLAG); |