36 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
37 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
38 5, 5, 6, 6, 7, 8, 9, 10, 11, 13, 14, 16, 18, 20, 22, 24
42 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 8,
43 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36,
44 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64
49 static const int qp_c[] = {
50 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37
52 int qp, qp_i,
offset, idxt;
56 offset =
s->ps.pps->cb_qp_offset;
58 offset =
s->ps.pps->cr_qp_offset;
61 if (
s->ps.sps->chroma_format_idc == 1) {
79 int ctb_size_mask = (1 <<
s->ps.sps->log2_ctb_size) - 1;
80 int MinCuQpDeltaSizeMask = (1 << (
s->ps.sps->log2_ctb_size -
81 s->ps.pps->diff_cu_qp_delta_depth)) - 1;
82 int xQgBase = xBase - (xBase & MinCuQpDeltaSizeMask);
83 int yQgBase = yBase - (yBase & MinCuQpDeltaSizeMask);
84 int min_cb_width =
s->ps.sps->min_cb_width;
85 int x_cb = xQgBase >>
s->ps.sps->log2_min_cb_size;
86 int y_cb = yQgBase >>
s->ps.sps->log2_min_cb_size;
87 int availableA = (xBase & ctb_size_mask) &&
88 (xQgBase & ctb_size_mask);
89 int availableB = (yBase & ctb_size_mask) &&
90 (yQgBase & ctb_size_mask);
91 int qPy_pred, qPy_a, qPy_b;
96 qPy_pred =
s->sh.slice_qp;
105 qPy_a =
s->qp_y_tab[(x_cb - 1) + y_cb * min_cb_width];
111 qPy_b =
s->qp_y_tab[x_cb + (y_cb - 1) * min_cb_width];
113 av_assert2(qPy_a >= -
s->ps.sps->qp_bd_offset && qPy_a < 52);
114 av_assert2(qPy_b >= -
s->ps.sps->qp_bd_offset && qPy_b < 52);
116 return (qPy_a + qPy_b + 1) >> 1;
123 if (
s->HEVClc->tu.cu_qp_delta != 0) {
124 int off =
s->ps.sps->qp_bd_offset;
125 s->HEVClc->qp_y =
FFUMOD(qp_y +
s->HEVClc->tu.cu_qp_delta + 52 + 2 * off,
128 s->HEVClc->qp_y = qp_y;
133 int log2_min_cb_size =
s->ps.sps->log2_min_cb_size;
134 int x = xC >> log2_min_cb_size;
135 int y = yC >> log2_min_cb_size;
136 return s->qp_y_tab[x + y *
s->ps.sps->min_cb_width];
140 ptrdiff_t stride_dst, ptrdiff_t stride_src)
144 if (((intptr_t)dst | (intptr_t)
src | stride_dst | stride_src) & 15) {
146 for (j = 0; j <
width; j+=8)
153 for (j = 0; j <
width; j+=16)
164 *(uint16_t *)dst = *(uint16_t *)
src;
170 int pixel_shift,
int height,
171 ptrdiff_t stride_dst, ptrdiff_t stride_src)
174 if (pixel_shift == 0) {
182 *(uint16_t *)dst = *(uint16_t *)
src;
190 ptrdiff_t stride_src,
int x,
int y,
int width,
int height,
191 int c_idx,
int x_ctb,
int y_ctb)
193 int sh =
s->ps.sps->pixel_shift;
194 int w =
s->ps.sps->width >>
s->ps.sps->hshift[c_idx];
195 int h =
s->ps.sps->height >>
s->ps.sps->vshift[c_idx];
198 memcpy(
s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb) *
w + x) << sh),
200 memcpy(
s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 1) *
w + x) << sh),
204 copy_vert(
s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb) *
h + y) << sh),
src, sh,
height, 1 << sh, stride_src);
206 copy_vert(
s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 1) *
h + y) << sh),
src + ((
width - 1) << sh), sh,
height, 1 << sh, stride_src);
210 uint8_t *
src1,
const uint8_t *dst1,
211 ptrdiff_t stride_src, ptrdiff_t stride_dst,
214 if (
s->ps.pps->transquant_bypass_enable_flag ||
215 (
s->ps.sps->pcm.loop_filter_disable_flag &&
s->ps.sps->pcm_enabled_flag)) {
217 int min_pu_size = 1 <<
s->ps.sps->log2_min_pu_size;
218 int hshift =
s->ps.sps->hshift[c_idx];
219 int vshift =
s->ps.sps->vshift[c_idx];
220 int x_min = ((x0 ) >>
s->ps.sps->log2_min_pu_size);
221 int y_min = ((y0 ) >>
s->ps.sps->log2_min_pu_size);
222 int x_max = ((x0 +
width ) >>
s->ps.sps->log2_min_pu_size);
223 int y_max = ((y0 +
height) >>
s->ps.sps->log2_min_pu_size);
224 int len = (min_pu_size >> hshift) <<
s->ps.sps->pixel_shift;
225 for (y = y_min; y < y_max; y++) {
226 for (x = x_min; x < x_max; x++) {
227 if (
s->is_pcm[y *
s->ps.sps->min_pu_width + x]) {
229 uint8_t *
src =
src1 + (((y <<
s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_src + ((((x <<
s->ps.sps->log2_min_pu_size) - x0) >> hshift) <<
s->ps.sps->pixel_shift);
230 const uint8_t *dst = dst1 + (((y <<
s->ps.sps->log2_min_pu_size) - y0) >> vshift) * stride_dst + ((((x <<
s->ps.sps->log2_min_pu_size) - x0) >> hshift) <<
s->ps.sps->pixel_shift);
231 for (n = 0; n < (min_pu_size >> vshift); n++) {
242 #define CTB(tab, x, y) ((tab)[(y) * s->ps.sps->ctb_width + (x)])
246 static const uint8_t sao_tab[8] = { 0, 1, 2, 2, 3, 3, 4, 4 };
250 int x_ctb = x >>
s->ps.sps->log2_ctb_size;
251 int y_ctb = y >>
s->ps.sps->log2_ctb_size;
252 int ctb_addr_rs = y_ctb *
s->ps.sps->ctb_width + x_ctb;
253 int ctb_addr_ts =
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs];
256 uint8_t vert_edge[] = { 0, 0 };
257 uint8_t horiz_edge[] = { 0, 0 };
258 uint8_t diag_edge[] = { 0, 0, 0, 0 };
259 uint8_t lfase =
CTB(
s->filter_slice_edges, x_ctb, y_ctb);
260 uint8_t no_tile_filter =
s->ps.pps->tiles_enabled_flag &&
261 !
s->ps.pps->loop_filter_across_tiles_enabled_flag;
262 uint8_t restore = no_tile_filter || !lfase;
263 uint8_t left_tile_edge = 0;
264 uint8_t right_tile_edge = 0;
265 uint8_t up_tile_edge = 0;
266 uint8_t bottom_tile_edge = 0;
268 edges[0] = x_ctb == 0;
269 edges[1] = y_ctb == 0;
270 edges[2] = x_ctb ==
s->ps.sps->ctb_width - 1;
271 edges[3] = y_ctb ==
s->ps.sps->ctb_height - 1;
275 left_tile_edge = no_tile_filter &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs-1]];
276 vert_edge[0] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb - 1, y_ctb)) || left_tile_edge;
279 right_tile_edge = no_tile_filter &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs+1]];
280 vert_edge[1] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb + 1, y_ctb)) || right_tile_edge;
283 up_tile_edge = no_tile_filter &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs -
s->ps.sps->ctb_width]];
284 horiz_edge[0] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb, y_ctb - 1)) || up_tile_edge;
287 bottom_tile_edge = no_tile_filter &&
s->ps.pps->tile_id[ctb_addr_ts] !=
s->ps.pps->tile_id[
s->ps.pps->ctb_addr_rs_to_ts[ctb_addr_rs +
s->ps.sps->ctb_width]];
288 horiz_edge[1] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb, y_ctb + 1)) || bottom_tile_edge;
290 if (!edges[0] && !edges[1]) {
291 diag_edge[0] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb - 1, y_ctb - 1)) || left_tile_edge || up_tile_edge;
293 if (!edges[1] && !edges[2]) {
294 diag_edge[1] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb + 1, y_ctb - 1)) || right_tile_edge || up_tile_edge;
296 if (!edges[2] && !edges[3]) {
297 diag_edge[2] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb + 1, y_ctb + 1)) || right_tile_edge || bottom_tile_edge;
299 if (!edges[0] && !edges[3]) {
300 diag_edge[3] = (!lfase &&
CTB(
s->tab_slice_address, x_ctb, y_ctb) !=
CTB(
s->tab_slice_address, x_ctb - 1, y_ctb + 1)) || left_tile_edge || bottom_tile_edge;
304 for (c_idx = 0; c_idx < (
s->ps.sps->chroma_format_idc ? 3 : 1); c_idx++) {
305 int x0 = x >>
s->ps.sps->hshift[c_idx];
306 int y0 = y >>
s->ps.sps->vshift[c_idx];
307 ptrdiff_t stride_src =
s->frame->linesize[c_idx];
308 int ctb_size_h = (1 << (
s->ps.sps->log2_ctb_size)) >>
s->ps.sps->hshift[c_idx];
309 int ctb_size_v = (1 << (
s->ps.sps->log2_ctb_size)) >>
s->ps.sps->vshift[c_idx];
310 int width =
FFMIN(ctb_size_h, (
s->ps.sps->width >>
s->ps.sps->hshift[c_idx]) - x0);
311 int height =
FFMIN(ctb_size_v, (
s->ps.sps->height >>
s->ps.sps->vshift[c_idx]) - y0);
313 uint8_t *
src = &
s->frame->data[c_idx][y0 * stride_src + (x0 <<
s->ps.sps->pixel_shift)];
314 ptrdiff_t stride_dst;
321 if (
s->ps.pps->transquant_bypass_enable_flag ||
322 (
s->ps.sps->pcm.loop_filter_disable_flag &&
s->ps.sps->pcm_enabled_flag)) {
326 s->hevcdsp.sao_band_filter[
tab](
src, dst, stride_src, stride_dst,
332 s->hevcdsp.sao_band_filter[
tab](
src,
src, stride_src, stride_src,
340 int w =
s->ps.sps->width >>
s->ps.sps->hshift[c_idx];
341 int h =
s->ps.sps->height >>
s->ps.sps->vshift[c_idx];
342 int left_edge = edges[0];
343 int top_edge = edges[1];
344 int right_edge = edges[2];
345 int bottom_edge = edges[3];
346 int sh =
s->ps.sps->pixel_shift;
347 int left_pixels, right_pixels;
353 int left = 1 - left_edge;
354 int right = 1 - right_edge;
355 const uint8_t *
src1[2];
359 dst1 = dst - stride_dst - (
left << sh);
361 src1[1] =
s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb - 1) *
w + x0 -
left) << sh);
364 src_idx = (
CTB(
s->sao, x_ctb-1, y_ctb-1).type_idx[c_idx] ==
369 src_idx = (
CTB(
s->sao, x_ctb, y_ctb-1).type_idx[c_idx] ==
374 src_idx = (
CTB(
s->sao, x_ctb+1, y_ctb-1).type_idx[c_idx] ==
380 int left = 1 - left_edge;
381 int right = 1 - right_edge;
382 const uint8_t *
src1[2];
386 dst1 = dst +
height * stride_dst - (
left << sh);
388 src1[1] =
s->sao_pixel_buffer_h[c_idx] + (((2 * y_ctb + 2) *
w + x0 -
left) << sh);
391 src_idx = (
CTB(
s->sao, x_ctb-1, y_ctb+1).type_idx[c_idx] ==
396 src_idx = (
CTB(
s->sao, x_ctb, y_ctb+1).type_idx[c_idx] ==
401 src_idx = (
CTB(
s->sao, x_ctb+1, y_ctb+1).type_idx[c_idx] ==
410 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb - 1) *
h + y0) << sh),
411 sh,
height, stride_dst, 1 << sh);
420 s->sao_pixel_buffer_v[c_idx] + (((2 * x_ctb + 2) *
h + y0) << sh),
421 sh,
height, stride_dst, 1 << sh);
428 src - (left_pixels << sh),
429 (
width + left_pixels + right_pixels) << sh,
430 height, stride_dst, stride_src);
436 s->hevcdsp.sao_edge_restore[restore](
src, dst,
437 stride_src, stride_dst,
455 int log2_min_pu_size =
s->ps.sps->log2_min_pu_size;
461 x_pu = x >> log2_min_pu_size;
462 y_pu = y >> log2_min_pu_size;
464 if (x_pu >=
s->ps.sps->min_pu_width || y_pu >=
s->ps.sps->min_pu_height)
466 return s->is_pcm[y_pu *
s->ps.sps->min_pu_width + x_pu];
469 #define TC_CALC(qp, bs) \
470 tctable[av_clip((qp) + DEFAULT_INTRA_TC_OFFSET * ((bs) - 1) + \
472 0, MAX_QP + DEFAULT_INTRA_TC_OFFSET)]
480 uint8_t no_p[2] = { 0 };
481 uint8_t no_q[2] = { 0 };
483 int log2_ctb_size =
s->ps.sps->log2_ctb_size;
484 int x_end, x_end2, y_end;
485 int ctb_size = 1 << log2_ctb_size;
486 int ctb = (x0 >> log2_ctb_size) +
487 (y0 >> log2_ctb_size) *
s->ps.sps->ctb_width;
488 int cur_tc_offset =
s->deblock[ctb].tc_offset;
489 int cur_beta_offset =
s->deblock[ctb].beta_offset;
490 int left_tc_offset, left_beta_offset;
491 int tc_offset, beta_offset;
492 int pcmf = (
s->ps.sps->pcm_enabled_flag &&
493 s->ps.sps->pcm.loop_filter_disable_flag) ||
494 s->ps.pps->transquant_bypass_enable_flag;
497 left_tc_offset =
s->deblock[ctb - 1].tc_offset;
498 left_beta_offset =
s->deblock[ctb - 1].beta_offset;
501 left_beta_offset = 0;
504 x_end = x0 + ctb_size;
505 if (x_end >
s->ps.sps->width)
506 x_end =
s->ps.sps->width;
507 y_end = y0 + ctb_size;
508 if (y_end >
s->ps.sps->height)
509 y_end =
s->ps.sps->height;
511 tc_offset = cur_tc_offset;
512 beta_offset = cur_beta_offset;
515 if (x_end2 !=
s->ps.sps->width)
517 for (y = y0; y < y_end; y += 8) {
519 for (x = x0 ? x0 : 8; x < x_end; x += 8) {
520 const int bs0 =
s->vertical_bs[(x + y *
s->bs_width) >> 2];
521 const int bs1 =
s->vertical_bs[(x + (y + 4) *
s->bs_width) >> 2];
529 src = &
s->frame->data[
LUMA][y *
s->frame->linesize[
LUMA] + (x <<
s->ps.sps->pixel_shift)];
535 s->hevcdsp.hevc_v_loop_filter_luma_c(
src,
536 s->frame->linesize[
LUMA],
537 beta,
tc, no_p, no_q);
539 s->hevcdsp.hevc_v_loop_filter_luma(
src,
540 s->frame->linesize[
LUMA],
541 beta,
tc, no_p, no_q);
549 for (x = x0 ? x0 - 8 : 0; x < x_end2; x += 8) {
550 const int bs0 =
s->horizontal_bs[( x + y *
s->bs_width) >> 2];
551 const int bs1 =
s->horizontal_bs[((x + 4) + y *
s->bs_width) >> 2];
555 tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
556 beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
561 src = &
s->frame->data[
LUMA][y *
s->frame->linesize[
LUMA] + (x <<
s->ps.sps->pixel_shift)];
567 s->hevcdsp.hevc_h_loop_filter_luma_c(
src,
568 s->frame->linesize[
LUMA],
569 beta,
tc, no_p, no_q);
571 s->hevcdsp.hevc_h_loop_filter_luma(
src,
572 s->frame->linesize[
LUMA],
573 beta,
tc, no_p, no_q);
578 if (
s->ps.sps->chroma_format_idc) {
580 int h = 1 <<
s->ps.sps->hshift[
chroma];
581 int v = 1 <<
s->ps.sps->vshift[
chroma];
584 for (y = y0; y < y_end; y += (8 * v)) {
585 for (x = x0 ? x0 : 8 *
h; x < x_end; x += (8 *
h)) {
586 const int bs0 =
s->vertical_bs[(x + y *
s->bs_width) >> 2];
587 const int bs1 =
s->vertical_bs[(x + (y + (4 * v)) *
s->bs_width) >> 2];
589 if ((bs0 == 2) || (bs1 == 2)) {
591 const int qp1 = (
get_qPy(
s, x - 1, y + (4 * v)) +
get_qPy(
s, x, y + (4 * v)) + 1) >> 1;
595 src = &
s->frame->data[
chroma][(y >>
s->ps.sps->vshift[
chroma]) *
s->frame->linesize[
chroma] + ((x >>
s->ps.sps->hshift[
chroma]) <<
s->ps.sps->pixel_shift)];
598 no_p[1] =
get_pcm(
s, x - 1, y + (4 * v));
600 no_q[1] =
get_pcm(
s, x, y + (4 * v));
601 s->hevcdsp.hevc_v_loop_filter_chroma_c(
src,
605 s->hevcdsp.hevc_v_loop_filter_chroma(
src,
615 tc_offset = x0 ? left_tc_offset : cur_tc_offset;
617 if (x_end !=
s->ps.sps->width)
618 x_end2 = x_end - 8 *
h;
619 for (x = x0 ? x0 - 8 *
h : 0; x < x_end2; x += (8 *
h)) {
620 const int bs0 =
s->horizontal_bs[( x + y *
s->bs_width) >> 2];
621 const int bs1 =
s->horizontal_bs[((x + 4 *
h) + y *
s->bs_width) >> 2];
622 if ((bs0 == 2) || (bs1 == 2)) {
623 const int qp0 = bs0 == 2 ? (
get_qPy(
s, x, y - 1) +
get_qPy(
s, x, y) + 1) >> 1 : 0;
624 const int qp1 = bs1 == 2 ? (
get_qPy(
s, x + (4 *
h), y - 1) +
get_qPy(
s, x + (4 *
h), y) + 1) >> 1 : 0;
628 src = &
s->frame->data[
chroma][(y >>
s->ps.sps->vshift[1]) *
s->frame->linesize[
chroma] + ((x >>
s->ps.sps->hshift[1]) <<
s->ps.sps->pixel_shift)];
631 no_p[1] =
get_pcm(
s, x + (4 *
h), y - 1);
634 s->hevcdsp.hevc_h_loop_filter_chroma_c(
src,
638 s->hevcdsp.hevc_h_loop_filter_chroma(
src,
653 if (
s->ref->refPicList[0].list[curr->
ref_idx[0]] == neigh_refPicList[0].
list[neigh->
ref_idx[0]] &&
654 s->ref->refPicList[0].list[curr->
ref_idx[0]] ==
s->ref->refPicList[1].list[curr->
ref_idx[1]] &&
663 }
else if (neigh_refPicList[0].
list[neigh->
ref_idx[0]] ==
s->ref->refPicList[0].list[curr->
ref_idx[0]] &&
664 neigh_refPicList[1].
list[neigh->
ref_idx[1]] ==
s->ref->refPicList[1].list[curr->
ref_idx[1]]) {
670 }
else if (neigh_refPicList[1].
list[neigh->
ref_idx[1]] ==
s->ref->refPicList[0].list[curr->
ref_idx[0]] &&
671 neigh_refPicList[0].
list[neigh->
ref_idx[0]] ==
s->ref->refPicList[1].list[curr->
ref_idx[1]]) {
686 ref_A =
s->ref->refPicList[0].list[curr->
ref_idx[0]];
689 ref_A =
s->ref->refPicList[1].list[curr->
ref_idx[1]];
694 ref_B = neigh_refPicList[0].
list[neigh->
ref_idx[0]];
697 ref_B = neigh_refPicList[1].
list[neigh->
ref_idx[1]];
700 if (ref_A == ref_B) {
717 int log2_min_pu_size =
s->ps.sps->log2_min_pu_size;
718 int log2_min_tu_size =
s->ps.sps->log2_min_tb_size;
719 int min_pu_width =
s->ps.sps->min_pu_width;
720 int min_tu_width =
s->ps.sps->min_tb_width;
721 int is_intra = tab_mvf[(y0 >> log2_min_pu_size) * min_pu_width +
723 int boundary_upper, boundary_left;
726 boundary_upper = y0 > 0 && !(y0 & 7);
727 if (boundary_upper &&
728 ((!
s->sh.slice_loop_filter_across_slices_enabled_flag &&
730 (y0 % (1 <<
s->ps.sps->log2_ctb_size)) == 0) ||
731 (!
s->ps.pps->loop_filter_across_tiles_enabled_flag &&
733 (y0 % (1 <<
s->ps.sps->log2_ctb_size)) == 0)))
736 if (boundary_upper) {
740 int yp_pu = (y0 - 1) >> log2_min_pu_size;
741 int yq_pu = y0 >> log2_min_pu_size;
742 int yp_tu = (y0 - 1) >> log2_min_tu_size;
743 int yq_tu = y0 >> log2_min_tu_size;
745 for (
i = 0;
i < (1 << log2_trafo_size);
i += 4) {
746 int x_pu = (x0 +
i) >> log2_min_pu_size;
747 int x_tu = (x0 +
i) >> log2_min_tu_size;
748 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
749 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
750 uint8_t top_cbf_luma =
s->cbf_luma[yp_tu * min_tu_width + x_tu];
751 uint8_t curr_cbf_luma =
s->cbf_luma[yq_tu * min_tu_width + x_tu];
755 else if (curr_cbf_luma || top_cbf_luma)
759 s->horizontal_bs[((x0 +
i) + y0 *
s->bs_width) >> 2] = bs;
764 boundary_left = x0 > 0 && !(x0 & 7);
766 ((!
s->sh.slice_loop_filter_across_slices_enabled_flag &&
768 (x0 % (1 <<
s->ps.sps->log2_ctb_size)) == 0) ||
769 (!
s->ps.pps->loop_filter_across_tiles_enabled_flag &&
771 (x0 % (1 <<
s->ps.sps->log2_ctb_size)) == 0)))
778 int xp_pu = (x0 - 1) >> log2_min_pu_size;
779 int xq_pu = x0 >> log2_min_pu_size;
780 int xp_tu = (x0 - 1) >> log2_min_tu_size;
781 int xq_tu = x0 >> log2_min_tu_size;
783 for (
i = 0;
i < (1 << log2_trafo_size);
i += 4) {
784 int y_pu = (y0 +
i) >> log2_min_pu_size;
785 int y_tu = (y0 +
i) >> log2_min_tu_size;
786 MvField *
left = &tab_mvf[y_pu * min_pu_width + xp_pu];
787 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
788 uint8_t left_cbf_luma =
s->cbf_luma[y_tu * min_tu_width + xp_tu];
789 uint8_t curr_cbf_luma =
s->cbf_luma[y_tu * min_tu_width + xq_tu];
793 else if (curr_cbf_luma || left_cbf_luma)
797 s->vertical_bs[(x0 + (y0 +
i) *
s->bs_width) >> 2] = bs;
801 if (log2_trafo_size > log2_min_pu_size && !is_intra) {
805 for (j = 8; j < (1 << log2_trafo_size); j += 8) {
806 int yp_pu = (y0 + j - 1) >> log2_min_pu_size;
807 int yq_pu = (y0 + j) >> log2_min_pu_size;
809 for (
i = 0;
i < (1 << log2_trafo_size);
i += 4) {
810 int x_pu = (x0 +
i) >> log2_min_pu_size;
811 MvField *top = &tab_mvf[yp_pu * min_pu_width + x_pu];
812 MvField *curr = &tab_mvf[yq_pu * min_pu_width + x_pu];
815 s->horizontal_bs[((x0 +
i) + (y0 + j) *
s->bs_width) >> 2] = bs;
820 for (j = 0; j < (1 << log2_trafo_size); j += 4) {
821 int y_pu = (y0 + j) >> log2_min_pu_size;
823 for (
i = 8;
i < (1 << log2_trafo_size);
i += 8) {
824 int xp_pu = (x0 +
i - 1) >> log2_min_pu_size;
825 int xq_pu = (x0 +
i) >> log2_min_pu_size;
826 MvField *
left = &tab_mvf[y_pu * min_pu_width + xp_pu];
827 MvField *curr = &tab_mvf[y_pu * min_pu_width + xq_pu];
830 s->vertical_bs[((x0 +
i) + (y0 + j) *
s->bs_width) >> 2] = bs;
842 int x_end = x >=
s->ps.sps->width - ctb_size;
856 if (
s->ps.sps->sao_enabled && !skip) {
857 int y_end = y >=
s->ps.sps->height - ctb_size;
867 if (x_end && y_end) {
878 int x_end = x_ctb >=
s->ps.sps->width - ctb_size;
879 int y_end = y_ctb >=
s->ps.sps->height - ctb_size;