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 43 const int mb_x = sl->mb_x;
44 const int mb_y = sl->mb_y;
45 const int mb_xy = sl->mb_xy;
46 const int mb_type =
h->cur_pic.mb_type[mb_xy];
47 uint8_t *dest_y, *dest_cb, *dest_cr;
48 int linesize, uvlinesize ;
50 const int *block_offset = &
h->block_offset[0];
51 const int transform_bypass = !
SIMPLE && (sl->qscale == 0 &&
h->ps.sps->transform_bypass);
53 const int block_h = 16 >>
h->chroma_y_shift;
56 dest_y =
h->cur_pic.f->data[0] + ((mb_x <<
PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
57 dest_cb =
h->cur_pic.f->data[1] + (mb_x <<
PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
58 dest_cr =
h->cur_pic.f->data[2] + (mb_x <<
PIXEL_SHIFT) * 8 + mb_y * sl->uvlinesize * block_h;
60 h->vdsp.prefetch(dest_y + (sl->mb_x & 3) * 4 * sl->linesize + (64 <<
PIXEL_SHIFT), sl->linesize, 4);
61 h->vdsp.prefetch(dest_cb + (sl->mb_x & 7) * sl->uvlinesize + (64 <<
PIXEL_SHIFT), dest_cr - dest_cb, 2);
63 h->list_counts[mb_xy] = sl->list_count;
66 linesize = sl->mb_linesize = sl->linesize * 2;
67 uvlinesize = sl->mb_uvlinesize = sl->uvlinesize * 2;
68 block_offset = &
h->block_offset[48];
70 dest_y -= sl->linesize * 15;
71 dest_cb -= sl->uvlinesize * (block_h - 1);
72 dest_cr -= sl->uvlinesize * (block_h - 1);
76 for (list = 0; list < sl->list_count; list++) {
83 for (i = 0; i < 16; i += 4) {
87 8, (16 + ref) ^ (sl->mb_y & 1), 1);
93 linesize = sl->mb_linesize = sl->linesize;
94 uvlinesize = sl->mb_uvlinesize = sl->uvlinesize;
99 const int bit_depth =
h->ps.sps->bit_depth_luma;
106 for (i = 0; i < 16; i++) {
107 uint16_t *tmp_y = (uint16_t *)(dest_y + i * linesize);
108 for (j = 0; j < 16; j++)
109 tmp_y[j] =
get_bits(&gb, bit_depth);
112 if (!
h->ps.sps->chroma_format_idc) {
113 for (i = 0; i < block_h; i++) {
114 uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
115 uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
116 for (j = 0; j < 8; j++) {
117 tmp_cb[j] = tmp_cr[j] = 1 << (bit_depth - 1);
121 for (i = 0; i < block_h; i++) {
122 uint16_t *tmp_cb = (uint16_t *)(dest_cb + i * uvlinesize);
123 for (j = 0; j < 8; j++)
124 tmp_cb[j] =
get_bits(&gb, bit_depth);
126 for (i = 0; i < block_h; i++) {
127 uint16_t *tmp_cr = (uint16_t *)(dest_cr + i * uvlinesize);
128 for (j = 0; j < 8; j++)
129 tmp_cr[j] =
get_bits(&gb, bit_depth);
134 for (i = 0; i < 16; i++)
135 memcpy(dest_y + i * linesize, sl->intra_pcm_ptr + i * 16, 16);
137 if (!
h->ps.sps->chroma_format_idc) {
138 for (i = 0; i < 8; i++) {
139 memset(dest_cb + i * uvlinesize, 1 << (bit_depth - 1), 8);
140 memset(dest_cr + i * uvlinesize, 1 << (bit_depth - 1), 8);
143 const uint8_t *src_cb = sl->intra_pcm_ptr + 256;
144 const uint8_t *src_cr = sl->intra_pcm_ptr + 256 + block_h * 8;
145 for (i = 0; i < block_h; i++) {
146 memcpy(dest_cb + i * uvlinesize, src_cb + i * 8, 8);
147 memcpy(dest_cr + i * uvlinesize, src_cr + i * 8, 8);
154 if (sl->deblocking_filter)
159 h->hpc.pred8x8[sl->chroma_pred_mode](dest_cb, uvlinesize);
160 h->hpc.pred8x8[sl->chroma_pred_mode](dest_cr, uvlinesize);
165 block_offset, linesize, dest_y, 0);
167 if (sl->deblocking_filter)
172 FUNC(hl_motion_422)(
h, sl, dest_y, dest_cb, dest_cr,
173 h->h264qpel.put_h264_qpel_pixels_tab,
174 h->h264chroma.put_h264_chroma_pixels_tab,
175 h->h264qpel.avg_h264_qpel_pixels_tab,
176 h->h264chroma.avg_h264_chroma_pixels_tab,
177 h->h264dsp.weight_h264_pixels_tab,
178 h->h264dsp.biweight_h264_pixels_tab);
180 FUNC(hl_motion_420)(
h, sl, dest_y, dest_cb, dest_cr,
181 h->h264qpel.put_h264_qpel_pixels_tab,
182 h->h264chroma.put_h264_chroma_pixels_tab,
183 h->h264qpel.avg_h264_qpel_pixels_tab,
184 h->h264chroma.avg_h264_chroma_pixels_tab,
185 h->h264dsp.weight_h264_pixels_tab,
186 h->h264dsp.biweight_h264_pixels_tab);
195 uint8_t *dest[2] = { dest_cb, dest_cr };
196 if (transform_bypass) {
197 if (
IS_INTRA(mb_type) &&
h->ps.sps->profile_idc == 244 &&
200 h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[0],
204 h->hpc.pred8x8_add[sl->chroma_pred_mode](dest[1],
209 idct_add =
h->h264dsp.h264_add_pixels4_clear;
210 for (j = 1; j < 3; j++) {
211 for (i = j * 16; i < j * 16 + 4; i++)
212 if (sl->non_zero_count_cache[
scan8[i]] ||
214 idct_add(dest[j - 1] + block_offset[i],
218 for (i = j * 16 + 4; i < j * 16 + 8; i++)
219 if (sl->non_zero_count_cache[
scan8[i + 4]] ||
221 idct_add(dest[j - 1] + block_offset[i + 4],
230 qp[0] = sl->chroma_qp[0] + 3;
231 qp[1] = sl->chroma_qp[1] + 3;
233 qp[0] = sl->chroma_qp[0];
234 qp[1] = sl->chroma_qp[1];
237 h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 1 <<
PIXEL_SHIFT),
238 h->ps.pps->dequant4_coeff[
IS_INTRA(mb_type) ? 1 : 4][qp[0]][0]);
240 h->h264dsp.h264_chroma_dc_dequant_idct(sl->mb + (16 * 16 * 2 <<
PIXEL_SHIFT),
241 h->ps.pps->dequant4_coeff[
IS_INTRA(mb_type) ? 2 : 5][qp[1]][0]);
242 h->h264dsp.h264_idct_add8(dest, block_offset,
244 sl->non_zero_count_cache);
250 #if !SIMPLE || BITS == 8 258 const int mb_x = sl->mb_x;
259 const int mb_y = sl->mb_y;
260 const int mb_xy = sl->mb_xy;
261 const int mb_type =
h->cur_pic.mb_type[mb_xy];
265 const int *block_offset = &
h->block_offset[0];
266 const int transform_bypass = !
SIMPLE && (sl->qscale == 0 &&
h->ps.sps->transform_bypass);
269 for (p = 0; p < plane_count; p++) {
270 dest[p] =
h->cur_pic.f->data[p] +
271 ((mb_x <<
PIXEL_SHIFT) + mb_y * sl->linesize) * 16;
272 h->vdsp.prefetch(dest[p] + (sl->mb_x & 3) * 4 * sl->linesize + (64 <<
PIXEL_SHIFT),
276 h->list_counts[mb_xy] = sl->list_count;
279 linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize * 2;
280 block_offset = &
h->block_offset[48];
282 for (p = 0; p < 3; p++)
283 dest[p] -= sl->linesize * 15;
286 for (list = 0; list < sl->list_count; list++) {
293 for (i = 0; i < 16; i += 4) {
297 8, (16 + ref) ^ (sl->mb_y & 1), 1);
303 linesize = sl->mb_linesize = sl->mb_uvlinesize = sl->linesize;
308 const int bit_depth =
h->ps.sps->bit_depth_luma;
312 for (p = 0; p < plane_count; p++)
313 for (i = 0; i < 16; i++) {
314 uint16_t *
tmp = (uint16_t *)(dest[p] + i * linesize);
315 for (j = 0; j < 16; j++)
319 for (p = 0; p < plane_count; p++)
320 for (i = 0; i < 16; i++)
321 memcpy(dest[p] + i * linesize,
322 sl->intra_pcm_ptr + p * 256 + i * 16, 16);
326 if (sl->deblocking_filter)
330 for (p = 0; p < plane_count; p++)
333 block_offset, linesize, dest[p], p);
335 if (sl->deblocking_filter)
339 FUNC(hl_motion_444)(
h, sl, dest[0], dest[1], dest[2],
340 h->h264qpel.put_h264_qpel_pixels_tab,
341 h->h264chroma.put_h264_chroma_pixels_tab,
342 h->h264qpel.avg_h264_qpel_pixels_tab,
343 h->h264chroma.avg_h264_chroma_pixels_tab,
344 h->h264dsp.weight_h264_pixels_tab,
345 h->h264dsp.biweight_h264_pixels_tab);
348 for (p = 0; p < plane_count; p++)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void idct_add(uint8_t *dst, int stride, const uint8_t *src, int in_linesize, int *block)
#define USES_LIST(a, list)
The exact code depends on how similar the blocks are and how related they are to the block
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static void bit_depth(AudioStatsContext *s, uint64_t mask, uint64_t imask, AVRational *depth)
static av_always_inline void hl_decode_mb_idct_luma(const H264Context *h, H264SliceContext *sl, int mb_type, int simple, int transform_bypass, int pixel_shift, const int *block_offset, int linesize, uint8_t *dest_y, int p)
#define CHROMA_DC_BLOCK_INDEX
static void fill_rectangle(int x, int y, int w, int h)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
static av_always_inline int dctcoef_get(int16_t *mb, int high_bit_depth, int index)
static const uint8_t scan8[16 *3+3]
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static av_always_inline void xchg_mb_border(const H264Context *h, H264SliceContext *sl, 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 av_always_inline void hl_decode_mb_predict_luma(const H264Context *h, H264SliceContext *sl, int mb_type, int simple, int transform_bypass, int pixel_shift, const int *block_offset, int linesize, uint8_t *dest_y, int p)
static int ref[MAX_W *MAX_W]
static av_noinline void FUNC() hl_decode_mb(const H264Context *h, H264SliceContext *sl)
static av_noinline void FUNC() hl_decode_mb_444(const H264Context *h, H264SliceContext *sl)
const uint16_t ff_h264_mb_sizes[4]