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++)
void(* prefetch)(uint8_t *buf, ptrdiff_t stride, int h)
Prefetch memory into cache (if supported by hardware).
static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass, int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define CONFIG_SVQ3_DECODER
static av_always_inline int dctcoef_get(DCTELEM *mb, int high_bit_depth, int index)
void ff_svq3_add_idct_c(uint8_t *dst, DCTELEM *block, int stride, int qp, int dc)
#define USES_LIST(a, list)
does this mb use listX, note does not work if subMBs
static av_always_inline void hl_decode_mb_idct_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass, int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p)
h264_chroma_mc_func avg_h264_chroma_pixels_tab[3]
qpel_mc_func(* qpel_put)[16]
Picture current_picture
copy of the current picture structure.
static av_noinline void FUNC() hl_decode_mb_444(H264Context *h)
const uint8_t ff_h264_chroma_qp[3][QP_MAX_NUM+1]
One chroma qp table for each supported bit depth (8, 9, 10).
#define CHROMA_DC_BLOCK_INDEX
h264_chroma_mc_func put_h264_chroma_pixels_tab[3]
h264 Chroma MC
static const uint8_t scan8[16 *3+3]
static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int xchg, int chroma444, int simple, int pixel_shift)
static void fill_rectangle(SDL_Surface *screen, int x, int y, int w, int h, int color)
static void idct_add(uint8_t *dest, int line_size, DCTELEM *block)
uint32_t * mb_type
macroblock type table mb_type_base + mb_width + 2
static void(WINAPI *cond_broadcast)(pthread_cond_t *cond)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
DSPContext dsp
pointers for accelerated dsp functions
int block_offset[2 *(16 *3)]
block_offset[ 0..23] for frame macroblocks block_offset[24..47] for field macroblocks ...
static av_noinline void FUNC() hl_decode_mb(H264Context *h)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
qpel_mc_func(* qpel_avg)[16]
void(* clear_blocks)(DCTELEM *blocks)
const uint16_t ff_h264_mb_sizes[4]
void(* add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size)
int linesize
line size, in bytes, may be different from width
int flags
AVCodecContext.flags (HQ, MV4, ...)
int uvlinesize
line size, for chroma in bytes, may be different from width
if(!(ptr_align%ac->ptr_align)&&samples_align >=aligned_len)