FFmpeg
Loading...
Searching...
No Matches
uops_tmpl.c
Go to the documentation of this file.
1/**
2 * Copyright (C) 2026 Niklas Haas
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <libavutil/bswap.h>
22
23#include "uops_tmpl.h"
24
25#ifndef BIT_DEPTH
26# define BIT_DEPTH 8
27#endif
28
29#if IS_FLOAT && BIT_DEPTH == 32
30# define PIXEL_TYPE SWS_PIXEL_F32
31# define pixel_t float
32# define inter_t float
33# define uinter_t float
34# define vec3_t v3f32_t
35# define PX F32
36# define px f32
37#elif BIT_DEPTH == 32
38# define PIXEL_MAX 0xFFFFFFFFu
39# define PIXEL_SWAP av_bswap32
40# define pixel_t uint32_t
41# define inter_t int64_t
42# define uinter_t uint64_t
43# define PX U32
44# define px u32
45#elif BIT_DEPTH == 16
46# define PIXEL_MAX 0xFFFFu
47# define PIXEL_SWAP av_bswap16
48# define pixel_t uint16_t
49# define inter_t int64_t
50# define uinter_t uint64_t
51# define PX U16
52# define px u16
53#elif BIT_DEPTH == 8
54# define PIXEL_MAX 0xFFu
55# define pixel_t uint8_t
56# define inter_t int32_t
57# define uinter_t uint32_t
58# define PX U8
59# define px u8
60#else
61# error Invalid BIT_DEPTH
62#endif
63
64/* Every intermediate float result is cast to pixel_t, which rounds away the
65 * excess precision of x87 math for the same results as everywhere else */
66
67/*********************************
68 * Generic read/write operations *
69 *********************************/
70
71DECL_READ(read_planar, const SwsCompMask mask)
72{
74 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
75 if (X) x[i] = in0[i];
76 if (Y) y[i] = in1[i];
77 if (Z) z[i] = in2[i];
78 if (W) w[i] = in3[i];
79 }
80
81 if (X) iter->in[0] += SIZEOF_BLOCK;
82 if (Y) iter->in[1] += SIZEOF_BLOCK;
83 if (Z) iter->in[2] += SIZEOF_BLOCK;
84 if (W) iter->in[3] += SIZEOF_BLOCK;
85
86 CONTINUE(0, x, y, z, w);
87}
88
89DECL_READ(read_packed, const SwsCompMask mask)
90{
91 const int elems = W ? 4 : Z ? 3 : Y ? 2 : 1;
92
94 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
95 if (X) x[i] = in0[elems * i + 0];
96 if (Y) y[i] = in0[elems * i + 1];
97 if (Z) z[i] = in0[elems * i + 2];
98 if (W) w[i] = in0[elems * i + 3];
99 }
100
101 iter->in[0] += SIZEOF_BLOCK * elems;
102 CONTINUE(0, x, y, z, w);
103}
104
105DECL_WRITE(write_planar, const SwsCompMask mask)
106{
108 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
109 if (X) out0[i] = x[i];
110 if (Y) out1[i] = y[i];
111 if (Z) out2[i] = z[i];
112 if (W) out3[i] = w[i];
113 }
114
115 if (X) iter->out[0] += SIZEOF_BLOCK;
116 if (Y) iter->out[1] += SIZEOF_BLOCK;
117 if (Z) iter->out[2] += SIZEOF_BLOCK;
118 if (W) iter->out[3] += SIZEOF_BLOCK;
119}
120
121DECL_WRITE(write_packed, const SwsCompMask mask)
122{
123 const int elems = W ? 4 : Z ? 3 : Y ? 2 : 1;
124
126 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
127 if (X) out0[elems * i + 0] = x[i];
128 if (Y) out0[elems * i + 1] = y[i];
129 if (Z) out0[elems * i + 2] = z[i];
130 if (W) out0[elems * i + 3] = w[i];
131 }
132
133 iter->out[0] += SIZEOF_BLOCK * elems;
134}
135
136#if BIT_DEPTH == 8
137
139{
141
143 for (int i = 0; i < SWS_BLOCK_SIZE; i += 8) {
144 const pixel_t val = ((const pixel_t *) in0)[i >> 3];
145 x[i + 0] = (val >> 7) & 1;
146 x[i + 1] = (val >> 6) & 1;
147 x[i + 2] = (val >> 5) & 1;
148 x[i + 3] = (val >> 4) & 1;
149 x[i + 4] = (val >> 3) & 1;
150 x[i + 5] = (val >> 2) & 1;
151 x[i + 6] = (val >> 1) & 1;
152 x[i + 7] = (val >> 0) & 1;
153 }
154
155 iter->in[0] += SIZEOF_BLOCK >> 3;
156 CONTINUE(0, x, y, z, w);
157}
158
159DECL_READ(read_nibble, const SwsCompMask mask)
160{
162
164 for (int i = 0; i < SWS_BLOCK_SIZE; i += 2) {
165 const pixel_t val = in0[i >> 1];
166 x[i + 0] = val >> 4; /* high nibble */
167 x[i + 1] = val & 0xF; /* low nibble */
168 }
169
170 iter->in[0] += SIZEOF_BLOCK >> 1;
171 CONTINUE(0, x, y, z, w);
172}
173
174DECL_READ(read_palette, const SwsCompMask mask)
175{
177
179 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
180 const pixel_t index = in0[i];
181 const pixel_t *value = &in1[index * 4];
182 x[i] = value[0];
183 y[i] = value[1];
184 z[i] = value[2];
185 w[i] = value[3];
186 }
187
188 iter->in[0] += SIZEOF_BLOCK;
189 CONTINUE(0, x, y, z, w);
190}
191
192DECL_WRITE(write_bit, const SwsCompMask mask)
193{
195
197 for (int i = 0; i < SWS_BLOCK_SIZE; i += 8) {
198 out0[i >> 3] = x[i + 0] << 7 |
199 x[i + 1] << 6 |
200 x[i + 2] << 5 |
201 x[i + 3] << 4 |
202 x[i + 4] << 3 |
203 x[i + 5] << 2 |
204 x[i + 6] << 1 |
205 x[i + 7];
206 }
207
208 iter->out[0] += SIZEOF_BLOCK >> 3;
209}
210
211DECL_WRITE(write_nibble, const SwsCompMask mask)
212{
214
216 for (int i = 0; i < SWS_BLOCK_SIZE; i += 2)
217 out0[i >> 1] = x[i] << 4 | x[i + 1];
218
219 iter->out[0] += SIZEOF_BLOCK >> 1;
220}
221
222#endif /* BIT_DEPTH == 8 */
223
224SWS_FOR(PX, READ_PLANAR, DECL_IMPL_READ, read_planar)
225SWS_FOR(PX, READ_PACKED, DECL_IMPL_READ, read_packed)
226SWS_FOR(PX, READ_NIBBLE, DECL_IMPL_READ, read_nibble)
227SWS_FOR(PX, READ_BIT, DECL_IMPL_READ, read_bit)
228SWS_FOR(PX, READ_PALETTE, DECL_IMPL_READ, read_palette)
229SWS_FOR(PX, WRITE_PLANAR, DECL_IMPL_WRITE, write_planar)
230SWS_FOR(PX, WRITE_PACKED, DECL_IMPL_WRITE, write_packed)
231SWS_FOR(PX, WRITE_NIBBLE, DECL_IMPL_WRITE, write_nibble)
232SWS_FOR(PX, WRITE_BIT, DECL_IMPL_WRITE, write_bit)
233
234SWS_FOR_STRUCT(PX, READ_PLANAR, DECL_ENTRY)
235SWS_FOR_STRUCT(PX, READ_PACKED, DECL_ENTRY)
236SWS_FOR_STRUCT(PX, READ_NIBBLE, DECL_ENTRY)
237SWS_FOR_STRUCT(PX, READ_BIT, DECL_ENTRY)
238SWS_FOR_STRUCT(PX, READ_PALETTE, DECL_ENTRY)
239SWS_FOR_STRUCT(PX, WRITE_PLANAR, DECL_ENTRY)
240SWS_FOR_STRUCT(PX, WRITE_PACKED, DECL_ENTRY)
241SWS_FOR_STRUCT(PX, WRITE_NIBBLE, DECL_ENTRY)
242SWS_FOR_STRUCT(PX, WRITE_BIT, DECL_ENTRY)
243
244/*****************************
245 * Scaling / filtering reads *
246 *****************************/
247
249{
250 if (params->uop->par.filter.type != SWS_PIXEL_F32)
251 return AVERROR(ENOTSUP);
252
253 const SwsFilterWeights *filter = params->uop->data.kernel;
254
255 /* Pre-convert weights to float */
256 float *weights = ff_refstruct_calloc(filter->num_weights, sizeof(float));
257 if (!weights)
258 return AVERROR(ENOMEM);
259
260 for (int i = 0; i < filter->num_weights; i++)
261 weights[i] = (float) filter->weights[i] / SWS_FILTER_SCALE;
262
263 const SwsFilterPriv priv = {
264 .weights = weights,
265 .filter_size = filter->filter_size,
266 };
267
268 SWS_OP_PRIV_PACK(out, priv);
269 out->ref = priv.weights;
270 return 0;
271}
272
273/* Fully general vertical planar filter case */
274DECL_READ(read_planar_fv, const SwsCompMask mask, const SwsPixelType type)
275{
277 const SwsOpExec *exec = iter->exec;
278 const SwsFilterPriv *priv = SWS_OP_PRIV(impl);
279 const float *restrict weights = priv->weights;
280 const int filter_size = priv->filter_size;
281 weights += filter_size * iter->y;
282
283 block_t xs, ys, zs, ws;
284 if (X) memset(&xs.f32, 0, sizeof(xs.f32));
285 if (Y) memset(&ys.f32, 0, sizeof(ys.f32));
286 if (Z) memset(&zs.f32, 0, sizeof(zs.f32));
287 if (W) memset(&ws.f32, 0, sizeof(ws.f32));
288
289 for (int j = 0; j < filter_size; j++) {
290 const float weight = weights[j];
291
293 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
294 if (X) xs.f32[i] += (float) (weight * in0[i]);
295 if (Y) ys.f32[i] += (float) (weight * in1[i]);
296 if (Z) zs.f32[i] += (float) (weight * in2[i]);
297 if (W) ws.f32[i] += (float) (weight * in3[i]);
298 }
299
300 if (X) in0 = bump_ptr(in0, exec->in_stride[0]);
301 if (Y) in1 = bump_ptr(in1, exec->in_stride[1]);
302 if (Z) in2 = bump_ptr(in2, exec->in_stride[2]);
303 if (W) in3 = bump_ptr(in3, exec->in_stride[3]);
304 }
305
306 if (X) iter->in[0] += SIZEOF_BLOCK;
307 if (Y) iter->in[1] += SIZEOF_BLOCK;
308 if (Z) iter->in[2] += SIZEOF_BLOCK;
309 if (W) iter->in[3] += SIZEOF_BLOCK;
310
311 CONTINUE(sizeof(SwsFilterPriv), &xs, &ys, &zs, &ws);
312}
313
315{
316 if (params->uop->par.filter.type != SWS_PIXEL_F32)
317 return AVERROR(ENOTSUP);
318
319 SwsFilterWeights *filter = params->uop->data.kernel;
320 static_assert(SWS_FILTER_PAD_ROWS >= SWS_BLOCK_SIZE,
321 "filter weights contain sufficient padding for block over-read");
322
323 const SwsFilterPriv priv = {
324 .weights = av_refstruct_ref(filter->weights),
325 .filter_size = filter->filter_size,
326 };
327
328 SWS_OP_PRIV_PACK(out, priv);
329 out->ref = priv.weights;
330 return 0;
331}
332
333/* Fully general horizontal planar filter case */
334DECL_READ(read_planar_fh, const SwsCompMask mask, const SwsPixelType type)
335{
337 const SwsOpExec *exec = iter->exec;
338 const SwsFilterPriv *priv = SWS_OP_PRIV(impl);
339 const int *restrict weights = priv->weights;
340 const int filter_size = priv->filter_size;
341 const float scale = 1.0f / SWS_FILTER_SCALE;
342 const int xpos = iter->x;
343 weights += filter_size * iter->x;
344
345 block_t xs, ys, zs, ws;
346 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
347 const int offset = exec->in_offset_x[xpos + i];
348 pixel_t *start0 = bump_ptr(in0, offset);
349 pixel_t *start1 = bump_ptr(in1, offset);
350 pixel_t *start2 = bump_ptr(in2, offset);
351 pixel_t *start3 = bump_ptr(in3, offset);
352
353 inter_t sx = 0, sy = 0, sz = 0, sw = 0;
354 for (int j = 0; j < filter_size; j++) {
355 const int weight = weights[j];
356 if (X) sx += (inter_t) (weight * start0[j]);
357 if (Y) sy += (inter_t) (weight * start1[j]);
358 if (Z) sz += (inter_t) (weight * start2[j]);
359 if (W) sw += (inter_t) (weight * start3[j]);
360 }
361
362 if (X) xs.f32[i] = (float) sx * scale;
363 if (Y) ys.f32[i] = (float) sy * scale;
364 if (Z) zs.f32[i] = (float) sz * scale;
365 if (W) ws.f32[i] = (float) sw * scale;
366
367 weights += filter_size;
368 }
369
370 CONTINUE(sizeof(SwsFilterPriv), &xs, &ys, &zs, &ws);
371}
372
373SWS_FOR(PX, READ_PLANAR_FV, DECL_IMPL_READ, read_planar_fv)
374SWS_FOR(PX, READ_PLANAR_FH, DECL_IMPL_READ, read_planar_fh)
375SWS_FOR_STRUCT(PX, READ_PLANAR_FV, DECL_ENTRY, .setup = fn(setup_filter_v) )
376SWS_FOR_STRUCT(PX, READ_PLANAR_FH, DECL_ENTRY, .setup = fn(setup_filter_h) )
377
378/***************************
379 * Permutation and copying *
380 ***************************/
381
382DECL_FUNC(permute, const SwsCompMask mask, int num_moves,
383 int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5,
384 int8_t s0, int8_t s1, int8_t s2, int8_t s3, int8_t s4, int8_t s5)
385{
386 const int8_t dst[SWS_UOP_MOVE_MAX] = { d0, d1, d2, d3, d4, d5 };
387 const int8_t src[SWS_UOP_MOVE_MAX] = { s0, s1, s2, s3, s4, s5 };
388
389 pixel_t *ptr[5] = { NULL, x, y, z, w };
390 for (int n = 0; n < num_moves; n++)
391 ptr[dst[n] + 1] = ptr[src[n] + 1];
392
393 /* The unneeded registers may still alias the used ones, so point them
394 * back at the stack to avoid collisions */
395 block_t xx, yy, zz, ww;
396 CONTINUE(0,
397 X ? ptr[1] : xx.px,
398 Y ? ptr[2] : yy.px,
399 Z ? ptr[3] : zz.px,
400 W ? ptr[4] : ww.px);
401}
402
403DECL_FUNC(copy, const SwsCompMask mask, int num_moves,
404 int8_t d0, int8_t d1, int8_t d2, int8_t d3, int8_t d4, int8_t d5,
405 int8_t s0, int8_t s1, int8_t s2, int8_t s3, int8_t s4, int8_t s5)
406{
407 const size_t block_size = SWS_BLOCK_SIZE * sizeof(pixel_t);
408 const int8_t dst[SWS_UOP_MOVE_MAX] = { d0, d1, d2, d3, d4, d5 };
409 const int8_t src[SWS_UOP_MOVE_MAX] = { s0, s1, s2, s3, s4, s5 };
410
411 block_t data[5];
412 memcpy(&data[1].px, x, block_size);
413 memcpy(&data[2].px, y, block_size);
414 memcpy(&data[3].px, z, block_size);
415 memcpy(&data[4].px, w, block_size);
416
417 for (int n = 0; n < num_moves; n++)
418 data[dst[n] + 1] = data[src[n] + 1];
419
420 memcpy(x, &data[1].px, block_size);
421 memcpy(y, &data[2].px, block_size);
422 memcpy(z, &data[3].px, block_size);
423 memcpy(w, &data[4].px, block_size);
424
425 CONTINUE(0, x, y, z, w);
426}
427
428SWS_FOR(PX, PERMUTE, DECL_IMPL, permute)
430SWS_FOR_STRUCT(PX, PERMUTE, DECL_ENTRY)
432
433/*********************
434 * Format conversion *
435 *********************/
436
437#define DECL_CAST(DST, dst) \
438 DECL_FUNC(to_##dst, const SwsCompMask mask) \
439 { \
440 block_t xx, yy, zz, ww; \
441 \
442 SWS_LOOP \
443 for (int i = 0; i < SWS_BLOCK_SIZE; i++) { \
444 if (X) xx.dst[i] = x[i]; \
445 if (Y) yy.dst[i] = y[i]; \
446 if (Z) zz.dst[i] = z[i]; \
447 if (W) ww.dst[i] = w[i]; \
448 } \
449 \
450 CONTINUE(0, &xx, &yy, &zz, &ww); \
451 } \
452 \
453 SWS_FOR(PX, TO_##DST, DECL_IMPL, to_##dst) \
454 SWS_FOR_STRUCT(PX, TO_##DST, DECL_ENTRY)
455
456DECL_CAST(U8, u8)
457DECL_CAST(U16, u16)
458DECL_CAST(U32, u32)
459DECL_CAST(F32, f32)
460
461/********************
462 * Bit manipulation *
463 ********************/
464
465#if !IS_FLOAT
466DECL_FUNC(lshift, const SwsCompMask mask, const uint8_t amount)
467{
469 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
470 if (X) x[i] <<= amount;
471 if (Y) y[i] <<= amount;
472 if (Z) z[i] <<= amount;
473 if (W) w[i] <<= amount;
474 }
475
476 CONTINUE(0, x, y, z, w);
477}
478
479DECL_FUNC(rshift, const SwsCompMask mask, const uint8_t amount)
480{
482 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
483 if (X) x[i] >>= amount;
484 if (Y) y[i] >>= amount;
485 if (Z) z[i] >>= amount;
486 if (W) w[i] >>= amount;
487 }
488
489 CONTINUE(0, x, y, z, w);
490}
491#endif
492
493SWS_FOR(PX, LSHIFT, DECL_IMPL, lshift)
494SWS_FOR(PX, RSHIFT, DECL_IMPL, rshift)
495
496SWS_FOR_STRUCT(PX, LSHIFT, DECL_ENTRY)
498
499#ifdef PIXEL_SWAP
500DECL_FUNC(swap_bytes, const SwsCompMask mask)
501{
503 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
504 if (X) x[i] = PIXEL_SWAP(x[i]);
505 if (Y) y[i] = PIXEL_SWAP(y[i]);
506 if (Z) z[i] = PIXEL_SWAP(z[i]);
507 if (W) w[i] = PIXEL_SWAP(w[i]);
508 }
509
510 CONTINUE(0, x, y, z, w);
511}
512#endif /* PIXEL_SWAP */
513
514SWS_FOR(PX, SWAP_BYTES, DECL_IMPL, swap_bytes)
515SWS_FOR_STRUCT(PX, SWAP_BYTES, DECL_ENTRY)
516
517#ifdef PIXEL_MAX
518DECL_FUNC(expand_bit, const SwsCompMask mask)
519{
521 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
522 if (X) x[i] = x[i] ? PIXEL_MAX : 0;
523 if (Y) y[i] = y[i] ? PIXEL_MAX : 0;
524 if (Z) z[i] = z[i] ? PIXEL_MAX : 0;
525 if (W) w[i] = w[i] ? PIXEL_MAX : 0;
526 }
527
528 CONTINUE(0, x, y, z, w);
529}
530#endif
531
532#if BIT_DEPTH == 8
533DECL_FUNC(expand_pair, const SwsCompMask mask)
534{
535 block_t x16, y16, z16, w16;
536
538 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
539 if (X) x16.u16[i] = x[i] << 8 | x[i];
540 if (Y) y16.u16[i] = y[i] << 8 | y[i];
541 if (Z) z16.u16[i] = z[i] << 8 | z[i];
542 if (W) w16.u16[i] = w[i] << 8 | w[i];
543 }
544
545 CONTINUE(0, &x16, &y16, &z16, &w16);
546}
547
548DECL_FUNC(expand_quad, const SwsCompMask mask)
549{
550 block_t x32, y32, z32, w32;
551
553 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
554 if (X) x32.u32[i] = (uint32_t) x[i] << 24 | x[i] << 16 | x[i] << 8 | x[i];
555 if (Y) y32.u32[i] = (uint32_t) y[i] << 24 | y[i] << 16 | y[i] << 8 | y[i];
556 if (Z) z32.u32[i] = (uint32_t) z[i] << 24 | z[i] << 16 | z[i] << 8 | z[i];
557 if (W) w32.u32[i] = (uint32_t) w[i] << 24 | w[i] << 16 | w[i] << 8 | w[i];
558 }
559
560 CONTINUE(0, &x32, &y32, &z32, &w32);
561}
562#endif /* BIT_DEPTH == 8 */
563
564SWS_FOR(PX, EXPAND_BIT, DECL_IMPL, expand_bit)
565SWS_FOR(PX, EXPAND_PAIR, DECL_IMPL, expand_pair)
566SWS_FOR(PX, EXPAND_QUAD, DECL_IMPL, expand_quad)
567SWS_FOR_STRUCT(PX, EXPAND_BIT, DECL_ENTRY)
568SWS_FOR_STRUCT(PX, EXPAND_PAIR, DECL_ENTRY)
569SWS_FOR_STRUCT(PX, EXPAND_QUAD, DECL_ENTRY)
570
571/*************************
572 * Packing and unpacking *
573 ************************/
574
575#if !IS_FLOAT
577 const uint8_t bx, const uint8_t by,
578 const uint8_t bz, const uint8_t bw)
579{
580 const uint8_t sx = bw + bz + by;
581 const uint8_t sy = bw + bz;
582 const uint8_t sz = bw;
583 const uint8_t sw = 0;
584
585 const pixel_t mx = (1 << bx) - 1;
586 const pixel_t my = (1 << by) - 1;
587 const pixel_t mz = (1 << bz) - 1;
588 const pixel_t mw = (1 << bw) - 1;
589
591 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
592 const pixel_t val = x[i];
593 if (X) x[i] = (val >> sx) & mx;
594 if (Y) y[i] = (val >> sy) & my;
595 if (Z) z[i] = (val >> sz) & mz;
596 if (W) w[i] = (val >> sw) & mw;
597 }
598
599 CONTINUE(0, x, y, z, w);
600}
601
603 const uint8_t bx, const uint8_t by,
604 const uint8_t bz, const uint8_t bw)
605{
606 const uint8_t sx = bw + bz + by;
607 const uint8_t sy = bw + bz;
608 const uint8_t sz = bw;
609 const uint8_t sw = 0;
610
612 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
613 pixel_t val = 0;
614 if (X) val |= x[i] << sx;
615 if (Y) val |= y[i] << sy;
616 if (Z) val |= z[i] << sz;
617 if (W) val |= w[i] << sw;
618 x[i] = val;
619 }
620
621 CONTINUE(0, x, y, z, w);
622}
623#endif /* !IS_FLOAT */
624
625SWS_FOR(PX, UNPACK, DECL_IMPL, unpack)
626SWS_FOR(PX, PACK, DECL_IMPL, pack)
627SWS_FOR_STRUCT(PX, UNPACK, DECL_ENTRY)
628SWS_FOR_STRUCT(PX, PACK, DECL_ENTRY)
629
630/***********************
631 * Pixel data clearing *
632 ***********************/
633
634#ifdef PIXEL_MAX
635DECL_FUNC(clear, const SwsCompMask mask, const SwsCompMask one,
636 const SwsCompMask zero)
637{
638 #define ONE(N) SWS_COMP_TEST(one, N)
639 #define ZERO(N) SWS_COMP_TEST(zero, N)
640 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
641 const pixel_t cx = ONE(0) ? PIXEL_MAX : ZERO(0) ? 0 : priv->px[0];
642 const pixel_t cy = ONE(1) ? PIXEL_MAX : ZERO(1) ? 0 : priv->px[1];
643 const pixel_t cz = ONE(2) ? PIXEL_MAX : ZERO(2) ? 0 : priv->px[2];
644 const pixel_t cw = ONE(3) ? PIXEL_MAX : ZERO(3) ? 0 : priv->px[3];
645
647 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
648 if (X) x[i] = cx;
649 if (Y) y[i] = cy;
650 if (Z) z[i] = cz;
651 if (W) w[i] = cw;
652 }
653
654 CONTINUE(sizeof(pixel_t[4]), x, y, z, w);
655}
656#endif
657
658SWS_FOR(PX, CLEAR, DECL_IMPL, clear)
660
661/*************************
662 * Arithmetic operations *
663 *************************/
664
666{
667 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
668 const pixel_t scale = priv->px[0];
669
671 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
672 if (X) x[i] *= scale;
673 if (Y) y[i] *= scale;
674 if (Z) z[i] *= scale;
675 if (W) w[i] *= scale;
676 }
677
678 CONTINUE(sizeof(pixel_t), x, y, z, w);
679}
680
682{
683 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
684
686 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
687 if (X) x[i] += priv->px[0];
688 if (Y) y[i] += priv->px[1];
689 if (Z) z[i] += priv->px[2];
690 if (W) w[i] += priv->px[3];
691 }
692
693 CONTINUE(sizeof(pixel_t[4]), x, y, z, w);
694}
695
697{
698 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
699
701 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
702 if (X) x[i] = FFMIN(x[i], priv->px[0]);
703 if (Y) y[i] = FFMIN(y[i], priv->px[1]);
704 if (Z) z[i] = FFMIN(z[i], priv->px[2]);
705 if (W) w[i] = FFMIN(w[i], priv->px[3]);
706 }
707
708 CONTINUE(sizeof(pixel_t[4]), x, y, z, w);
709}
710
712{
713 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
714
716 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
717 if (X) x[i] = FFMAX(x[i], priv->px[0]);
718 if (Y) y[i] = FFMAX(y[i], priv->px[1]);
719 if (Z) z[i] = FFMAX(z[i], priv->px[2]);
720 if (W) w[i] = FFMAX(w[i], priv->px[3]);
721 }
722
723 CONTINUE(sizeof(pixel_t[4]), x, y, z, w);
724}
725
727SWS_FOR(PX, ADD, DECL_IMPL, add)
734
735/*************
736 * Dithering *
737 *************/
738
740{
741 const SwsUOp *uop = params->uop;
742 const SwsDitherUOp *dither = &uop->par.dither;
743 const int size = 1 << dither->size_log2;
744 if (size >= SWS_BLOCK_SIZE) {
745 /* No extra padding needed */
747 return 0;
748 }
749
750 const int stride = FFMAX(size, SWS_BLOCK_SIZE);
752 pixel_t *matrix = ff_refstruct_calloc(height, sizeof(pixel_t) * stride);
753 if (!matrix)
754 return AVERROR(ENOMEM);
756
757 /* Pad to multiple of block size. We don't need extra padding for the
758 * height because ff_sws_dither_height() already includes any padding
759 * necessary for the y_offset */
760 for (int y = 0; y < height; y++) {
761 pixel_t *row = &matrix[y * stride];
762 for (int x = 0; x < size; x++)
763 row[x] = uop->data.ptr[y * size + x].px;
764 for (int x = size; x < stride; x++)
765 row[x] = row[x % size];
766 }
767
768 return 0;
769}
770
772 const uint8_t off0, const uint8_t off1,
773 const uint8_t off2, const uint8_t off3,
774 const uint8_t size_log2)
775{
776 const int size = 1 << size_log2;
777 const int stride = FFMAX(size, SWS_BLOCK_SIZE);
778
779 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
780 const pixel_t *matrix = priv->ptr;
781 matrix += (iter->y & (size - 1)) * stride;
782 matrix += (iter->x & (size - 1)) & ~(SWS_BLOCK_SIZE - 1);
783
784 const pixel_t *const row0 = &matrix[off0 * stride];
785 const pixel_t *const row1 = &matrix[off1 * stride];
786 const pixel_t *const row2 = &matrix[off2 * stride];
787 const pixel_t *const row3 = &matrix[off3 * stride];
788
790 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
791 if (X) x[i] += row0[i];
792 if (Y) y[i] += row1[i];
793 if (Z) z[i] += row2[i];
794 if (W) w[i] += row3[i];
795 }
796
797 CONTINUE(sizeof(pixel_t *), x, y, z, w);
798}
799
800SWS_FOR(PX, DITHER, DECL_IMPL, dither)
801SWS_FOR_STRUCT(PX, DITHER, DECL_ENTRY, .setup = fn(setup_dither) )
802
803/*********************
804 * Linear operations *
805 *********************/
806
807typedef struct {
808 /* Stored in split form for convenience */
809 pixel_t m[4][4];
810 pixel_t k[4];
811} fn(LinCoeffs);
812
814{
815 const SwsUOp *uop = params->uop;
816 fn(LinCoeffs) c;
817
818 for (int i = 0; i < 4; i++) {
819 for (int j = 0; j < 4; j++)
820 c.m[i][j] = uop->data.mat4x5[i][j].px;
821 c.k[i] = uop->data.mat4x5[i][4].px;
822 }
823
825 return 0;
826}
827
828/**
829 * Fully general case for a 5x5 linear affine transformation. Should never be
830 * called without constant `mask`. This function will compile down to the
831 * appropriately optimized version for the required subset of operations when
832 * called with a constant mask.
833 */
834DECL_FUNC(linear, const SwsCompMask mask, const uint32_t one, const uint32_t zero)
835{
836 const fn(LinCoeffs) c = *(const fn(LinCoeffs) *) SWS_OP_PRIV(impl);
837
839 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
840 const pixel_t xx = x[i];
841 const pixel_t yy = y[i];
842 const pixel_t zz = z[i];
843 const pixel_t ww = w[i];
844
845#define LIN_VAL(I, J, val) \
846 ((one & SWS_MASK(I, J)) ? (val) : (pixel_t) ((uinter_t) c.m[I][J] * (val)))
847
848#define LIN_ROW(I, var) do { \
849 pixel_t tmp = (zero & SWS_MASK(I, 4)) ? 0 : c.k[I]; \
850 if (!(zero & SWS_MASK(I, 0))) tmp += LIN_VAL(I, 0, xx); \
851 if (!(zero & SWS_MASK(I, 1))) tmp += LIN_VAL(I, 1, yy); \
852 if (!(zero & SWS_MASK(I, 2))) tmp += LIN_VAL(I, 2, zz); \
853 if (!(zero & SWS_MASK(I, 3))) tmp += LIN_VAL(I, 3, ww); \
854 var[i] = tmp; \
855} while (0)
856
857 if (X) LIN_ROW(0, x);
858 if (Y) LIN_ROW(1, y);
859 if (Z) LIN_ROW(2, z);
860 if (W) LIN_ROW(3, w);
861 }
862
863 CONTINUE(sizeof(fn(LinCoeffs)), x, y, z, w);
864}
865
868
869/******************
870 * Look-up tables *
871 ******************/
872
873DECL_SETUP(setup_lut3d, params, out)
874{
875 const SwsLut3D *lut = params->uop->data.lut3d;
877 return 0;
878}
879
880#if IS_FLOAT
881av_always_inline static vec3_t fn(vec3)(v3u16_t v)
882{
883 return (vec3_t) { v.x, v.y, v.z };
884}
885
886#define lerp(a, b, w) ((pixel_t) ((a) + (pixel_t) ((w) * (pixel_t) ((pixel_t) (b) - (a)))))
887
888av_always_inline static
889pixel_t fn(sum4)(pixel_t w0, pixel_t a, pixel_t w1, pixel_t b,
890 pixel_t w2, pixel_t c, pixel_t w3, pixel_t d)
891{
892 pixel_t sum = (pixel_t) (w0 * a);
893 sum += (pixel_t) (w1 * b);
894 sum += (pixel_t) (w2 * c);
895 sum += (pixel_t) (w3 * d);
896 return sum;
897}
898
899av_always_inline static
900vec3_t fn(lerp3)(vec3_t a, vec3_t b, pixel_t w)
901{
902 return (vec3_t) {
903 lerp(a.x, b.x, w),
904 lerp(a.y, b.y, w),
905 lerp(a.z, b.z, w),
906 };
907}
908
909av_always_inline static
910vec3_t fn(lut3d_static)(const SwsLut3D *restrict lut3d, vec3_t rgb)
911{
912 const int r_base = (int) rgb.x;
913 const int g_base = (int) rgb.y;
914 const int b_base = (int) rgb.z;
915
916 int off0 = (r_base < INPUT_LUT_SIZE - 1);
917 int off1 = (g_base < INPUT_LUT_SIZE - 1) * INPUT_LUT_SIZE;
918 int off2 = (b_base < INPUT_LUT_SIZE - 1) * INPUT_LUT_SIZE * INPUT_LUT_SIZE;
919 pixel_t f0 = rgb.x - r_base;
920 pixel_t f1 = rgb.y - g_base;
921 pixel_t f2 = rgb.z - b_base;
922
923 /* Sort offsets descending by relative weight */
924 if (f0 < f1) {
925 FFSWAP(pixel_t, f0, f1);
926 FFSWAP(int, off0, off1);
927 }
928 if (f0 < f2) {
929 FFSWAP(pixel_t, f0, f2);
930 FFSWAP(int, off0, off2);
931 }
932 if (f1 < f2) {
933 FFSWAP(pixel_t, f1, f2);
934 FFSWAP(int, off1, off2);
935 }
936
937 /* Tetrahedral interpolation */
938 const pixel_t w0 = 1 - f0;
939 const pixel_t w1 = f0 - f1;
940 const pixel_t w2 = f1 - f2;
941 const pixel_t w3 = f2;
942
943 const v3u16_t *restrict base = &lut3d->input[b_base][g_base][r_base];
944 const vec3_t v0 = fn(vec3)(base[0]);
945 const vec3_t v1 = fn(vec3)(base[off0]);
946 const vec3_t v2 = fn(vec3)(base[off0 + off1]);
947 const vec3_t v3 = fn(vec3)(base[off0 + off1 + off2]);
948
949 return (vec3_t) {
950 fn(sum4)(w0, v0.x, w1, v1.x, w2, v2.x, w3, v3.x),
951 fn(sum4)(w0, v0.y, w1, v1.y, w2, v2.y, w3, v3.y),
952 fn(sum4)(w0, v0.z, w1, v1.z, w2, v2.z, w3, v3.z),
953 };
954}
955
956av_always_inline static
957vec3_t fn(lut3d_dynamic)(const SwsLut3D *restrict lut3d, vec3_t rgb)
958{
959 rgb.x *= (pixel_t) ((TONE_LUT_SIZE - 1) / (pixel_t) UINT16_MAX);
960
961 /* Linear interpolation */
962 const int Ix = (int) rgb.x;
963 const pixel_t If = rgb.x - Ix;
964
965 const v2u16_t a = lut3d->tone_map[Ix];
966 const v2u16_t b = lut3d->tone_map[Ix + 1];
967
968 const pixel_t k = lerp(a.y, b.y, If);
969 const pixel_t bias = (1 << 15) - k;
970 const pixel_t scale = k / (pixel_t) (1 << 15);
971
972 rgb.x = lerp(a.x, b.x, If);
973 rgb.y = bias + (pixel_t) (scale * rgb.y);
974 rgb.z = bias + (pixel_t) (scale * rgb.z);
975
976 /* Re-scale to output LUT size */
977 rgb.x *= (pixel_t) ((OUTPUT_LUT_SIZE_I - 1) / (pixel_t) UINT16_MAX);
978 rgb.y *= (pixel_t) ((OUTPUT_LUT_SIZE_PT - 1) / (pixel_t) UINT16_MAX);
979 rgb.z *= (pixel_t) ((OUTPUT_LUT_SIZE_PT - 1) / (pixel_t) UINT16_MAX);
980
981 /* Trilinear interpolation */
982 const int lo0 = (int) rgb.x;
983 const int lo1 = (int) rgb.y;
984 const int lo2 = (int) rgb.z;
985
986 const int hi0 = FFMIN(lo0 + 1, OUTPUT_LUT_SIZE_I - 1);
987 const int hi1 = FFMIN(lo1 + 1, OUTPUT_LUT_SIZE_PT - 1);
988 const int hi2 = FFMIN(lo2 + 1, OUTPUT_LUT_SIZE_PT - 1);
989
990 const pixel_t w0 = rgb.x - lo0;
991 const vec3_t c000 = fn(vec3)(lut3d->output[lo2][lo1][lo0]);
992 const vec3_t c001 = fn(vec3)(lut3d->output[lo2][lo1][hi0]);
993 const vec3_t c00 = fn(lerp3)(c000, c001, w0);
994 const vec3_t c010 = fn(vec3)(lut3d->output[lo2][hi1][lo0]);
995 const vec3_t c011 = fn(vec3)(lut3d->output[lo2][hi1][hi0]);
996 const vec3_t c01 = fn(lerp3)(c010, c011, w0);
997 const vec3_t c100 = fn(vec3)(lut3d->output[hi2][lo1][lo0]);
998 const vec3_t c101 = fn(vec3)(lut3d->output[hi2][lo1][hi0]);
999 const vec3_t c10 = fn(lerp3)(c100, c101, w0);
1000 const vec3_t c110 = fn(vec3)(lut3d->output[hi2][hi1][lo0]);
1001 const vec3_t c111 = fn(vec3)(lut3d->output[hi2][hi1][hi0]);
1002 const vec3_t c11 = fn(lerp3)(c110, c111, w0);
1003
1004 const pixel_t w1 = rgb.y - lo1;
1005 const vec3_t c0 = fn(lerp3)(c00, c01, w1);
1006 const vec3_t c1 = fn(lerp3)(c10, c11, w1);
1007
1008 const pixel_t w2 = rgb.z - lo2;
1009 return fn(lerp3)(c0, c1, w2);
1010}
1011
1012DECL_FUNC(lut3d, const SwsCompMask mask, const int dynamic)
1013{
1014 const SwsOpPriv *priv = SWS_OP_PRIV(impl);
1015 const SwsLut3D *restrict lut3d = priv->ptr;
1016
1017 SWS_LOOP
1018 for (int i = 0; i < SWS_BLOCK_SIZE; i++) {
1019 vec3_t c = { x[i], y[i], z[i] };
1020 c = fn(lut3d_static)(lut3d, c);
1021 if (dynamic)
1022 c = fn(lut3d_dynamic)(lut3d, c);
1023
1024 x[i] = c.x;
1025 y[i] = c.y;
1026 z[i] = c.z;
1027 }
1028
1029 CONTINUE(sizeof(SwsLut3D *), x, y, z, w);
1030}
1031#endif /* IS_FLOAT */
1032
1033SWS_FOR(PX, LUT_3D, DECL_IMPL, lut3d)
1034SWS_FOR_STRUCT(PX, LUT_3D, DECL_ENTRY, .setup = fn(setup_lut3d) )
1035
1036#undef PIXEL_MAX
1037#undef PIXEL_SWAP
1038#undef pixel_t
1039#undef inter_t
1040#undef uinter_t
1041#undef vec3_t
1042#undef PX
1043#undef px
#define fn(a)
#define ZERO
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
Definition dsp.h:67
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
Definition dsp.h:67
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:97
SwsAArch64OpImplParams params
Definition ops.c:52
static double val(void *priv, double ch)
Definition aeval.c:77
static double mz(int i, double w0, double r, double alpha)
Definition af_atilt.c:55
static FILE * out
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
Definition avassert.h:68
#define COPY(src, name)
static unsigned int BS_FUNC read_bit(BSCTX *bc)
Return one bit from the buffer.
#define MAX
Definition blend_modes.c:46
#define Y
Definition boxblur.h:37
byte swapping routines
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define xs(width, name, var, subs,...)
Definition cbs_vp9.c:222
#define RSHIFT(a, b)
Definition common.h:56
#define NULL
Definition coverity.c:32
#define min(a, b)
#define max(a, b)
#define SCALE(c)
Definition dcadata.c:7338
#define ADD(a, b)
static void permute(int16_t dst[64], const int16_t src[64], enum idct_permutation_type perm_type)
Definition dct.c:158
static int unpack(const uint8_t *src, const uint8_t *src_end, uint8_t *dst, int width, int height)
Unpack buffer.
Definition eatgv.c:73
double value
Definition eval.c:102
#define X
Definition f_ebur128.c:158
#define AVERROR(e)
Definition error.h:45
int index
Definition gxfenc.c:90
int a
static const int weights[]
Definition hevc_pel.c:32
static av_always_inline void scale(vec_s32 res[4], vec_s16 res_packed[2], const int shift)
#define b
Definition input.c:43
static int linear(InterplayACMContext *s, unsigned ind, unsigned col)
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
#define W(a, i, v)
Definition jpegls.h:119
enum MPFType type
Definition jpegmpfenc.c:55
#define ONE
Definition jrevdct.c:137
unsigned offset
Definition libaomenc.c:763
#define av_always_inline
Definition attributes.h:72
@ SWS_FILTER_PAD_ROWS
Definition filters.h:42
@ SWS_FILTER_SCALE
14-bit coefficients are picked to fit comfortably within int16_t for efficient SIMD processing (e....
Definition filters.h:40
@ TONE_LUT_SIZE
Definition lut3d.h:40
@ OUTPUT_LUT_SIZE_I
Definition lut3d.h:46
@ INPUT_LUT_SIZE
Definition lut3d.h:36
@ OUTPUT_LUT_SIZE_PT
Definition lut3d.h:47
uint8_t w
Definition llvidencdsp.c:39
static const uint16_t mask[17]
Definition lzw.c:38
#define FFSWAP(type, a, b)
Definition macros.h:52
#define FFMIN(a, b)
Definition macros.h:49
#define FFMAX(a, b)
Definition macros.h:47
static const uint64_t c1
Definition murmur3.c:52
const char data[16]
Definition mxf.c:155
int ff_sws_setup_vec4(const SwsImplParams *params, SwsImplResult *out)
Definition ops_chain.c:159
int ff_sws_setup_scalar(const SwsImplParams *params, SwsImplResult *out)
Definition ops_chain.c:144
static void ff_sws_op_priv_pack_refptr(SwsImplResult *out, const void *data)
Definition ops_chain.h:144
#define SWS_OP_PRIV_PACK(out, data)
Definition ops_chain.h:136
static double lerp(double a, double b, double x)
Definition perlin.c:75
#define MIN(a, b)
const void * av_refstruct_ref_c(const void *obj)
Analog of av_refstruct_ref(), but for constant objects.
Definition refstruct.c:150
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
Definition refstruct.c:141
const h264_weight_func weight
void * weights
Definition uops_tmpl.h:79
Represents a computed filter kernel.
Definition filters.h:91
Copyright (C) 2026 Niklas Haas.
int32_t * in_offset_x
Pixel offset map; for horizontal scaling, in bytes.
ptrdiff_t in_stride[4]
Definition uops.h:308
SwsUOpParams par
Definition uops.h:313
SwsPixel * ptr
Definition uops.h:318
union SwsUOp::@242237116251216327057105100216205033300341206345 data
SwsPixel mat4x5[4][5]
Definition uops.h:321
pixel_t m[4][4]
Definition uops_tmpl.c:809
pixel_t k[4]
Definition uops_tmpl.c:810
Definition rpzaenc.c:60
#define stride
static void * ff_refstruct_calloc(size_t n, size_t size)
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:99
#define PIXEL_MAX
Definition tiny_ssim.c:40
int size
void * ptr
Definition uops_tmpl.h:72
SwsDitherUOp dither
Definition uops.h:304
uint32_t u32[SWS_BLOCK_SIZE]
Definition uops_tmpl.h:46
float f32[SWS_BLOCK_SIZE]
Definition uops_tmpl.h:45
uint16_t u16[SWS_BLOCK_SIZE]
Definition uops_tmpl.h:47
int ff_sws_dither_height(const SwsDitherUOp *dither)
Computes (1 << size_log2) + MAX(y_offset).
Definition uops.c:218
SwsPixelType
Definition uops.h:40
@ SWS_PIXEL_F32
Definition uops.h:45
#define SWS_UOP_MOVE_MAX
Definition uops.h:246
#define SWS_COMP_ELEMS(N)
Definition uops.h:136
uint8_t SwsCompMask
Bit-mask of components.
Definition uops.h:129
#define SWS_FOR(TYPE, UOP, MACRO,...)
Definition uops_macros.h:17
#define SWS_FOR_STRUCT(TYPE, UOP, MACRO,...)
Definition uops_macros.h:19
#define DECL_CAST(DST, dst)
Definition uops_tmpl.c:437
#define LIN_ROW(I, var)
#define DECL_IMPL_WRITE(...)
Definition uops_tmpl.h:162
#define SWS_OP_PRIV(impl)
Definition uops_tmpl.h:75
#define DECL_WRITE(NAME,...)
Definition uops_tmpl.h:124
#define DECL_IMPL_READ(...)
Definition uops_tmpl.h:157
#define Z
Definition uops_tmpl.h:108
#define DECL_FUNC(NAME,...)
Definition uops_tmpl.h:112
#define bump_ptr(ptr, bump)
Definition uops_tmpl.h:103
#define DECL_IMPL(FUNC, NAME, TYPE, UOP,...)
Definition uops_tmpl.h:148
#define SIZEOF_BLOCK
Definition uops_tmpl.h:51
#define SWS_BLOCK_SIZE
Copyright (C) 2026 Niklas Haas.
Definition uops_tmpl.h:41
#define DECL_READ(NAME,...)
Definition uops_tmpl.h:119
#define SWS_LOOP
Definition uops_tmpl.h:93
#define DECL_ENTRY(SETUP, NAME,...)
Definition uops_tmpl.h:168
#define CONTINUE(N,...)
Definition uops_tmpl.h:136
#define DECL_SETUP(NAME, PARAMS, OUT)
Definition uops_tmpl.h:143
static const uint16_t dither[8][8]
Definition vf_gradfun.c:46
#define LINEAR
static void copy(const float *p1, float *p2, const int length)
uint8_t base
Definition vp3data.h:128
static int bias(int x, int c)
Definition vqcdec.c:115
static double c[64]
#define CLEAR(destin)
Definition wavpackenc.c:50
static int setup_linear(const SwsImplParams *params, SwsImplResult *out)
Definition ops.c:319
static int setup_filter_v(const SwsImplParams *params, SwsImplResult *out)
Definition ops.c:55
static int setup_dither(const SwsImplParams *params, SwsImplResult *out)
Definition ops.c:296
static int setup_filter_h(const SwsImplParams *params, SwsImplResult *out)
Definition ops.c:87