32 #define CABAC_MAX_BIN 31
192 94, 138, 182, 154, 154,
200 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111,
203 110, 110, 124, 125, 140, 153, 125, 127, 140, 109, 111, 143, 127, 111,
208 111, 111, 125, 110, 110, 94, 124, 108, 124, 107, 125, 141, 179, 153,
209 125, 107, 125, 141, 179, 153, 125, 107, 125, 141, 179, 153, 125, 140,
210 139, 182, 182, 152, 136, 152, 136, 153, 136, 139, 111, 136, 139, 111,
213 140, 92, 137, 138, 140, 152, 138, 139, 153, 74, 149, 92, 139, 107,
214 122, 152, 140, 179, 166, 182, 140, 227, 122, 197,
216 138, 153, 136, 167, 152, 152,
218 154, 154, 154, 154, 154, 154, 154, 154,
269 149, 107, 167, 154, 154,
277 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95,
280 125, 110, 94, 110, 95, 79, 125, 111, 110, 78, 110, 111, 111, 95,
285 155, 154, 139, 153, 139, 123, 123, 63, 153, 166, 183, 140, 136, 153,
286 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170,
287 153, 123, 123, 107, 121, 107, 121, 167, 151, 183, 140, 151, 183, 140,
290 154, 196, 196, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
291 136, 137, 169, 194, 166, 167, 154, 167, 137, 182,
293 107, 167, 91, 122, 107, 167,
295 154, 154, 154, 154, 154, 154, 154, 154,
346 149, 92, 167, 154, 154,
354 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111,
357 125, 110, 124, 110, 95, 94, 125, 111, 111, 79, 125, 126, 111, 111,
362 170, 154, 139, 153, 139, 123, 123, 63, 124, 166, 183, 140, 136, 153,
363 154, 166, 183, 140, 136, 153, 154, 166, 183, 140, 136, 153, 154, 170,
364 153, 138, 138, 122, 121, 122, 121, 167, 151, 183, 140, 151, 183, 140,
367 154, 196, 167, 167, 154, 152, 167, 182, 182, 134, 149, 136, 153, 121,
368 136, 122, 169, 208, 166, 167, 154, 152, 167, 182,
370 107, 167, 91, 107, 107, 167,
372 154, 154, 154, 154, 154, 154, 154, 154,
409 { 0, 1, 2, 3, 16, 17, 18, 19, },
410 { 4, 5, 6, 7, 20, 21, 22, 23, },
411 { 8, 9, 10, 11, 24, 25, 26, 27, },
412 { 12, 13, 14, 15, 28, 29, 30, 31, },
413 { 32, 33, 34, 35, 48, 49, 50, 51, },
414 { 36, 37, 38, 39, 52, 53, 54, 55, },
415 { 40, 41, 42, 43, 56, 57, 58, 59, },
416 { 44, 45, 46, 47, 60, 61, 62, 63, },
440 { 0, 2, 5, 9, 14, 20, 27, 35, },
441 { 1, 4, 8, 13, 19, 26, 34, 42, },
442 { 3, 7, 12, 18, 25, 33, 41, 48, },
443 { 6, 11, 17, 24, 32, 40, 47, 53, },
444 { 10, 16, 23, 31, 39, 46, 52, 57, },
445 { 15, 22, 30, 38, 45, 51, 56, 60, },
446 { 21, 29, 37, 44, 50, 55, 59, 62, },
447 { 28, 36, 43, 49, 54, 58, 61, 63, },
452 if (
s->ps.pps->entropy_coding_sync_enabled_flag &&
453 (ctb_addr_ts %
s->ps.sps->ctb_width == 2 ||
454 (
s->ps.sps->ctb_width == 2 &&
455 ctb_addr_ts %
s->ps.sps->ctb_width == 0))) {
457 if (
s->ps.sps->persistent_rice_adaptation_enabled_flag) {
466 if (
s->ps.sps->persistent_rice_adaptation_enabled_flag) {
467 const HEVCContext *prev =
s->sList[(thread +
s->threads_number - 1) %
s->threads_number];
489 int init_type = 2 -
s->sh.slice_type;
497 int m = (init_value >> 4) * 5 - 45;
498 int n = ((init_value & 15) << 3) - 16;
499 int pre = 2 * (((m *
av_clip(
s->sh.slice_qp, 0, 51)) >> 4) + n) - 127;
503 pre = 124 + (pre & 1);
504 s->HEVClc->cabac_state[
i] = pre;
507 for (
i = 0;
i < 4;
i++)
508 s->HEVClc->stat_coeff[
i] = 0;
513 if (ctb_addr_ts ==
s->ps.pps->ctb_addr_rs_to_ts[
s->sh.slice_ctb_addr_rs]) {
517 if (
s->sh.dependent_slice_segment_flag == 0 ||
518 (
s->ps.pps->tiles_enabled_flag &&
519 s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[ctb_addr_ts - 1]))
522 if (!
s->sh.first_slice_in_pic_flag &&
523 s->ps.pps->entropy_coding_sync_enabled_flag) {
524 if (ctb_addr_ts %
s->ps.sps->ctb_width == 0) {
525 if (
s->ps.sps->ctb_width == 1)
527 else if (
s->sh.dependent_slice_segment_flag == 1)
532 if (
s->ps.pps->tiles_enabled_flag &&
533 s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[ctb_addr_ts - 1]) {
535 if (
s->threads_number == 1)
544 if (
s->ps.pps->entropy_coding_sync_enabled_flag) {
545 if (ctb_addr_ts %
s->ps.sps->ctb_width == 0) {
548 if (
s->threads_number == 1)
556 if (
s->ps.sps->ctb_width == 1)
566 #define GET_CABAC(ctx) get_cabac(&s->HEVClc->cc, &s->HEVClc->cabac_state[ctx])
588 for (
i = 0;
i < 4;
i++)
596 int length = (1 << (
FFMIN(
s->ps.sps->bit_depth, 10) - 5)) - 1;
627 int min_cb_width =
s->ps.sps->min_cb_width;
632 if (
s->HEVClc->ctb_left_flag || x0b)
634 if (
s->HEVClc->ctb_up_flag || y0b)
650 if (prefix_val >= 5) {
653 suffix_val += 1 << k;
664 return prefix_val + suffix_val;
679 int c_max=
FFMAX(5,
s->ps.pps->chroma_qp_offset_list_len_minus1);
695 int inc = 0, depth_left = 0, depth_top = 0;
698 int x_cb = x0 >>
s->ps.sps->log2_min_cb_size;
699 int y_cb = y0 >>
s->ps.sps->log2_min_cb_size;
701 if (
s->HEVClc->ctb_left_flag || x0b)
702 depth_left =
s->tab_ct_depth[(y_cb) *
s->ps.sps->min_cb_width + x_cb - 1];
703 if (
s->HEVClc->ctb_up_flag || y0b)
704 depth_top =
s->tab_ct_depth[(y_cb - 1) *
s->ps.sps->min_cb_width + x_cb];
706 inc += (depth_left > ct_depth);
707 inc += (depth_top > ct_depth);
716 if (log2_cb_size ==
s->ps.sps->log2_min_cb_size) {
721 if (log2_cb_size == 3)
728 if (!
s->ps.sps->amp_enabled_flag) {
772 for (
i = 0;
i < 4;
i++)
806 if (nPbW + nPbH == 12)
817 int max = num_ref_idx_lx - 1;
917 int log2_size,
int *last_scx_prefix,
int *last_scy_prefix)
920 int max = (log2_size << 1) - 1;
921 int ctx_offset, ctx_shift;
924 ctx_offset = 3 * (log2_size - 2) + ((log2_size - 1) >> 2);
925 ctx_shift = (log2_size + 1) >> 2;
928 ctx_shift = log2_size - 2;
933 *last_scx_prefix =
i;
939 *last_scy_prefix =
i;
943 int last_significant_coeff_prefix)
946 int length = (last_significant_coeff_prefix >> 1) - 1;
949 for (
i = 1;
i < length;
i++)
958 inc =
FFMIN(ctx_cg, 1) + (c_idx>0 ? 2 : 0);
963 int offset,
const uint8_t *ctx_idx_map)
965 int inc = ctx_idx_map[(y_c << 2) + x_c] +
offset;
995 int last_coeff_abs_level_remaining;
1002 for (
i = 0;
i < rc_rice_param;
i++)
1004 last_coeff_abs_level_remaining = (prefix << rc_rice_param) +
suffix;
1006 int prefix_minus3 = prefix - 3;
1008 if (prefix ==
CABAC_MAX_BIN || prefix_minus3 + rc_rice_param > 16 + 6) {
1013 for (
i = 0;
i < prefix_minus3 + rc_rice_param;
i++)
1015 last_coeff_abs_level_remaining = (((1 << prefix_minus3) + 3 - 1)
1016 << rc_rice_param) +
suffix;
1018 return last_coeff_abs_level_remaining;
1026 for (
i = 0;
i < nb;
i++)
1032 int log2_trafo_size,
enum ScanType scan_idx,
1035 #define GET_COORD(offset, n) \
1037 x_c = (x_cg << 2) + scan_x_off[n]; \
1038 y_c = (y_cg << 2) + scan_y_off[n]; \
1041 int transform_skip_flag = 0;
1043 int last_significant_coeff_x, last_significant_coeff_y;
1047 int greater1_ctx = 1;
1049 int num_last_subset;
1050 int x_cg_last_sig, y_cg_last_sig;
1052 const uint8_t *scan_x_cg, *scan_y_cg, *scan_x_off, *scan_y_off;
1054 ptrdiff_t
stride =
s->frame->linesize[c_idx];
1055 int hshift =
s->ps.sps->hshift[c_idx];
1056 int vshift =
s->ps.sps->vshift[c_idx];
1057 uint8_t *dst = &
s->frame->data[c_idx][(y0 >> vshift) *
stride +
1058 ((x0 >> hshift) <<
s->ps.sps->pixel_shift)];
1060 uint8_t significant_coeff_group_flag[8][8] = {{0}};
1061 int explicit_rdpcm_flag = 0;
1062 int explicit_rdpcm_dir_flag;
1064 int trafo_size = 1 << log2_trafo_size;
1067 static const uint8_t level_scale[] = { 40, 45, 51, 57, 64, 72 };
1068 const uint8_t *scale_matrix =
NULL;
1073 memset(coeffs, 0, trafo_size * trafo_size *
sizeof(int16_t));
1077 static const int qp_c[] = { 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37 };
1078 static const uint8_t rem6[51 + 4 * 6 + 1] = {
1079 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
1080 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
1081 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
1082 4, 5, 0, 1, 2, 3, 4, 5, 0, 1
1085 static const uint8_t div6[51 + 4 * 6 + 1] = {
1086 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3,
1087 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
1088 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
1089 10, 10, 11, 11, 11, 11, 11, 11, 12, 12
1091 int qp_y = lc->
qp_y;
1093 if (
s->ps.pps->transform_skip_enabled_flag &&
1094 log2_trafo_size <= s->ps.pps->log2_max_transform_skip_block_size) {
1099 qp = qp_y +
s->ps.sps->qp_bd_offset;
1104 offset =
s->ps.pps->cb_qp_offset +
s->sh.slice_cb_qp_offset +
1107 offset =
s->ps.pps->cr_qp_offset +
s->sh.slice_cr_qp_offset +
1111 if (
s->ps.sps->chroma_format_idc == 1) {
1117 qp = qp_c[qp_i - 30];
1125 qp +=
s->ps.sps->qp_bd_offset;
1128 shift =
s->ps.sps->bit_depth + log2_trafo_size - 5;
1130 scale = level_scale[rem6[qp]] << (div6[qp]);
1134 if (
s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
1135 const ScalingList *sl =
s->ps.pps->scaling_list_data_present_flag ?
1136 &
s->ps.pps->scaling_list : &
s->ps.sps->scaling_list;
1139 matrix_id = 3 * matrix_id + c_idx;
1141 scale_matrix = sl->
sl[log2_trafo_size - 2][matrix_id];
1142 if (log2_trafo_size >= 4)
1143 dc_scale = sl->
sl_dc[log2_trafo_size - 4][matrix_id];
1155 if (explicit_rdpcm_flag) {
1161 &last_significant_coeff_x, &last_significant_coeff_y);
1163 if (last_significant_coeff_x > 3) {
1165 last_significant_coeff_x = (1 << ((last_significant_coeff_x >> 1) - 1)) *
1166 (2 + (last_significant_coeff_x & 1)) +
1170 if (last_significant_coeff_y > 3) {
1172 last_significant_coeff_y = (1 << ((last_significant_coeff_y >> 1) - 1)) *
1173 (2 + (last_significant_coeff_y & 1)) +
1178 FFSWAP(
int, last_significant_coeff_x, last_significant_coeff_y);
1180 x_cg_last_sig = last_significant_coeff_x >> 2;
1181 y_cg_last_sig = last_significant_coeff_y >> 2;
1185 int last_x_c = last_significant_coeff_x & 3;
1186 int last_y_c = last_significant_coeff_y & 3;
1191 if (trafo_size == 4) {
1194 }
else if (trafo_size == 8) {
1198 }
else if (trafo_size == 16) {
1214 num_coeff =
horiz_scan8x8_inv[last_significant_coeff_y][last_significant_coeff_x];
1221 num_coeff =
horiz_scan8x8_inv[last_significant_coeff_x][last_significant_coeff_y];
1225 num_last_subset = (num_coeff - 1) >> 4;
1227 for (
i = num_last_subset;
i >= 0;
i--) {
1229 int x_cg, y_cg, x_c, y_c,
pos;
1230 int implicit_non_zero_coeff = 0;
1231 int64_t trans_coeff_level;
1236 uint8_t significant_coeff_flag_idx[16];
1237 uint8_t nb_significant_coeff_flag = 0;
1239 x_cg = scan_x_cg[
i];
1240 y_cg = scan_y_cg[
i];
1242 if ((
i < num_last_subset) && (
i > 0)) {
1244 if (x_cg < (1 << (log2_trafo_size - 2)) - 1)
1245 ctx_cg += significant_coeff_group_flag[x_cg + 1][y_cg];
1246 if (y_cg < (1 << (log2_trafo_size - 2)) - 1)
1247 ctx_cg += significant_coeff_group_flag[x_cg][y_cg + 1];
1249 significant_coeff_group_flag[x_cg][y_cg] =
1251 implicit_non_zero_coeff = 1;
1253 significant_coeff_group_flag[x_cg][y_cg] =
1254 ((x_cg == x_cg_last_sig && y_cg == y_cg_last_sig) ||
1255 (x_cg == 0 && y_cg == 0));
1258 last_scan_pos = num_coeff -
offset - 1;
1260 if (
i == num_last_subset) {
1261 n_end = last_scan_pos - 1;
1262 significant_coeff_flag_idx[0] = last_scan_pos;
1263 nb_significant_coeff_flag = 1;
1268 if (x_cg < ((1 << log2_trafo_size) - 1) >> 2)
1269 prev_sig = !!significant_coeff_group_flag[x_cg + 1][y_cg];
1270 if (y_cg < ((1 << log2_trafo_size) - 1) >> 2)
1271 prev_sig += (!!significant_coeff_group_flag[x_cg][y_cg + 1] << 1);
1273 if (significant_coeff_group_flag[x_cg][y_cg] && n_end >= 0) {
1274 static const uint8_t ctx_idx_map[] = {
1275 0, 1, 4, 5, 2, 3, 4, 5, 6, 6, 8, 8, 7, 7, 8, 8,
1276 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
1277 2, 2, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
1278 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0, 2, 1, 0, 0,
1279 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
1281 const uint8_t *ctx_idx_map_p;
1283 if (
s->ps.sps->transform_skip_context_enabled_flag &&
1285 ctx_idx_map_p = &ctx_idx_map[4 * 16];
1289 scf_offset = 14 + 27;
1294 if (log2_trafo_size == 2) {
1295 ctx_idx_map_p = &ctx_idx_map[0];
1297 ctx_idx_map_p = &ctx_idx_map[(prev_sig + 1) << 4];
1299 if ((x_cg > 0 || y_cg > 0))
1301 if (log2_trafo_size == 3) {
1302 scf_offset += (scan_idx ==
SCAN_DIAG) ? 9 : 15;
1307 if (log2_trafo_size == 3)
1314 for (n = n_end; n > 0; n--) {
1315 x_c = scan_x_off[n];
1316 y_c = scan_y_off[n];
1318 significant_coeff_flag_idx[nb_significant_coeff_flag] = n;
1319 nb_significant_coeff_flag++;
1320 implicit_non_zero_coeff = 0;
1323 if (implicit_non_zero_coeff == 0) {
1324 if (
s->ps.sps->transform_skip_context_enabled_flag &&
1329 scf_offset = 16 + 27;
1338 scf_offset = 2 + scf_offset;
1342 significant_coeff_flag_idx[nb_significant_coeff_flag] = 0;
1343 nb_significant_coeff_flag++;
1346 significant_coeff_flag_idx[nb_significant_coeff_flag] = 0;
1347 nb_significant_coeff_flag++;
1351 n_end = nb_significant_coeff_flag;
1355 int first_nz_pos_in_cg;
1356 int last_nz_pos_in_cg;
1357 int c_rice_param = 0;
1358 int first_greater1_coeff_idx = -1;
1359 uint8_t coeff_abs_level_greater1_flag[8];
1360 uint16_t coeff_sign_flag;
1367 int ctx_set = (
i > 0 && c_idx == 0) ? 2 : 0;
1369 if (
s->ps.sps->persistent_rice_adaptation_enabled_flag) {
1371 sb_type = 2 * (c_idx == 0 ? 1 : 0);
1373 sb_type = 2 * (c_idx == 0 ? 1 : 0) + 1;
1377 if (!(
i == num_last_subset) && greater1_ctx == 0)
1380 last_nz_pos_in_cg = significant_coeff_flag_idx[0];
1382 for (m = 0; m < (n_end > 8 ? 8 : n_end); m++) {
1383 int inc = (ctx_set << 2) + greater1_ctx;
1384 coeff_abs_level_greater1_flag[m] =
1386 if (coeff_abs_level_greater1_flag[m]) {
1388 if (first_greater1_coeff_idx == -1)
1389 first_greater1_coeff_idx = m;
1390 }
else if (greater1_ctx > 0 && greater1_ctx < 3) {
1394 first_nz_pos_in_cg = significant_coeff_flag_idx[n_end - 1];
1398 s->ps.sps->implicit_rdpcm_enabled_flag && transform_skip_flag &&
1399 (pred_mode_intra == 10 || pred_mode_intra == 26 )) ||
1400 explicit_rdpcm_flag)
1403 sign_hidden = (last_nz_pos_in_cg - first_nz_pos_in_cg >= 4);
1405 if (first_greater1_coeff_idx != -1) {
1408 if (!
s->ps.pps->sign_data_hiding_flag || !sign_hidden ) {
1411 coeff_sign_flag =
coeff_sign_flag_decode(
s, nb_significant_coeff_flag - 1) << (16 - (nb_significant_coeff_flag - 1));
1414 for (m = 0; m < n_end; m++) {
1415 n = significant_coeff_flag_idx[m];
1418 trans_coeff_level = 1 + coeff_abs_level_greater1_flag[m];
1419 if (trans_coeff_level == ((m == first_greater1_coeff_idx) ? 3 : 2)) {
1422 trans_coeff_level += last_coeff_abs_level_remaining;
1423 if (trans_coeff_level > (3 << c_rice_param))
1424 c_rice_param =
s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 :
FFMIN(c_rice_param + 1, 4);
1425 if (
s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
1426 int c_rice_p_init = lc->
stat_coeff[sb_type] / 4;
1427 if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
1429 else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init))
1438 trans_coeff_level = 1 + last_coeff_abs_level_remaining;
1439 if (trans_coeff_level > (3 << c_rice_param))
1440 c_rice_param =
s->ps.sps->persistent_rice_adaptation_enabled_flag ? c_rice_param + 1 :
FFMIN(c_rice_param + 1, 4);
1441 if (
s->ps.sps->persistent_rice_adaptation_enabled_flag && !rice_init) {
1442 int c_rice_p_init = lc->
stat_coeff[sb_type] / 4;
1443 if (last_coeff_abs_level_remaining >= (3 << c_rice_p_init))
1445 else if (2 * last_coeff_abs_level_remaining < (1 << c_rice_p_init))
1451 if (
s->ps.pps->sign_data_hiding_flag && sign_hidden) {
1452 sum_abs += trans_coeff_level;
1453 if (n == first_nz_pos_in_cg && (sum_abs&1))
1454 trans_coeff_level = -trans_coeff_level;
1456 if (coeff_sign_flag >> 15)
1457 trans_coeff_level = -trans_coeff_level;
1458 coeff_sign_flag <<= 1;
1460 if (
s->ps.sps->scaling_list_enable_flag && !(transform_skip_flag && log2_trafo_size > 2)) {
1461 if(y_c || x_c || log2_trafo_size < 4) {
1462 switch(log2_trafo_size) {
1463 case 3:
pos = (y_c << 3) + x_c;
break;
1464 case 4:
pos = ((y_c >> 1) << 3) + (x_c >> 1);
break;
1465 case 5:
pos = ((y_c >> 2) << 3) + (x_c >> 2);
break;
1466 default:
pos = (y_c << 2) + x_c;
break;
1468 scale_m = scale_matrix[
pos];
1473 trans_coeff_level = (trans_coeff_level * (int64_t)
scale * (int64_t)scale_m +
add) >>
shift;
1474 if(trans_coeff_level < 0) {
1475 if((~trans_coeff_level) & 0xFffffffffff8000)
1476 trans_coeff_level = -32768;
1478 if(trans_coeff_level & 0xffffffffffff8000)
1479 trans_coeff_level = 32767;
1482 coeffs[y_c * trafo_size + x_c] = trans_coeff_level;
1488 if (explicit_rdpcm_flag || (
s->ps.sps->implicit_rdpcm_enabled_flag &&
1489 (pred_mode_intra == 10 || pred_mode_intra == 26))) {
1490 int mode =
s->ps.sps->implicit_rdpcm_enabled_flag ? (pred_mode_intra == 26) : explicit_rdpcm_dir_flag;
1492 s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size,
mode);
1495 if (transform_skip_flag) {
1496 int rot =
s->ps.sps->transform_skip_rotation_enabled_flag &&
1497 log2_trafo_size == 2 &&
1500 for (
i = 0;
i < 8;
i++)
1501 FFSWAP(int16_t, coeffs[
i], coeffs[16 -
i - 1]);
1504 s->hevcdsp.dequant(coeffs, log2_trafo_size);
1506 if (explicit_rdpcm_flag || (
s->ps.sps->implicit_rdpcm_enabled_flag &&
1508 (pred_mode_intra == 10 || pred_mode_intra == 26))) {
1509 int mode = explicit_rdpcm_flag ? explicit_rdpcm_dir_flag : (pred_mode_intra == 26);
1511 s->hevcdsp.transform_rdpcm(coeffs, log2_trafo_size,
mode);
1514 s->hevcdsp.transform_4x4_luma(coeffs);
1516 int max_xy =
FFMAX(last_significant_coeff_x, last_significant_coeff_y);
1518 s->hevcdsp.idct_dc[log2_trafo_size - 2](coeffs);
1520 int col_limit = last_significant_coeff_x + last_significant_coeff_y + 4;
1522 col_limit =
FFMIN(4, col_limit);
1523 else if (max_xy < 8)
1524 col_limit =
FFMIN(8, col_limit);
1525 else if (max_xy < 12)
1526 col_limit =
FFMIN(24, col_limit);
1527 s->hevcdsp.idct[log2_trafo_size - 2](coeffs, col_limit);
1534 for (
i = 0;
i < (trafo_size * trafo_size);
i++) {
1538 s->hevcdsp.add_residual[log2_trafo_size-2](dst, coeffs,
stride);
1555 case 0: lc->
pu.
mvd.
x = 0;
break;
1561 case 0: lc->
pu.
mvd.
y = 0;
break;