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