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