26 # define FUNC(n) AV_JOIN(n ## _simple_, BITS)
27 # define PIXEL_SHIFT (BITS >> 4)
29 # define FUNC(n) n ## _complex
30 # define PIXEL_SHIFT h->pixel_shift
44 const int mb_x = s->
mb_x;
45 const int mb_y = s->
mb_y;
46 const int mb_xy = h->mb_xy;
48 uint8_t *dest_y, *dest_cb, *dest_cr;
49 int linesize, uvlinesize ;
52 const int transform_bypass = !
SIMPLE && (s->
qscale == 0 && h->sps.transform_bypass);
66 h->list_counts[
mb_xy] = h->list_count;
69 linesize = h->mb_linesize = s->
linesize * 2;
70 uvlinesize = h->mb_uvlinesize = s->
uvlinesize * 2;
71 block_offset = &h->block_offset[48];
79 for (list = 0; list < h->list_count; list++) {
83 int8_t *ref = &h->ref_cache[list][
scan8[0]];
86 for (i = 0; i < 16; i += 4) {
87 int ref = h->ref_cache[list][
scan8[i]];
90 8, (16 + ref) ^ (s->
mb_y & 1), 1);
96 linesize = h->mb_linesize = s->
linesize;
103 const int bit_depth = h->sps.bit_depth_luma;
109 for (i = 0; i < 16; i++) {
110 uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
111 for (j = 0; j < 16; j++)
112 tmp_y[j] =
get_bits(&gb, bit_depth);
115 if (!h->sps.chroma_format_idc) {
116 for (i = 0; i < block_h; i++) {
117 uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
118 for (j = 0; j < 8; j++)
119 tmp_cb[j] = 1 << (bit_depth - 1);
121 for (i = 0; i < block_h; i++) {
122 uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
123 for (j = 0; j < 8; j++)
124 tmp_cr[j] = 1 << (bit_depth - 1);
127 for (i = 0; i < block_h; i++) {
128 uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
129 for (j = 0; j < 8; j++)
130 tmp_cb[j] =
get_bits(&gb, bit_depth);
132 for (i = 0; i < block_h; i++) {
133 uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
134 for (j = 0; j < 8; j++)
135 tmp_cr[j] =
get_bits(&gb, bit_depth);
140 for (i = 0; i < 16; i++)
141 memcpy(dest_y + i * linesize, (
uint8_t *)h->mb + i * 16, 16);
143 if (!h->sps.chroma_format_idc) {
144 for (i = 0; i < block_h; i++) {
145 memset(dest_cb + i * uvlinesize, 128, 8);
146 memset(dest_cr + i * uvlinesize, 128, 8);
151 for (i = 0; i < block_h; i++) {
152 memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
153 memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
160 if (h->deblocking_filter)
165 h->hpc.pred8x8[h->chroma_pred_mode](dest_cb, uvlinesize);
166 h->hpc.pred8x8[h->chroma_pred_mode](dest_cr, uvlinesize);
171 block_offset, linesize, dest_y, 0);
173 if (h->deblocking_filter)
176 }
else if (is_h264) {
178 FUNC(hl_motion_422)(h, dest_y, dest_cb, dest_cr,
181 h->h264dsp.weight_h264_pixels_tab,
182 h->h264dsp.biweight_h264_pixels_tab);
184 FUNC(hl_motion_420)(h, dest_y, dest_cb, dest_cr,
187 h->h264dsp.weight_h264_pixels_tab,
188 h->h264dsp.biweight_h264_pixels_tab);
197 uint8_t *dest[2] = { dest_cb, dest_cr };
198 if (transform_bypass) {
199 if (
IS_INTRA(mb_type) && h->sps.profile_idc == 244 &&
202 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[0],
206 h->hpc.pred8x8_add[h->chroma_pred_mode](dest[1],
212 for (j = 1; j < 3; j++) {
213 for (i = j * 16; i < j * 16 + 4; i++)
214 if (h->non_zero_count_cache[
scan8[i]] ||
216 idct_add(dest[j - 1] + block_offset[i],
220 for (i = j * 16 + 4; i < j * 16 + 8; i++)
221 if (h->non_zero_count_cache[
scan8[i + 4]] ||
223 idct_add(dest[j - 1] + block_offset[i + 4],
233 qp[0] = h->chroma_qp[0] + 3;
234 qp[1] = h->chroma_qp[1] + 3;
236 qp[0] = h->chroma_qp[0];
237 qp[1] = h->chroma_qp[1];
240 h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 1 <<
PIXEL_SHIFT),
241 h->dequant4_coeff[
IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
243 h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + (16 * 16 * 2 <<
PIXEL_SHIFT),
244 h->dequant4_coeff[
IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
245 h->h264dsp.h264_idct_add8(dest, block_offset,
247 h->non_zero_count_cache);
249 h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 1,
250 h->dequant4_coeff[
IS_INTRA(mb_type) ? 1 : 4][h->chroma_qp[0]][0]);
251 h->h264dsp.h264_chroma_dc_dequant_idct(h->mb + 16 * 16 * 2,
252 h->dequant4_coeff[
IS_INTRA(mb_type) ? 2 : 5][h->chroma_qp[1]][0]);
253 for (j = 1; j < 3; j++) {
254 for (i = j * 16; i < j * 16 + 4; i++)
255 if (h->non_zero_count_cache[
scan8[i]] || h->mb[i * 16]) {
256 uint8_t *
const ptr = dest[j - 1] + block_offset[i];
272 #if !SIMPLE || BITS == 8
281 const int mb_x = s->
mb_x;
282 const int mb_y = s->
mb_y;
283 const int mb_xy = h->mb_xy;
289 const int transform_bypass = !
SIMPLE && (s->
qscale == 0 && h->sps.transform_bypass);
292 for (p = 0; p < plane_count; p++) {
299 h->list_counts[
mb_xy] = h->list_count;
302 linesize = h->mb_linesize = h->mb_uvlinesize = s->
linesize * 2;
303 block_offset = &h->block_offset[48];
305 for (p = 0; p < 3; p++)
309 for (list = 0; list < h->list_count; list++) {
313 int8_t *ref = &h->ref_cache[list][
scan8[0]];
316 for (i = 0; i < 16; i += 4) {
317 int ref = h->ref_cache[list][
scan8[i]];
320 8, (16 + ref) ^ (s->
mb_y & 1), 1);
326 linesize = h->mb_linesize = h->mb_uvlinesize = s->
linesize;
331 const int bit_depth = h->sps.bit_depth_luma;
335 for (p = 0; p < plane_count; p++)
336 for (i = 0; i < 16; i++) {
337 uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize);
338 for (j = 0; j < 16; j++)
342 for (p = 0; p < plane_count; p++)
343 for (i = 0; i < 16; i++)
344 memcpy(dest[p] + i * linesize,
345 (
uint8_t *)h->mb + p * 256 + i * 16, 16);
349 if (h->deblocking_filter)
353 for (p = 0; p < plane_count; p++)
356 block_offset, linesize, dest[p], p);
358 if (h->deblocking_filter)
362 FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2],
365 h->h264dsp.weight_h264_pixels_tab,
366 h->h264dsp.biweight_h264_pixels_tab);
369 for (p = 0; p < plane_count; p++)