FFmpeg
dsp_template.c
Go to the documentation of this file.
1 /*
2  * HEVC video decoder
3  *
4  * Copyright (C) 2012 - 2013 Guillaume Martres
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 #include "get_bits.h"
24 #include "hevcdec.h"
25 
26 #include "bit_depth_template.c"
27 #include "dsp.h"
30 
31 static void FUNC(put_pcm)(uint8_t *_dst, ptrdiff_t stride, int width, int height,
32  GetBitContext *gb, int pcm_bit_depth)
33 {
34  int x, y;
35  pixel *dst = (pixel *)_dst;
36 
37  stride /= sizeof(pixel);
38 
39  for (y = 0; y < height; y++) {
40  for (x = 0; x < width; x++)
41  dst[x] = get_bits(gb, pcm_bit_depth) << (BIT_DEPTH - pcm_bit_depth);
42  dst += stride;
43  }
44 }
45 
46 static av_always_inline void FUNC(add_residual)(uint8_t *_dst, const int16_t *res,
47  ptrdiff_t stride, int size)
48 {
49  int x, y;
50  pixel *dst = (pixel *)_dst;
51 
52  stride /= sizeof(pixel);
53 
54  for (y = 0; y < size; y++) {
55  for (x = 0; x < size; x++) {
56  dst[x] = av_clip_pixel(dst[x] + *res);
57  res++;
58  }
59  dst += stride;
60  }
61 }
62 
63 static void FUNC(add_residual4x4)(uint8_t *_dst, const int16_t *res,
64  ptrdiff_t stride)
65 {
66  FUNC(add_residual)(_dst, res, stride, 4);
67 }
68 
69 static void FUNC(add_residual8x8)(uint8_t *_dst, const int16_t *res,
70  ptrdiff_t stride)
71 {
72  FUNC(add_residual)(_dst, res, stride, 8);
73 }
74 
75 static void FUNC(add_residual16x16)(uint8_t *_dst, const int16_t *res,
76  ptrdiff_t stride)
77 {
78  FUNC(add_residual)(_dst, res, stride, 16);
79 }
80 
81 static void FUNC(add_residual32x32)(uint8_t *_dst, const int16_t *res,
82  ptrdiff_t stride)
83 {
84  FUNC(add_residual)(_dst, res, stride, 32);
85 }
86 
87 static void FUNC(transform_rdpcm)(int16_t *_coeffs, int16_t log2_size, int mode)
88 {
89  int16_t *coeffs = (int16_t *) _coeffs;
90  int x, y;
91  int size = 1 << log2_size;
92 
93  if (mode) {
94  coeffs += size;
95  for (y = 0; y < size - 1; y++) {
96  for (x = 0; x < size; x++)
97  coeffs[x] += coeffs[x - size];
98  coeffs += size;
99  }
100  } else {
101  for (y = 0; y < size; y++) {
102  for (x = 1; x < size; x++)
103  coeffs[x] += coeffs[x - 1];
104  coeffs += size;
105  }
106  }
107 }
108 
109 /**
110  * HEVC transform dequantization (ITU-T H.265 8.6.3)
111  *
112  * @param coeffs transform coefficient buffer (in-place)
113  * @param log2_size log2 of transform block size, range: 2..5 (4x4 to 32x32)
114  * This value comes from recursive split_transform_flag parsing
115  * in the bitstream, bounded by log2_min_tb_size (min 2) and
116  * log2_max_trafo_size (max 5) from SPS.
117  *
118  * Formula: shift = 15 - BIT_DEPTH - log2_size
119  *
120  * bit_depth | 4x4 (2) | 8x8 (3) | 16x16 (4) | 32x32 (5)
121  * ----------+---------+---------+-----------+----------
122  * 8-bit | 5 | 4 | 3 | 2 (shift right)
123  * 10-bit | 3 | 2 | 1 | 0 (shift right / no-op)
124  * 12-bit | 1 | 0 | -1 | -2 (shift right / no-op / shift left)
125  *
126  * When shift == 0, output equals input (identity transform), so we skip
127  * the loop entirely for better performance.
128  */
129 static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size)
130 {
131  int shift = 15 - BIT_DEPTH - log2_size;
132  int x, y;
133  int size = 1 << log2_size;
134 
135  if (shift > 0) {
136  int offset = 1 << (shift - 1);
137  for (y = 0; y < size; y++) {
138  for (x = 0; x < size; x++) {
139  *coeffs = (*coeffs + offset) >> shift;
140  coeffs++;
141  }
142  }
143  } else if (shift < 0) {
144  for (y = 0; y < size; y++) {
145  for (x = 0; x < size; x++) {
146  *coeffs = *(uint16_t*)coeffs << -shift;
147  coeffs++;
148  }
149  }
150  }
151  /* shift == 0: no operation needed (identity transform) */
152 }
153 
154 #define SET(dst, x) (dst) = (x)
155 #define SCALE(dst, x) (dst) = av_clip_int16(((x) + add) >> shift)
156 
157 #define TR_4x4_LUMA(dst, src, step, assign) \
158  do { \
159  int c0 = src[0 * step] + src[2 * step]; \
160  int c1 = src[2 * step] + src[3 * step]; \
161  int c2 = src[0 * step] - src[3 * step]; \
162  int c3 = 74 * src[1 * step]; \
163  \
164  assign(dst[2 * step], 74 * (src[0 * step] - \
165  src[2 * step] + \
166  src[3 * step])); \
167  assign(dst[0 * step], 29 * c0 + 55 * c1 + c3); \
168  assign(dst[1 * step], 55 * c2 - 29 * c1 + c3); \
169  assign(dst[3 * step], 55 * c0 + 29 * c2 - c3); \
170  } while (0)
171 
172 static void FUNC(transform_4x4_luma)(int16_t *coeffs)
173 {
174  int i;
175  int shift = 7;
176  int add = 1 << (shift - 1);
177  int16_t *src = coeffs;
178 
179  for (i = 0; i < 4; i++) {
180  TR_4x4_LUMA(src, src, 4, SCALE);
181  src++;
182  }
183 
184  shift = 20 - BIT_DEPTH;
185  add = 1 << (shift - 1);
186  for (i = 0; i < 4; i++) {
187  TR_4x4_LUMA(coeffs, coeffs, 1, SCALE);
188  coeffs += 4;
189  }
190 }
191 
192 #undef TR_4x4_LUMA
193 
194 #define TR_4(dst, src, dstep, sstep, assign, end) \
195  do { \
196  const int e0 = 64 * src[0 * sstep] + 64 * src[2 * sstep]; \
197  const int e1 = 64 * src[0 * sstep] - 64 * src[2 * sstep]; \
198  const int o0 = 83 * src[1 * sstep] + 36 * src[3 * sstep]; \
199  const int o1 = 36 * src[1 * sstep] - 83 * src[3 * sstep]; \
200  \
201  assign(dst[0 * dstep], e0 + o0); \
202  assign(dst[1 * dstep], e1 + o1); \
203  assign(dst[2 * dstep], e1 - o1); \
204  assign(dst[3 * dstep], e0 - o0); \
205  } while (0)
206 
207 #define TR_8(dst, src, dstep, sstep, assign, end) \
208  do { \
209  int i, j; \
210  int e_8[4]; \
211  int o_8[4] = { 0 }; \
212  for (i = 0; i < 4; i++) \
213  for (j = 1; j < end; j += 2) \
214  o_8[i] += transform[4 * j][i] * src[j * sstep]; \
215  TR_4(e_8, src, 1, 2 * sstep, SET, 4); \
216  \
217  for (i = 0; i < 4; i++) { \
218  assign(dst[i * dstep], e_8[i] + o_8[i]); \
219  assign(dst[(7 - i) * dstep], e_8[i] - o_8[i]); \
220  } \
221  } while (0)
222 
223 #define TR_16(dst, src, dstep, sstep, assign, end) \
224  do { \
225  int i, j; \
226  int e_16[8]; \
227  int o_16[8] = { 0 }; \
228  for (i = 0; i < 8; i++) \
229  for (j = 1; j < end; j += 2) \
230  o_16[i] += transform[2 * j][i] * src[j * sstep]; \
231  TR_8(e_16, src, 1, 2 * sstep, SET, 8); \
232  \
233  for (i = 0; i < 8; i++) { \
234  assign(dst[i * dstep], e_16[i] + o_16[i]); \
235  assign(dst[(15 - i) * dstep], e_16[i] - o_16[i]); \
236  } \
237  } while (0)
238 
239 #define TR_32(dst, src, dstep, sstep, assign, end) \
240  do { \
241  int i, j; \
242  int e_32[16]; \
243  int o_32[16] = { 0 }; \
244  for (i = 0; i < 16; i++) \
245  for (j = 1; j < end; j += 2) \
246  o_32[i] += transform[j][i] * src[j * sstep]; \
247  TR_16(e_32, src, 1, 2 * sstep, SET, end / 2); \
248  \
249  for (i = 0; i < 16; i++) { \
250  assign(dst[i * dstep], e_32[i] + o_32[i]); \
251  assign(dst[(31 - i) * dstep], e_32[i] - o_32[i]); \
252  } \
253  } while (0)
254 
255 #define IDCT_VAR4(H) \
256  int limit2 = FFMIN(col_limit + 4, H)
257 #define IDCT_VAR8(H) \
258  int limit = FFMIN(col_limit, H); \
259  int limit2 = FFMIN(col_limit + 4, H)
260 #define IDCT_VAR16(H) IDCT_VAR8(H)
261 #define IDCT_VAR32(H) IDCT_VAR8(H)
262 
263 #define IDCT(H) \
264 static void FUNC(idct_ ## H ## x ## H )(int16_t *coeffs, \
265  int col_limit) \
266 { \
267  int i; \
268  int shift = 7; \
269  int add = 1 << (shift - 1); \
270  int16_t *src = coeffs; \
271  IDCT_VAR ## H(H); \
272  \
273  for (i = 0; i < H; i++) { \
274  TR_ ## H(src, src, H, H, SCALE, limit2); \
275  if (limit2 < H && i%4 == 0 && !!i) \
276  limit2 -= 4; \
277  src++; \
278  } \
279  \
280  shift = 20 - BIT_DEPTH; \
281  add = 1 << (shift - 1); \
282  for (i = 0; i < H; i++) { \
283  TR_ ## H(coeffs, coeffs, 1, 1, SCALE, limit); \
284  coeffs += H; \
285  } \
286 }
287 
288 #define IDCT_DC(H) \
289 static void FUNC(idct_ ## H ## x ## H ## _dc)(int16_t *coeffs) \
290 { \
291  int i, j; \
292  int shift = 14 - BIT_DEPTH; \
293  int add = 1 << (shift - 1); \
294  int coeff = (((coeffs[0] + 1) >> 1) + add) >> shift; \
295  \
296  for (j = 0; j < H; j++) { \
297  for (i = 0; i < H; i++) { \
298  coeffs[i + j * H] = coeff; \
299  } \
300  } \
301 }
302 
303 IDCT( 4)
304 IDCT( 8)
305 IDCT(16)
306 IDCT(32)
307 
308 IDCT_DC( 4)
309 IDCT_DC( 8)
310 IDCT_DC(16)
311 IDCT_DC(32)
312 
313 #undef TR_4
314 #undef TR_8
315 #undef TR_16
316 #undef TR_32
317 
318 #undef SET
319 #undef SCALE
320 
321 ////////////////////////////////////////////////////////////////////////////////
322 //
323 ////////////////////////////////////////////////////////////////////////////////
324 #define ff_hevc_pel_filters ff_hevc_qpel_filters
325 #define DECL_HV_FILTER(f) \
326  const int8_t *hf = ff_hevc_ ## f ## _filters[mx]; \
327  const int8_t *vf = ff_hevc_ ## f ## _filters[my];
328 
329 #define FW_PUT(p, f, t) \
330 static void FUNC(put_hevc_## f)(int16_t *dst, const uint8_t *src, ptrdiff_t srcstride, int height, \
331  intptr_t mx, intptr_t my, int width) \
332 { \
333  DECL_HV_FILTER(p) \
334  FUNC(put_ ## t)(dst, src, srcstride, height, hf, vf, width); \
335 }
336 
337 #define FW_PUT_UNI(p, f, t) \
338 static void FUNC(put_hevc_ ## f)(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, \
339  ptrdiff_t srcstride, int height, intptr_t mx, intptr_t my, int width) \
340 { \
341  DECL_HV_FILTER(p) \
342  FUNC(put_ ## t)(dst, dststride, src, srcstride, height, hf, vf, width); \
343 }
344 
345 #define FW_PUT_UNI_W(p, f, t) \
346 static void FUNC(put_hevc_ ## f)(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, \
347  ptrdiff_t srcstride,int height, int denom, int wx, int ox, \
348  intptr_t mx, intptr_t my, int width) \
349 { \
350  DECL_HV_FILTER(p) \
351  FUNC(put_ ## t)(dst, dststride, src, srcstride, height, denom, wx, ox, hf, vf, width); \
352 }
353 
354 #define FW_PUT_FUNCS(f, t, dir) \
355  FW_PUT(f, f ## _ ## dir, t ## _ ## dir) \
356  FW_PUT_UNI(f, f ## _uni_ ## dir, uni_ ## t ## _ ## dir) \
357  FW_PUT_UNI_W(f, f ## _uni_w_ ## dir, uni_## t ## _w_ ## dir)
358 
359 FW_PUT(pel, pel_pixels, pixels)
360 FW_PUT_UNI(pel, pel_uni_pixels, uni_pixels)
361 FW_PUT_UNI_W(pel, pel_uni_w_pixels, uni_w_pixels)
362 
363 FW_PUT_FUNCS(qpel, luma, h )
364 FW_PUT_FUNCS(qpel, luma, v )
365 FW_PUT_FUNCS(qpel, luma, hv )
366 FW_PUT_FUNCS(epel, chroma, h )
367 FW_PUT_FUNCS(epel, chroma, v )
368 FW_PUT_FUNCS(epel, chroma, hv )
369 
370 static void FUNC(put_hevc_pel_bi_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
371  const int16_t *src2,
372  int height, intptr_t mx, intptr_t my, int width)
373 {
374  int x, y;
375  const pixel *src = (const pixel *)_src;
376  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
377  pixel *dst = (pixel *)_dst;
378  ptrdiff_t dststride = _dststride / sizeof(pixel);
379 
380  int shift = 14 + 1 - BIT_DEPTH;
381 #if BIT_DEPTH < 14
382  int offset = 1 << (shift - 1);
383 #else
384  int offset = 0;
385 #endif
386 
387  for (y = 0; y < height; y++) {
388  for (x = 0; x < width; x++)
389  dst[x] = av_clip_pixel(((src[x] << (14 - BIT_DEPTH)) + src2[x] + offset) >> shift);
390  src += srcstride;
391  dst += dststride;
392  src2 += MAX_PB_SIZE;
393  }
394 }
395 
396 static void FUNC(put_hevc_pel_bi_w_pixels)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
397  const int16_t *src2,
398  int height, int denom, int wx0, int wx1,
399  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
400 {
401  int x, y;
402  const pixel *src = (const pixel *)_src;
403  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
404  pixel *dst = (pixel *)_dst;
405  ptrdiff_t dststride = _dststride / sizeof(pixel);
406 
407  int shift = 14 + 1 - BIT_DEPTH;
408  int log2Wd = denom + shift - 1;
409 
410  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
411  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
412  for (y = 0; y < height; y++) {
413  for (x = 0; x < width; x++) {
414  dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + (ox0 + ox1 + 1) * (1 << log2Wd)) >> (log2Wd + 1));
415  }
416  src += srcstride;
417  dst += dststride;
418  src2 += MAX_PB_SIZE;
419  }
420 }
421 
422 ////////////////////////////////////////////////////////////////////////////////
423 //
424 ////////////////////////////////////////////////////////////////////////////////
425 #define QPEL_FILTER(src, stride) \
426  (filter[0] * src[x - 3 * stride] + \
427  filter[1] * src[x - 2 * stride] + \
428  filter[2] * src[x - stride] + \
429  filter[3] * src[x ] + \
430  filter[4] * src[x + stride] + \
431  filter[5] * src[x + 2 * stride] + \
432  filter[6] * src[x + 3 * stride] + \
433  filter[7] * src[x + 4 * stride])
434 
435 static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
436  const int16_t *src2,
437  int height, intptr_t mx, intptr_t my, int width)
438 {
439  int x, y;
440  const pixel *src = (const pixel*)_src;
441  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
442  pixel *dst = (pixel *)_dst;
443  ptrdiff_t dststride = _dststride / sizeof(pixel);
444 
445  const int8_t *filter = ff_hevc_qpel_filters[mx];
446 
447  int shift = 14 + 1 - BIT_DEPTH;
448 #if BIT_DEPTH < 14
449  int offset = 1 << (shift - 1);
450 #else
451  int offset = 0;
452 #endif
453 
454  for (y = 0; y < height; y++) {
455  for (x = 0; x < width; x++)
456  dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
457  src += srcstride;
458  dst += dststride;
459  src2 += MAX_PB_SIZE;
460  }
461 }
462 
463 static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
464  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
465  int height, intptr_t mx, intptr_t my, int width)
466 {
467  int x, y;
468  const pixel *src = (const pixel*)_src;
469  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
470  pixel *dst = (pixel *)_dst;
471  ptrdiff_t dststride = _dststride / sizeof(pixel);
472 
473  const int8_t *filter = ff_hevc_qpel_filters[my];
474 
475  int shift = 14 + 1 - BIT_DEPTH;
476 #if BIT_DEPTH < 14
477  int offset = 1 << (shift - 1);
478 #else
479  int offset = 0;
480 #endif
481 
482  for (y = 0; y < height; y++) {
483  for (x = 0; x < width; x++)
484  dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
485  src += srcstride;
486  dst += dststride;
487  src2 += MAX_PB_SIZE;
488  }
489 }
490 
491 static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
492  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
493  int height, intptr_t mx, intptr_t my, int width)
494 {
495  int x, y;
496  const int8_t *filter;
497  const pixel *src = (const pixel*)_src;
498  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
499  pixel *dst = (pixel *)_dst;
500  ptrdiff_t dststride = _dststride / sizeof(pixel);
501  int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
502  int16_t *tmp = tmp_array;
503  int shift = 14 + 1 - BIT_DEPTH;
504 #if BIT_DEPTH < 14
505  int offset = 1 << (shift - 1);
506 #else
507  int offset = 0;
508 #endif
509 
512  for (y = 0; y < height + QPEL_EXTRA; y++) {
513  for (x = 0; x < width; x++)
514  tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
515  src += srcstride;
516  tmp += MAX_PB_SIZE;
517  }
518 
519  tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
521 
522  for (y = 0; y < height; y++) {
523  for (x = 0; x < width; x++)
524  dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift);
525  tmp += MAX_PB_SIZE;
526  dst += dststride;
527  src2 += MAX_PB_SIZE;
528  }
529 }
530 
531 static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
532  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
533  int height, int denom, int wx0, int wx1,
534  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
535 {
536  int x, y;
537  const pixel *src = (const pixel*)_src;
538  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
539  pixel *dst = (pixel *)_dst;
540  ptrdiff_t dststride = _dststride / sizeof(pixel);
541 
542  const int8_t *filter = ff_hevc_qpel_filters[mx];
543 
544  int shift = 14 + 1 - BIT_DEPTH;
545  int log2Wd = denom + shift - 1;
546 
547  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
548  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
549  for (y = 0; y < height; y++) {
550  for (x = 0; x < width; x++)
551  dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
552  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
553  src += srcstride;
554  dst += dststride;
555  src2 += MAX_PB_SIZE;
556  }
557 }
558 
559 static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
560  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
561  int height, int denom, int wx0, int wx1,
562  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
563 {
564  int x, y;
565  const pixel *src = (const pixel*)_src;
566  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
567  pixel *dst = (pixel *)_dst;
568  ptrdiff_t dststride = _dststride / sizeof(pixel);
569 
570  const int8_t *filter = ff_hevc_qpel_filters[my];
571 
572  int shift = 14 + 1 - BIT_DEPTH;
573  int log2Wd = denom + shift - 1;
574 
575  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
576  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
577  for (y = 0; y < height; y++) {
578  for (x = 0; x < width; x++)
579  dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
580  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
581  src += srcstride;
582  dst += dststride;
583  src2 += MAX_PB_SIZE;
584  }
585 }
586 
587 static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
588  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
589  int height, int denom, int wx0, int wx1,
590  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
591 {
592  int x, y;
593  const int8_t *filter;
594  const pixel *src = (const pixel*)_src;
595  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
596  pixel *dst = (pixel *)_dst;
597  ptrdiff_t dststride = _dststride / sizeof(pixel);
598  int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
599  int16_t *tmp = tmp_array;
600  int shift = 14 + 1 - BIT_DEPTH;
601  int log2Wd = denom + shift - 1;
602 
605  for (y = 0; y < height + QPEL_EXTRA; y++) {
606  for (x = 0; x < width; x++)
607  tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
608  src += srcstride;
609  tmp += MAX_PB_SIZE;
610  }
611 
612  tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
614 
615  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
616  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
617  for (y = 0; y < height; y++) {
618  for (x = 0; x < width; x++)
619  dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
620  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
621  tmp += MAX_PB_SIZE;
622  dst += dststride;
623  src2 += MAX_PB_SIZE;
624  }
625 }
626 
627 ////////////////////////////////////////////////////////////////////////////////
628 //
629 ////////////////////////////////////////////////////////////////////////////////
630 #define EPEL_FILTER(src, stride) \
631  (filter[0] * src[x - stride] + \
632  filter[1] * src[x] + \
633  filter[2] * src[x + stride] + \
634  filter[3] * src[x + 2 * stride])
635 
636 static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride,
637  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
638  int height, intptr_t mx, intptr_t my, int width)
639 {
640  int x, y;
641  const pixel *src = (const pixel *)_src;
642  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
643  pixel *dst = (pixel *)_dst;
644  ptrdiff_t dststride = _dststride / sizeof(pixel);
645  const int8_t *filter = ff_hevc_epel_filters[mx];
646  int shift = 14 + 1 - BIT_DEPTH;
647 #if BIT_DEPTH < 14
648  int offset = 1 << (shift - 1);
649 #else
650  int offset = 0;
651 #endif
652 
653  for (y = 0; y < height; y++) {
654  for (x = 0; x < width; x++) {
655  dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
656  }
657  dst += dststride;
658  src += srcstride;
659  src2 += MAX_PB_SIZE;
660  }
661 }
662 
663 static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
664  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
665  int height, intptr_t mx, intptr_t my, int width)
666 {
667  int x, y;
668  const pixel *src = (const pixel *)_src;
669  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
670  const int8_t *filter = ff_hevc_epel_filters[my];
671  pixel *dst = (pixel *)_dst;
672  ptrdiff_t dststride = _dststride / sizeof(pixel);
673  int shift = 14 + 1 - BIT_DEPTH;
674 #if BIT_DEPTH < 14
675  int offset = 1 << (shift - 1);
676 #else
677  int offset = 0;
678 #endif
679 
680  for (y = 0; y < height; y++) {
681  for (x = 0; x < width; x++)
682  dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
683  dst += dststride;
684  src += srcstride;
685  src2 += MAX_PB_SIZE;
686  }
687 }
688 
689 static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
690  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
691  int height, intptr_t mx, intptr_t my, int width)
692 {
693  int x, y;
694  const pixel *src = (const pixel *)_src;
695  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
696  pixel *dst = (pixel *)_dst;
697  ptrdiff_t dststride = _dststride / sizeof(pixel);
698  const int8_t *filter = ff_hevc_epel_filters[mx];
699  int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
700  int16_t *tmp = tmp_array;
701  int shift = 14 + 1 - BIT_DEPTH;
702 #if BIT_DEPTH < 14
703  int offset = 1 << (shift - 1);
704 #else
705  int offset = 0;
706 #endif
707 
709 
710  for (y = 0; y < height + EPEL_EXTRA; y++) {
711  for (x = 0; x < width; x++)
712  tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
713  src += srcstride;
714  tmp += MAX_PB_SIZE;
715  }
716 
717  tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
719 
720  for (y = 0; y < height; y++) {
721  for (x = 0; x < width; x++)
722  dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift);
723  tmp += MAX_PB_SIZE;
724  dst += dststride;
725  src2 += MAX_PB_SIZE;
726  }
727 }
728 
729 static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
730  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
731  int height, int denom, int wx0, int wx1,
732  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
733 {
734  int x, y;
735  const pixel *src = (const pixel *)_src;
736  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
737  pixel *dst = (pixel *)_dst;
738  ptrdiff_t dststride = _dststride / sizeof(pixel);
739  const int8_t *filter = ff_hevc_epel_filters[mx];
740  int shift = 14 + 1 - BIT_DEPTH;
741  int log2Wd = denom + shift - 1;
742 
743  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
744  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
745  for (y = 0; y < height; y++) {
746  for (x = 0; x < width; x++)
747  dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
748  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
749  src += srcstride;
750  dst += dststride;
751  src2 += MAX_PB_SIZE;
752  }
753 }
754 
755 static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
756  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
757  int height, int denom, int wx0, int wx1,
758  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
759 {
760  int x, y;
761  const pixel *src = (const pixel *)_src;
762  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
763  const int8_t *filter = ff_hevc_epel_filters[my];
764  pixel *dst = (pixel *)_dst;
765  ptrdiff_t dststride = _dststride / sizeof(pixel);
766  int shift = 14 + 1 - BIT_DEPTH;
767  int log2Wd = denom + shift - 1;
768 
769  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
770  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
771  for (y = 0; y < height; y++) {
772  for (x = 0; x < width; x++)
773  dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
774  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
775  src += srcstride;
776  dst += dststride;
777  src2 += MAX_PB_SIZE;
778  }
779 }
780 
781 static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
782  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
783  int height, int denom, int wx0, int wx1,
784  int ox0, int ox1, intptr_t mx, intptr_t my, int width)
785 {
786  int x, y;
787  const pixel *src = (const pixel *)_src;
788  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
789  pixel *dst = (pixel *)_dst;
790  ptrdiff_t dststride = _dststride / sizeof(pixel);
791  const int8_t *filter = ff_hevc_epel_filters[mx];
792  int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
793  int16_t *tmp = tmp_array;
794  int shift = 14 + 1 - BIT_DEPTH;
795  int log2Wd = denom + shift - 1;
796 
798 
799  for (y = 0; y < height + EPEL_EXTRA; y++) {
800  for (x = 0; x < width; x++)
801  tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
802  src += srcstride;
803  tmp += MAX_PB_SIZE;
804  }
805 
806  tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
808 
809  ox0 = ox0 * (1 << (BIT_DEPTH - 8));
810  ox1 = ox1 * (1 << (BIT_DEPTH - 8));
811  for (y = 0; y < height; y++) {
812  for (x = 0; x < width; x++)
813  dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
814  ((ox0 + ox1 + 1) * (1 << log2Wd))) >> (log2Wd + 1));
815  tmp += MAX_PB_SIZE;
816  dst += dststride;
817  src2 += MAX_PB_SIZE;
818  }
819 }
820 
821 // line zero
822 #define P3 pix[-4 * xstride]
823 #define P2 pix[-3 * xstride]
824 #define P1 pix[-2 * xstride]
825 #define P0 pix[-1 * xstride]
826 #define Q0 pix[0 * xstride]
827 #define Q1 pix[1 * xstride]
828 #define Q2 pix[2 * xstride]
829 #define Q3 pix[3 * xstride]
830 
831 // line three. used only for deblocking decision
832 #define TP3 pix[-4 * xstride + 3 * ystride]
833 #define TP2 pix[-3 * xstride + 3 * ystride]
834 #define TP1 pix[-2 * xstride + 3 * ystride]
835 #define TP0 pix[-1 * xstride + 3 * ystride]
836 #define TQ0 pix[0 * xstride + 3 * ystride]
837 #define TQ1 pix[1 * xstride + 3 * ystride]
838 #define TQ2 pix[2 * xstride + 3 * ystride]
839 #define TQ3 pix[3 * xstride + 3 * ystride]
840 
842 
843 static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
844  ptrdiff_t _xstride, ptrdiff_t _ystride,
845  int beta, const int *_tc,
846  const uint8_t *_no_p, const uint8_t *_no_q)
847 {
848  ptrdiff_t xstride = _xstride / sizeof(pixel);
849  ptrdiff_t ystride = _ystride / sizeof(pixel);
850 
851  beta <<= BIT_DEPTH - 8;
852 
853  for (int j = 0; j < 2; j++) {
854  pixel* pix = (pixel*)_pix + j * 4 * ystride;
855  const int dp0 = abs(P2 - 2 * P1 + P0);
856  const int dq0 = abs(Q2 - 2 * Q1 + Q0);
857  const int dp3 = abs(TP2 - 2 * TP1 + TP0);
858  const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0);
859  const int d0 = dp0 + dq0;
860  const int d3 = dp3 + dq3;
861  const int tc = _tc[j] << (BIT_DEPTH - 8);
862  const int no_p = _no_p[j];
863  const int no_q = _no_q[j];
864 
865  if (d0 + d3 < beta) {
866  const int beta_3 = beta >> 3;
867  const int beta_2 = beta >> 2;
868  const int tc25 = ((tc * 5 + 1) >> 1);
869 
870  if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 &&
871  abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 &&
872  (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
873  const int tc2 = tc << 1;
874  FUNC(loop_filter_luma_strong)(pix, xstride, ystride, tc2, tc2, tc2, no_p, no_q);
875  } else {
876  int nd_p = 1;
877  int nd_q = 1;
878  if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
879  nd_p = 2;
880  if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
881  nd_q = 2;
882  FUNC(loop_filter_luma_weak)(pix, xstride, ystride, tc, beta, no_p, no_q, nd_p, nd_q);
883  }
884  }
885  }
886 }
887 
888 static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
889  ptrdiff_t _ystride, const int *_tc,
890  const uint8_t *_no_p, const uint8_t *_no_q)
891 {
892  int no_p, no_q;
893  ptrdiff_t xstride = _xstride / sizeof(pixel);
894  ptrdiff_t ystride = _ystride / sizeof(pixel);
895  const int size = 4;
896 
897  for (int j = 0; j < 2; j++) {
898  pixel *pix = (pixel *)_pix + j * size * ystride;
899  const int tc = _tc[j] << (BIT_DEPTH - 8);
900  if (tc > 0) {
901  no_p = _no_p[j];
902  no_q = _no_q[j];
903 
904  FUNC(loop_filter_chroma_weak)(pix, xstride, ystride, size, tc, no_p, no_q);
905  }
906  }
907 }
908 
909 static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
910  const int32_t *tc, const uint8_t *no_p,
911  const uint8_t *no_q)
912 {
913  FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q);
914 }
915 
916 static void FUNC(hevc_v_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
917  const int32_t *tc, const uint8_t *no_p,
918  const uint8_t *no_q)
919 {
920  FUNC(hevc_loop_filter_chroma)(pix, sizeof(pixel), stride, tc, no_p, no_q);
921 }
922 
923 static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
924  int beta, const int32_t *tc, const uint8_t *no_p,
925  const uint8_t *no_q)
926 {
928  beta, tc, no_p, no_q);
929 }
930 
931 static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
932  int beta, const int32_t *tc, const uint8_t *no_p,
933  const uint8_t *no_q)
934 {
936  beta, tc, no_p, no_q);
937 }
938 
939 #undef P3
940 #undef P2
941 #undef P1
942 #undef P0
943 #undef Q0
944 #undef Q1
945 #undef Q2
946 #undef Q3
947 
948 #undef TP3
949 #undef TP2
950 #undef TP1
951 #undef TP0
952 #undef TQ0
953 #undef TQ1
954 #undef TQ2
955 #undef TQ3
put_hevc_pel_bi_w_pixels
static void FUNC() put_hevc_pel_bi_w_pixels(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:396
_dst
uint8_t * _dst
Definition: dsp.h:56
put_hevc_qpel_bi_h
static void FUNC() put_hevc_qpel_bi_h(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:435
put_hevc_qpel_bi_w_h
static void FUNC() put_hevc_qpel_bi_w_h(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:531
QPEL_FILTER
#define QPEL_FILTER(src, stride)
Definition: dsp_template.c:425
Q1
#define Q1
Definition: dsp_template.c:827
ff_hevc_epel_filters
const int8_t ff_hevc_epel_filters[8][4]
ff_hevc_.pel_filters[0] are dummies to simplify array addressing
Definition: dsp.c:94
hevc_loop_filter_luma
static void FUNC() hevc_loop_filter_luma(uint8_t *_pix, ptrdiff_t _xstride, ptrdiff_t _ystride, int beta, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q)
Definition: dsp_template.c:843
put_pcm
static void FUNC() put_pcm(uint8_t *_dst, ptrdiff_t stride, int width, int height, GetBitContext *gb, int pcm_bit_depth)
Definition: dsp_template.c:31
mode
Definition: swscale.c:56
put_hevc_qpel_bi_hv
static void FUNC() put_hevc_qpel_bi_hv(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:491
chroma
static av_always_inline void chroma(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset_y, int offset_x, int column, int mirror, int jobnr, int nb_jobs)
Definition: vf_waveform.c:1639
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
Q2
#define Q2
Definition: dsp_template.c:828
loop_filter_luma_strong
static void FUNC() loop_filter_luma_strong(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int32_t tc, const int32_t tc2, const int tc3, const uint8_t no_p, const uint8_t no_q)
Definition: h2656_deblock_template.c:25
pix
enum AVPixelFormat pix
Definition: ohcodec.c:55
EPEL_FILTER
#define EPEL_FILTER(src, stride)
Definition: dsp_template.c:630
_src
uint8_t ptrdiff_t const uint8_t * _src
Definition: dsp.h:56
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:337
mx
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
Definition: dsp.h:57
hevc_v_loop_filter_luma
static void FUNC() hevc_v_loop_filter_luma(uint8_t *pix, ptrdiff_t stride, int beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q)
Definition: dsp_template.c:931
h2656_inter_template.c
IDCT_DC
#define IDCT_DC(H)
Definition: dsp_template.c:288
put_hevc_qpel_bi_w_v
static void FUNC() put_hevc_qpel_bi_w_v(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:559
P0
#define P0
Definition: dsp_template.c:825
GetBitContext
Definition: get_bits.h:109
transform_4x4_luma
static void FUNC() transform_4x4_luma(int16_t *coeffs)
Definition: dsp_template.c:172
hevc_h_loop_filter_luma
static void FUNC() hevc_h_loop_filter_luma(uint8_t *pix, ptrdiff_t stride, int beta, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q)
Definition: dsp_template.c:923
_srcstride
uint8_t ptrdiff_t const uint8_t ptrdiff_t _srcstride
Definition: dsp.h:57
add_residual32x32
static void FUNC() add_residual32x32(uint8_t *_dst, const int16_t *res, ptrdiff_t stride)
Definition: dsp_template.c:81
QPEL_EXTRA_BEFORE
#define QPEL_EXTRA_BEFORE
Definition: hevcdec.h:62
TP0
#define TP0
Definition: dsp_template.c:835
ff_hevc_qpel_filters
const int8_t ff_hevc_qpel_filters[4][16]
Definition: dsp.c:105
get_bits.h
put_hevc_qpel_bi_v
static void FUNC() put_hevc_qpel_bi_v(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:463
loop_filter_chroma_weak
static void FUNC() loop_filter_chroma_weak(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int size, const int32_t tc, const uint8_t no_p, const uint8_t no_q)
Definition: h2656_deblock_template.c:83
tmp
static uint8_t tmp[40]
Definition: aes_ctr.c:52
my
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
Definition: dsp.h:57
srcstride
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t const uint8_t ptrdiff_t srcstride
Definition: dsp.h:88
FW_PUT_FUNCS
#define FW_PUT_FUNCS(f, t, dir)
Definition: dsp_template.c:354
P2
#define P2
Definition: dsp_template.c:823
pixel
uint8_t pixel
Definition: tiny_ssim.c:41
TQ1
#define TQ1
Definition: dsp_template.c:837
add_residual8x8
static void FUNC() add_residual8x8(uint8_t *_dst, const int16_t *res, ptrdiff_t stride)
Definition: dsp_template.c:69
_dststride
uint8_t ptrdiff_t _dststride
Definition: dsp.h:56
h2656_deblock_template.c
P3
#define P3
Definition: dsp_template.c:822
bit_depth_template.c
abs
#define abs(x)
Definition: cuda_runtime.h:35
put_hevc_epel_bi_w_h
static void FUNC() put_hevc_epel_bi_w_h(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:729
TP1
#define TP1
Definition: dsp_template.c:834
dsp.h
hevcdec.h
height
#define height
Definition: dsp.h:89
shift
static int shift(int a, int b)
Definition: bonk.c:261
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
size
int size
Definition: twinvq_data.h:10344
FW_PUT_UNI_W
#define FW_PUT_UNI_W(p, f, t)
Definition: dsp_template.c:345
SCALE
#define SCALE(dst, x)
Definition: dsp_template.c:155
hevc_h_loop_filter_chroma
static void FUNC() hevc_h_loop_filter_chroma(uint8_t *pix, ptrdiff_t stride, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q)
Definition: dsp_template.c:909
QPEL_EXTRA
#define QPEL_EXTRA
Definition: hevcdec.h:64
put_hevc_epel_bi_hv
static void FUNC() put_hevc_epel_bi_hv(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:689
TP3
#define TP3
Definition: dsp_template.c:832
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
transform_rdpcm
static void FUNC() transform_rdpcm(int16_t *_coeffs, int16_t log2_size, int mode)
Definition: dsp_template.c:87
dequant
static void FUNC() dequant(int16_t *coeffs, int16_t log2_size)
HEVC transform dequantization (ITU-T H.265 8.6.3)
Definition: dsp_template.c:129
EPEL_EXTRA_BEFORE
#define EPEL_EXTRA_BEFORE
Definition: hevcdec.h:59
hevc_loop_filter_chroma
static void FUNC() hevc_loop_filter_chroma(uint8_t *_pix, ptrdiff_t _xstride, ptrdiff_t _ystride, const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q)
Definition: dsp_template.c:888
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
src2
const pixel * src2
Definition: h264pred_template.c:421
av_always_inline
#define av_always_inline
Definition: attributes.h:63
TQ2
#define TQ2
Definition: dsp_template.c:838
TQ0
#define TQ0
Definition: dsp_template.c:836
put_hevc_epel_bi_v
static void FUNC() put_hevc_epel_bi_v(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:663
MAX_PB_SIZE
#define MAX_PB_SIZE
Definition: dsp.h:32
av_clip_pixel
#define av_clip_pixel(a)
Definition: bit_depth_template.c:98
FUNC
#define FUNC(a)
Definition: bit_depth_template.c:104
BIT_DEPTH
#define BIT_DEPTH
Definition: dsp_init.c:73
mode
mode
Definition: ebur128.h:83
TR_4x4_LUMA
#define TR_4x4_LUMA(dst, src, step, assign)
Definition: dsp_template.c:157
put_hevc_pel_bi_pixels
static void FUNC() put_hevc_pel_bi_pixels(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:370
loop_filter_luma_weak
static void FUNC() loop_filter_luma_weak(pixel *pix, const ptrdiff_t xstride, const ptrdiff_t ystride, const int32_t tc, const int32_t beta, const uint8_t no_p, const uint8_t no_q, const int nd_p, const int nd_q)
Definition: h2656_deblock_template.c:52
FW_PUT_UNI
#define FW_PUT_UNI(p, f, t)
Definition: dsp_template.c:337
TQ3
#define TQ3
Definition: dsp_template.c:839
add_residual
static av_always_inline void FUNC() add_residual(uint8_t *_dst, const int16_t *res, ptrdiff_t stride, int size)
Definition: dsp_template.c:46
add_residual4x4
static void FUNC() add_residual4x4(uint8_t *_dst, const int16_t *res, ptrdiff_t stride)
Definition: dsp_template.c:63
FW_PUT
#define FW_PUT(p, f, t)
Definition: dsp_template.c:329
EPEL_EXTRA
#define EPEL_EXTRA
Definition: hevcdec.h:61
put_hevc_epel_bi_w_v
static void FUNC() put_hevc_epel_bi_w_v(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:755
IDCT
#define IDCT(H)
Definition: dsp_template.c:263
P1
#define P1
Definition: dsp_template.c:824
int32_t
int32_t
Definition: audioconvert.c:56
TP2
#define TP2
Definition: dsp_template.c:833
add_residual16x16
static void FUNC() add_residual16x16(uint8_t *_dst, const int16_t *res, ptrdiff_t stride)
Definition: dsp_template.c:75
put_hevc_qpel_bi_w_hv
static void FUNC() put_hevc_qpel_bi_w_hv(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:587
h
h
Definition: vp9dsp_template.c:2070
stride
#define stride
Definition: h264pred_template.c:536
width
#define width
Definition: dsp.h:89
put_hevc_epel_bi_h
static void FUNC() put_hevc_epel_bi_h(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:636
Q0
#define Q0
Definition: dsp_template.c:826
Q3
#define Q3
Definition: dsp_template.c:829
hevc_v_loop_filter_chroma
static void FUNC() hevc_v_loop_filter_chroma(uint8_t *pix, ptrdiff_t stride, const int32_t *tc, const uint8_t *no_p, const uint8_t *no_q)
Definition: dsp_template.c:916
src
#define src
Definition: vp8dsp.c:248
h2656_sao_template.c
put_hevc_epel_bi_w_hv
static void FUNC() put_hevc_epel_bi_w_hv(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2, int height, int denom, int wx0, int wx1, int ox0, int ox1, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:781