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 "libavcodec/get_bits.h"
24 #include "hevcdec.h"
25 
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 ox, 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  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
409  for (y = 0; y < height; y++) {
410  for (x = 0; x < width; x++) {
411  dst[x] = av_clip_pixel(( (src[x] << (14 - BIT_DEPTH)) * wx1 + src2[x] * wx0 + ox * (1 << log2Wd)) >> (log2Wd + 1));
412  }
413  src += srcstride;
414  dst += dststride;
415  src2 += MAX_PB_SIZE;
416  }
417 }
418 
419 ////////////////////////////////////////////////////////////////////////////////
420 //
421 ////////////////////////////////////////////////////////////////////////////////
422 #define QPEL_FILTER(src, stride) \
423  (filter[0] * src[x - 3 * stride] + \
424  filter[1] * src[x - 2 * stride] + \
425  filter[2] * src[x - stride] + \
426  filter[3] * src[x ] + \
427  filter[4] * src[x + stride] + \
428  filter[5] * src[x + 2 * stride] + \
429  filter[6] * src[x + 3 * stride] + \
430  filter[7] * src[x + 4 * stride])
431 
432 static void FUNC(put_hevc_qpel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride,
433  const int16_t *src2,
434  int height, intptr_t mx, intptr_t my, int width)
435 {
436  int x, y;
437  const pixel *src = (const pixel*)_src;
438  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
439  pixel *dst = (pixel *)_dst;
440  ptrdiff_t dststride = _dststride / sizeof(pixel);
441 
442  const int8_t *filter = ff_hevc_qpel_filters[mx];
443 
444  int shift = 14 + 1 - BIT_DEPTH;
445 #if BIT_DEPTH < 14
446  int offset = 1 << (shift - 1);
447 #else
448  int offset = 0;
449 #endif
450 
451  for (y = 0; y < height; y++) {
452  for (x = 0; x < width; x++)
453  dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
454  src += srcstride;
455  dst += dststride;
456  src2 += MAX_PB_SIZE;
457  }
458 }
459 
460 static void FUNC(put_hevc_qpel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
461  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
462  int height, intptr_t mx, intptr_t my, int width)
463 {
464  int x, y;
465  const pixel *src = (const pixel*)_src;
466  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
467  pixel *dst = (pixel *)_dst;
468  ptrdiff_t dststride = _dststride / sizeof(pixel);
469 
470  const int8_t *filter = ff_hevc_qpel_filters[my];
471 
472  int shift = 14 + 1 - BIT_DEPTH;
473 #if BIT_DEPTH < 14
474  int offset = 1 << (shift - 1);
475 #else
476  int offset = 0;
477 #endif
478 
479  for (y = 0; y < height; y++) {
480  for (x = 0; x < width; x++)
481  dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
482  src += srcstride;
483  dst += dststride;
484  src2 += MAX_PB_SIZE;
485  }
486 }
487 
488 static void FUNC(put_hevc_qpel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
489  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
490  int height, intptr_t mx, intptr_t my, int width)
491 {
492  int x, y;
493  const int8_t *filter;
494  const pixel *src = (const pixel*)_src;
495  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
496  pixel *dst = (pixel *)_dst;
497  ptrdiff_t dststride = _dststride / sizeof(pixel);
498  int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
499  int16_t *tmp = tmp_array;
500  int shift = 14 + 1 - BIT_DEPTH;
501 #if BIT_DEPTH < 14
502  int offset = 1 << (shift - 1);
503 #else
504  int offset = 0;
505 #endif
506 
509  for (y = 0; y < height + QPEL_EXTRA; y++) {
510  for (x = 0; x < width; x++)
511  tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
512  src += srcstride;
513  tmp += MAX_PB_SIZE;
514  }
515 
516  tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
518 
519  for (y = 0; y < height; y++) {
520  for (x = 0; x < width; x++)
521  dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift);
522  tmp += MAX_PB_SIZE;
523  dst += dststride;
524  src2 += MAX_PB_SIZE;
525  }
526 }
527 
528 static void FUNC(put_hevc_qpel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
529  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
530  int height, int denom, int wx0, int wx1,
531  int ox, intptr_t mx, intptr_t my, int width)
532 {
533  int x, y;
534  const pixel *src = (const pixel*)_src;
535  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
536  pixel *dst = (pixel *)_dst;
537  ptrdiff_t dststride = _dststride / sizeof(pixel);
538 
539  const int8_t *filter = ff_hevc_qpel_filters[mx];
540 
541  int shift = 14 + 1 - BIT_DEPTH;
542  int log2Wd = denom + shift - 1;
543 
544  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
545  for (y = 0; y < height; y++) {
546  for (x = 0; x < width; x++)
547  dst[x] = av_clip_pixel(((QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
548  ox * (1 << log2Wd)) >> (log2Wd + 1));
549  src += srcstride;
550  dst += dststride;
551  src2 += MAX_PB_SIZE;
552  }
553 }
554 
555 static void FUNC(put_hevc_qpel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
556  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
557  int height, int denom, int wx0, int wx1,
558  int ox, intptr_t mx, intptr_t my, int width)
559 {
560  int x, y;
561  const pixel *src = (const pixel*)_src;
562  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
563  pixel *dst = (pixel *)_dst;
564  ptrdiff_t dststride = _dststride / sizeof(pixel);
565 
566  const int8_t *filter = ff_hevc_qpel_filters[my];
567 
568  int shift = 14 + 1 - BIT_DEPTH;
569  int log2Wd = denom + shift - 1;
570 
571  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
572  for (y = 0; y < height; y++) {
573  for (x = 0; x < width; x++)
574  dst[x] = av_clip_pixel(((QPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
575  ox * (1 << log2Wd)) >> (log2Wd + 1));
576  src += srcstride;
577  dst += dststride;
578  src2 += MAX_PB_SIZE;
579  }
580 }
581 
582 static void FUNC(put_hevc_qpel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
583  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
584  int height, int denom, int wx0, int wx1,
585  int ox, intptr_t mx, intptr_t my, int width)
586 {
587  int x, y;
588  const int8_t *filter;
589  const pixel *src = (const pixel*)_src;
590  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
591  pixel *dst = (pixel *)_dst;
592  ptrdiff_t dststride = _dststride / sizeof(pixel);
593  int16_t tmp_array[(MAX_PB_SIZE + QPEL_EXTRA) * MAX_PB_SIZE];
594  int16_t *tmp = tmp_array;
595  int shift = 14 + 1 - BIT_DEPTH;
596  int log2Wd = denom + shift - 1;
597 
600  for (y = 0; y < height + QPEL_EXTRA; y++) {
601  for (x = 0; x < width; x++)
602  tmp[x] = QPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
603  src += srcstride;
604  tmp += MAX_PB_SIZE;
605  }
606 
607  tmp = tmp_array + QPEL_EXTRA_BEFORE * MAX_PB_SIZE;
609 
610  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
611  for (y = 0; y < height; y++) {
612  for (x = 0; x < width; x++)
613  dst[x] = av_clip_pixel(((QPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
614  ox * (1 << log2Wd)) >> (log2Wd + 1));
615  tmp += MAX_PB_SIZE;
616  dst += dststride;
617  src2 += MAX_PB_SIZE;
618  }
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 //
623 ////////////////////////////////////////////////////////////////////////////////
624 #define EPEL_FILTER(src, stride) \
625  (filter[0] * src[x - stride] + \
626  filter[1] * src[x] + \
627  filter[2] * src[x + stride] + \
628  filter[3] * src[x + 2 * stride])
629 
630 static void FUNC(put_hevc_epel_bi_h)(uint8_t *_dst, ptrdiff_t _dststride,
631  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
632  int height, intptr_t mx, intptr_t my, int width)
633 {
634  int x, y;
635  const pixel *src = (const pixel *)_src;
636  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
637  pixel *dst = (pixel *)_dst;
638  ptrdiff_t dststride = _dststride / sizeof(pixel);
639  const int8_t *filter = ff_hevc_epel_filters[mx];
640  int shift = 14 + 1 - BIT_DEPTH;
641 #if BIT_DEPTH < 14
642  int offset = 1 << (shift - 1);
643 #else
644  int offset = 0;
645 #endif
646 
647  for (y = 0; y < height; y++) {
648  for (x = 0; x < width; x++) {
649  dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
650  }
651  dst += dststride;
652  src += srcstride;
653  src2 += MAX_PB_SIZE;
654  }
655 }
656 
657 static void FUNC(put_hevc_epel_bi_v)(uint8_t *_dst, ptrdiff_t _dststride,
658  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
659  int height, intptr_t mx, intptr_t my, int width)
660 {
661  int x, y;
662  const pixel *src = (const pixel *)_src;
663  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
664  const int8_t *filter = ff_hevc_epel_filters[my];
665  pixel *dst = (pixel *)_dst;
666  ptrdiff_t dststride = _dststride / sizeof(pixel);
667  int shift = 14 + 1 - BIT_DEPTH;
668 #if BIT_DEPTH < 14
669  int offset = 1 << (shift - 1);
670 #else
671  int offset = 0;
672 #endif
673 
674  for (y = 0; y < height; y++) {
675  for (x = 0; x < width; x++)
676  dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) + src2[x] + offset) >> shift);
677  dst += dststride;
678  src += srcstride;
679  src2 += MAX_PB_SIZE;
680  }
681 }
682 
683 static void FUNC(put_hevc_epel_bi_hv)(uint8_t *_dst, ptrdiff_t _dststride,
684  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
685  int height, intptr_t mx, intptr_t my, int width)
686 {
687  int x, y;
688  const pixel *src = (const pixel *)_src;
689  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
690  pixel *dst = (pixel *)_dst;
691  ptrdiff_t dststride = _dststride / sizeof(pixel);
692  const int8_t *filter = ff_hevc_epel_filters[mx];
693  int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
694  int16_t *tmp = tmp_array;
695  int shift = 14 + 1 - BIT_DEPTH;
696 #if BIT_DEPTH < 14
697  int offset = 1 << (shift - 1);
698 #else
699  int offset = 0;
700 #endif
701 
703 
704  for (y = 0; y < height + EPEL_EXTRA; y++) {
705  for (x = 0; x < width; x++)
706  tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
707  src += srcstride;
708  tmp += MAX_PB_SIZE;
709  }
710 
711  tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
713 
714  for (y = 0; y < height; y++) {
715  for (x = 0; x < width; x++)
716  dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) + src2[x] + offset) >> shift);
717  tmp += MAX_PB_SIZE;
718  dst += dststride;
719  src2 += MAX_PB_SIZE;
720  }
721 }
722 
723 static void FUNC(put_hevc_epel_bi_w_h)(uint8_t *_dst, ptrdiff_t _dststride,
724  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
725  int height, int denom, int wx0, int wx1,
726  int ox, intptr_t mx, intptr_t my, int width)
727 {
728  int x, y;
729  const pixel *src = (const pixel *)_src;
730  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
731  pixel *dst = (pixel *)_dst;
732  ptrdiff_t dststride = _dststride / sizeof(pixel);
733  const int8_t *filter = ff_hevc_epel_filters[mx];
734  int shift = 14 + 1 - BIT_DEPTH;
735  int log2Wd = denom + shift - 1;
736 
737  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
738  for (y = 0; y < height; y++) {
739  for (x = 0; x < width; x++)
740  dst[x] = av_clip_pixel(((EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
741  ox * (1 << log2Wd)) >> (log2Wd + 1));
742  src += srcstride;
743  dst += dststride;
744  src2 += MAX_PB_SIZE;
745  }
746 }
747 
748 static void FUNC(put_hevc_epel_bi_w_v)(uint8_t *_dst, ptrdiff_t _dststride,
749  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
750  int height, int denom, int wx0, int wx1,
751  int ox, intptr_t mx, intptr_t my, int width)
752 {
753  int x, y;
754  const pixel *src = (const pixel *)_src;
755  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
756  const int8_t *filter = ff_hevc_epel_filters[my];
757  pixel *dst = (pixel *)_dst;
758  ptrdiff_t dststride = _dststride / sizeof(pixel);
759  int shift = 14 + 1 - BIT_DEPTH;
760  int log2Wd = denom + shift - 1;
761 
762  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
763  for (y = 0; y < height; y++) {
764  for (x = 0; x < width; x++)
765  dst[x] = av_clip_pixel(((EPEL_FILTER(src, srcstride) >> (BIT_DEPTH - 8)) * wx1 + src2[x] * wx0 +
766  ox * (1 << log2Wd)) >> (log2Wd + 1));
767  src += srcstride;
768  dst += dststride;
769  src2 += MAX_PB_SIZE;
770  }
771 }
772 
773 static void FUNC(put_hevc_epel_bi_w_hv)(uint8_t *_dst, ptrdiff_t _dststride,
774  const uint8_t *_src, ptrdiff_t _srcstride, const int16_t *src2,
775  int height, int denom, int wx0, int wx1,
776  int ox, intptr_t mx, intptr_t my, int width)
777 {
778  int x, y;
779  const pixel *src = (const pixel *)_src;
780  ptrdiff_t srcstride = _srcstride / sizeof(pixel);
781  pixel *dst = (pixel *)_dst;
782  ptrdiff_t dststride = _dststride / sizeof(pixel);
783  const int8_t *filter = ff_hevc_epel_filters[mx];
784  int16_t tmp_array[(MAX_PB_SIZE + EPEL_EXTRA) * MAX_PB_SIZE];
785  int16_t *tmp = tmp_array;
786  int shift = 14 + 1 - BIT_DEPTH;
787  int log2Wd = denom + shift - 1;
788 
790 
791  for (y = 0; y < height + EPEL_EXTRA; y++) {
792  for (x = 0; x < width; x++)
793  tmp[x] = EPEL_FILTER(src, 1) >> (BIT_DEPTH - 8);
794  src += srcstride;
795  tmp += MAX_PB_SIZE;
796  }
797 
798  tmp = tmp_array + EPEL_EXTRA_BEFORE * MAX_PB_SIZE;
800 
801  ox = ox * (1 << (BIT_DEPTH - 8)) + 1;
802  for (y = 0; y < height; y++) {
803  for (x = 0; x < width; x++)
804  dst[x] = av_clip_pixel(((EPEL_FILTER(tmp, MAX_PB_SIZE) >> 6) * wx1 + src2[x] * wx0 +
805  ox * (1 << log2Wd)) >> (log2Wd + 1));
806  tmp += MAX_PB_SIZE;
807  dst += dststride;
808  src2 += MAX_PB_SIZE;
809  }
810 }
811 
812 // line zero
813 #define P3 pix[-4 * xstride]
814 #define P2 pix[-3 * xstride]
815 #define P1 pix[-2 * xstride]
816 #define P0 pix[-1 * xstride]
817 #define Q0 pix[0 * xstride]
818 #define Q1 pix[1 * xstride]
819 #define Q2 pix[2 * xstride]
820 #define Q3 pix[3 * xstride]
821 
822 // line three. used only for deblocking decision
823 #define TP3 pix[-4 * xstride + 3 * ystride]
824 #define TP2 pix[-3 * xstride + 3 * ystride]
825 #define TP1 pix[-2 * xstride + 3 * ystride]
826 #define TP0 pix[-1 * xstride + 3 * ystride]
827 #define TQ0 pix[0 * xstride + 3 * ystride]
828 #define TQ1 pix[1 * xstride + 3 * ystride]
829 #define TQ2 pix[2 * xstride + 3 * ystride]
830 #define TQ3 pix[3 * xstride + 3 * ystride]
831 
833 
834 static void FUNC(hevc_loop_filter_luma)(uint8_t *_pix,
835  ptrdiff_t _xstride, ptrdiff_t _ystride,
836  int beta, const int *_tc,
837  const uint8_t *_no_p, const uint8_t *_no_q)
838 {
839  ptrdiff_t xstride = _xstride / sizeof(pixel);
840  ptrdiff_t ystride = _ystride / sizeof(pixel);
841 
842  beta <<= BIT_DEPTH - 8;
843 
844  for (int j = 0; j < 2; j++) {
845  pixel* pix = (pixel*)_pix + j * 4 * ystride;
846  const int dp0 = abs(P2 - 2 * P1 + P0);
847  const int dq0 = abs(Q2 - 2 * Q1 + Q0);
848  const int dp3 = abs(TP2 - 2 * TP1 + TP0);
849  const int dq3 = abs(TQ2 - 2 * TQ1 + TQ0);
850  const int d0 = dp0 + dq0;
851  const int d3 = dp3 + dq3;
852  const int tc = _tc[j] << (BIT_DEPTH - 8);
853  const int no_p = _no_p[j];
854  const int no_q = _no_q[j];
855 
856  if (d0 + d3 < beta) {
857  const int beta_3 = beta >> 3;
858  const int beta_2 = beta >> 2;
859  const int tc25 = ((tc * 5 + 1) >> 1);
860 
861  if (abs(P3 - P0) + abs(Q3 - Q0) < beta_3 && abs(P0 - Q0) < tc25 &&
862  abs(TP3 - TP0) + abs(TQ3 - TQ0) < beta_3 && abs(TP0 - TQ0) < tc25 &&
863  (d0 << 1) < beta_2 && (d3 << 1) < beta_2) {
864  const int tc2 = tc << 1;
865  FUNC(loop_filter_luma_strong)(pix, xstride, ystride, tc2, tc2, tc2, no_p, no_q);
866  } else {
867  int nd_p = 1;
868  int nd_q = 1;
869  if (dp0 + dp3 < ((beta + (beta >> 1)) >> 3))
870  nd_p = 2;
871  if (dq0 + dq3 < ((beta + (beta >> 1)) >> 3))
872  nd_q = 2;
873  FUNC(loop_filter_luma_weak)(pix, xstride, ystride, tc, beta, no_p, no_q, nd_p, nd_q);
874  }
875  }
876  }
877 }
878 
879 static void FUNC(hevc_loop_filter_chroma)(uint8_t *_pix, ptrdiff_t _xstride,
880  ptrdiff_t _ystride, const int *_tc,
881  const uint8_t *_no_p, const uint8_t *_no_q)
882 {
883  int no_p, no_q;
884  ptrdiff_t xstride = _xstride / sizeof(pixel);
885  ptrdiff_t ystride = _ystride / sizeof(pixel);
886  const int size = 4;
887 
888  for (int j = 0; j < 2; j++) {
889  pixel *pix = (pixel *)_pix + j * size * ystride;
890  const int tc = _tc[j] << (BIT_DEPTH - 8);
891  if (tc > 0) {
892  no_p = _no_p[j];
893  no_q = _no_q[j];
894 
895  FUNC(loop_filter_chroma_weak)(pix, xstride, ystride, size, tc, no_p, no_q);
896  }
897  }
898 }
899 
900 static void FUNC(hevc_h_loop_filter_chroma)(uint8_t *pix, ptrdiff_t stride,
901  const int32_t *tc, const uint8_t *no_p,
902  const uint8_t *no_q)
903 {
904  FUNC(hevc_loop_filter_chroma)(pix, stride, sizeof(pixel), tc, no_p, no_q);
905 }
906 
907 static void FUNC(hevc_v_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, sizeof(pixel), stride, tc, no_p, no_q);
912 }
913 
914 static void FUNC(hevc_h_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
915  int beta, const int32_t *tc, const uint8_t *no_p,
916  const uint8_t *no_q)
917 {
919  beta, tc, no_p, no_q);
920 }
921 
922 static void FUNC(hevc_v_loop_filter_luma)(uint8_t *pix, ptrdiff_t stride,
923  int beta, const int32_t *tc, const uint8_t *no_p,
924  const uint8_t *no_q)
925 {
927  beta, tc, no_p, no_q);
928 }
929 
930 #undef P3
931 #undef P2
932 #undef P1
933 #undef P0
934 #undef Q0
935 #undef Q1
936 #undef Q2
937 #undef Q3
938 
939 #undef TP3
940 #undef TP2
941 #undef TP1
942 #undef TP0
943 #undef TQ0
944 #undef TQ1
945 #undef TQ2
946 #undef TQ3
_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:432
QPEL_FILTER
#define QPEL_FILTER(src, stride)
Definition: dsp_template.c:422
Q1
#define Q1
Definition: dsp_template.c:818
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:834
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:71
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:488
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
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:748
filter
void(* filter)(uint8_t *src, int stride, int qscale)
Definition: h263dsp.c:29
Q2
#define Q2
Definition: dsp_template.c:819
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:624
_src
uint8_t ptrdiff_t const uint8_t * _src
Definition: dsp.h:56
av_always_inline
#define av_always_inline
Definition: attributes.h:76
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:922
h2656_inter_template.c
IDCT_DC
#define IDCT_DC(H)
Definition: dsp_template.c:286
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:773
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:582
P0
#define P0
Definition: dsp_template.c:816
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:914
_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:826
pixel
uint8_t pixel
Definition: checkasm.h:186
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:460
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:814
TQ1
#define TQ1
Definition: dsp_template.c:828
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:813
bit_depth_template.c
abs
#define abs(x)
Definition: cuda_runtime.h:35
TP1
#define TP1
Definition: dsp_template.c:825
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
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:528
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:900
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:683
TP3
#define TP3
Definition: dsp_template.c:823
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
pixel
#define pixel
Definition: bit_depth_template.c:82
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:879
src2
const pixel * src2
Definition: h264pred_template.c:421
TQ2
#define TQ2
Definition: dsp_template.c:829
TQ0
#define TQ0
Definition: dsp_template.c:827
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:657
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:129
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:830
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
IDCT
#define IDCT(H)
Definition: dsp_template.c:261
P1
#define P1
Definition: dsp_template.c:815
int32_t
int32_t
Definition: audioconvert.c:56
TP2
#define TP2
Definition: dsp_template.c:824
add_residual16x16
static void FUNC() add_residual16x16(uint8_t *_dst, const int16_t *res, ptrdiff_t stride)
Definition: dsp_template.c:73
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:630
Q0
#define Q0
Definition: dsp_template.c:817
Q3
#define Q3
Definition: dsp_template.c:820
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:907
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:394
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:723
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 ox, intptr_t mx, intptr_t my, int width)
Definition: dsp_template.c:555
src
#define src
Definition: vp8dsp.c:248
h2656_sao_template.c