FFmpeg
Loading...
Searching...
No Matches
texturedsp.c
Go to the documentation of this file.
1/*
2 * Texture block decompression
3 * Copyright (C) 2009 Benjamin Dobell, Glass Echidna
4 * Copyright (C) 2012 Matthäus G. "Anteru" Chajdas (http://anteru.net)
5 * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 */
24
25#include <stddef.h>
26#include <stdint.h>
27
29#include "libavutil/common.h"
31#include "libavutil/libm.h"
32
33#include "texturedsp.h"
34
35#define RGBA(r, g, b, a) (((uint8_t)(r) << 0) | \
36 ((uint8_t)(g) << 8) | \
37 ((uint8_t)(b) << 16) | \
38 ((unsigned)(uint8_t)(a) << 24))
39
40static av_always_inline void extract_color(uint32_t colors[4],
41 uint16_t color0,
42 uint16_t color1,
43 int dxtn, int alpha)
44{
45 int tmp;
46 uint8_t r0, g0, b0, r1, g1, b1;
47 uint8_t a = dxtn ? 0 : 255;
48
49 tmp = (color0 >> 11) * 255 + 16;
50 r0 = (uint8_t) ((tmp / 32 + tmp) / 32);
51 tmp = ((color0 & 0x07E0) >> 5) * 255 + 32;
52 g0 = (uint8_t) ((tmp / 64 + tmp) / 64);
53 tmp = (color0 & 0x001F) * 255 + 16;
54 b0 = (uint8_t) ((tmp / 32 + tmp) / 32);
55
56 tmp = (color1 >> 11) * 255 + 16;
57 r1 = (uint8_t) ((tmp / 32 + tmp) / 32);
58 tmp = ((color1 & 0x07E0) >> 5) * 255 + 32;
59 g1 = (uint8_t) ((tmp / 64 + tmp) / 64);
60 tmp = (color1 & 0x001F) * 255 + 16;
61 b1 = (uint8_t) ((tmp / 32 + tmp) / 32);
62
63 if (dxtn || color0 > color1) {
64 colors[0] = RGBA(r0, g0, b0, a);
65 colors[1] = RGBA(r1, g1, b1, a);
66 colors[2] = RGBA((2 * r0 + r1) / 3,
67 (2 * g0 + g1) / 3,
68 (2 * b0 + b1) / 3,
69 a);
70 colors[3] = RGBA((2 * r1 + r0) / 3,
71 (2 * g1 + g0) / 3,
72 (2 * b1 + b0) / 3,
73 a);
74 } else {
75 colors[0] = RGBA(r0, g0, b0, a);
76 colors[1] = RGBA(r1, g1, b1, a);
77 colors[2] = RGBA((r0 + r1) / 2,
78 (g0 + g1) / 2,
79 (b0 + b1) / 2,
80 a);
81 colors[3] = RGBA(0, 0, 0, alpha);
82 }
83}
84
85static inline void dxt1_block_internal(uint8_t *dst, ptrdiff_t stride,
86 const uint8_t *block, uint8_t alpha)
87{
88 int x, y;
89 uint32_t colors[4];
90 uint16_t color0 = AV_RL16(block + 0);
91 uint16_t color1 = AV_RL16(block + 2);
92 uint32_t code = AV_RL32(block + 4);
93
94 extract_color(colors, color0, color1, 0, alpha);
95
96 for (y = 0; y < 4; y++) {
97 for (x = 0; x < 4; x++) {
98 uint32_t pixel = colors[code & 3];
99 code >>= 2;
100 AV_WL32(dst + x * 4, pixel);
101 }
102 dst += stride;
103 }
104}
105
106/**
107 * Decompress one block of a DXT1 texture and store the resulting
108 * RGBA pixels in 'dst'. Alpha component is fully opaque.
109 *
110 * @param dst output buffer.
111 * @param stride scanline in bytes.
112 * @param block block to decompress.
113 * @return how much texture data has been consumed.
114 */
115static int dxt1_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
116{
118
119 return 8;
120}
121
122/**
123 * Decompress one block of a DXT1 with 1-bit alpha texture and store
124 * the resulting RGBA pixels in 'dst'. Alpha is either fully opaque or
125 * fully transparent.
126 *
127 * @param dst output buffer.
128 * @param stride scanline in bytes.
129 * @param block block to decompress.
130 * @return how much texture data has been consumed.
131 */
132static int dxt1a_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
133{
135
136 return 8;
137}
138
139static inline void dxt3_block_internal(uint8_t *dst, ptrdiff_t stride,
140 const uint8_t *block)
141{
142 int x, y;
143 uint32_t colors[4];
144 uint16_t color0 = AV_RL16(block + 8);
145 uint16_t color1 = AV_RL16(block + 10);
146 uint32_t code = AV_RL32(block + 12);
147
148 extract_color(colors, color0, color1, 1, 0);
149
150 for (y = 0; y < 4; y++) {
151 const uint16_t alpha_code = AV_RL16(block + 2 * y);
152 uint8_t alpha_values[4];
153
154 alpha_values[0] = ((alpha_code >> 0) & 0x0F) * 17;
155 alpha_values[1] = ((alpha_code >> 4) & 0x0F) * 17;
156 alpha_values[2] = ((alpha_code >> 8) & 0x0F) * 17;
157 alpha_values[3] = ((alpha_code >> 12) & 0x0F) * 17;
158
159 for (x = 0; x < 4; x++) {
160 uint8_t alpha = alpha_values[x];
161 uint32_t pixel = colors[code & 3] | ((unsigned)alpha << 24);
162 code >>= 2;
163
164 AV_WL32(dst + x * 4, pixel);
165 }
166 dst += stride;
167 }
168}
169
170/** Convert a premultiplied alpha pixel to a straight alpha pixel. */
172{
173 int r = src[0];
174 int g = src[1];
175 int b = src[2];
176 int a = src[3]; /* unchanged */
177
178 if (a == 0)
179 return;
180
181 src[0] = (uint8_t) FFMIN(r * 255 / a, 255);
182 src[1] = (uint8_t) FFMIN(g * 255 / a, 255);
183 src[2] = (uint8_t) FFMIN(b * 255 / a, 255);
184}
185
186/**
187 * Decompress one block of a DXT2 texture and store the resulting
188 * RGBA pixels in 'dst'.
189 *
190 * @param dst output buffer.
191 * @param stride scanline in bytes.
192 * @param block block to decompress.
193 * @return how much texture data has been consumed.
194 */
195static int dxt2_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
196{
197 int x, y;
198
200
201 /* This format is DXT3, but returns premultiplied alpha. It needs to be
202 * converted because it's what lavc outputs (and swscale expects). */
203 for (y = 0; y < 4; y++)
204 for (x = 0; x < 4; x++)
205 premult2straight(dst + x * 4 + y * stride);
206
207 return 16;
208}
209
210/**
211 * Decompress one block of a DXT3 texture and store the resulting
212 * RGBA pixels in 'dst'.
213 *
214 * @param dst output buffer.
215 * @param stride scanline in bytes.
216 * @param block block to decompress.
217 * @return how much texture data has been consumed.
218 */
219static int dxt3_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
220{
222
223 return 16;
224}
225
226/**
227 * Decompress a BC 16x3 index block stored as
228 * h g f e
229 * d c b a
230 * p o n m
231 * l k j i
232 *
233 * Bits packed as
234 * | h | g | f | e | d | c | b | a | // Entry
235 * |765 432 107 654 321 076 543 210| // Bit
236 * |0000000000111111111112222222222| // Byte
237 *
238 * into 16 8-bit indices.
239 */
240static void decompress_indices(uint8_t *dst, const uint8_t *src)
241{
242 int block, i;
243
244 for (block = 0; block < 2; block++) {
245 int tmp = AV_RL24(src);
246
247 /* Unpack 8x3 bit from last 3 byte block */
248 for (i = 0; i < 8; i++)
249 dst[i] = (tmp >> (i * 3)) & 0x7;
250
251 src += 3;
252 dst += 8;
253 }
254}
255
256static inline void dxt5_block_internal(uint8_t *dst, ptrdiff_t stride,
257 const uint8_t *block)
258{
259 int x, y;
260 uint32_t colors[4];
261 uint8_t alpha_indices[16];
262 uint16_t color0 = AV_RL16(block + 8);
263 uint16_t color1 = AV_RL16(block + 10);
264 uint32_t code = AV_RL32(block + 12);
265 uint8_t alpha0 = *(block);
266 uint8_t alpha1 = *(block + 1);
267
268 decompress_indices(alpha_indices, block + 2);
269
270 extract_color(colors, color0, color1, 1, 0);
271
272 for (y = 0; y < 4; y++) {
273 for (x = 0; x < 4; x++) {
274 int alpha_code = alpha_indices[x + y * 4];
275 uint32_t pixel;
276 uint8_t alpha;
277
278 if (alpha_code == 0) {
279 alpha = alpha0;
280 } else if (alpha_code == 1) {
281 alpha = alpha1;
282 } else {
283 if (alpha0 > alpha1) {
284 alpha = (uint8_t) (((8 - alpha_code) * alpha0 +
285 (alpha_code - 1) * alpha1) / 7);
286 } else {
287 if (alpha_code == 6) {
288 alpha = 0;
289 } else if (alpha_code == 7) {
290 alpha = 255;
291 } else {
292 alpha = (uint8_t) (((6 - alpha_code) * alpha0 +
293 (alpha_code - 1) * alpha1) / 5);
294 }
295 }
296 }
297 pixel = colors[code & 3] | ((unsigned)alpha << 24);
298 code >>= 2;
299 AV_WL32(dst + x * 4, pixel);
300 }
301 dst += stride;
302 }
303}
304
305/**
306 * Decompress one block of a DXT4 texture and store the resulting
307 * RGBA pixels in 'dst'.
308 *
309 * @param dst output buffer.
310 * @param stride scanline in bytes.
311 * @param block block to decompress.
312 * @return how much texture data has been consumed.
313 */
314static int dxt4_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
315{
316 int x, y;
317
319
320 /* This format is DXT5, but returns premultiplied alpha. It needs to be
321 * converted because it's what lavc outputs (and swscale expects). */
322 for (y = 0; y < 4; y++)
323 for (x = 0; x < 4; x++)
324 premult2straight(dst + x * 4 + y * stride);
325
326 return 16;
327}
328
329/**
330 * Decompress one block of a DXT5 texture and store the resulting
331 * RGBA pixels in 'dst'.
332 *
333 * @param dst output buffer.
334 * @param stride scanline in bytes.
335 * @param block block to decompress.
336 * @return how much texture data has been consumed.
337 */
338static int dxt5_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
339{
341
342 return 16;
343}
344
345/**
346 * Convert a YCoCg buffer to RGBA.
347 *
348 * @param src input buffer.
349 * @param scaled variant with scaled chroma components and opaque alpha.
350 */
351static av_always_inline void ycocg2rgba(uint8_t *src, int scaled)
352{
353 int r = src[0];
354 int g = src[1];
355 int b = src[2];
356 int a = src[3];
357
358 int s = scaled ? (b >> 3) + 1 : 1;
359 int y = a;
360 int co = (r - 128) / s;
361 int cg = (g - 128) / s;
362
363 src[0] = av_clip_uint8(y + co - cg);
364 src[1] = av_clip_uint8(y + cg);
365 src[2] = av_clip_uint8(y - co - cg);
366 src[3] = scaled ? 255 : b;
367}
368
369/**
370 * Decompress one block of a DXT5 texture with classic YCoCg and store
371 * the resulting RGBA pixels in 'dst'. Alpha component is fully opaque.
372 *
373 * @param dst output buffer.
374 * @param stride scanline in bytes.
375 * @param block block to decompress.
376 * @return how much texture data has been consumed.
377 */
378static int dxt5y_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
379{
380 int x, y;
381
382 /* This format is basically DXT5, with luma stored in alpha.
383 * Run a normal decompress and then reorder the components. */
385
386 for (y = 0; y < 4; y++)
387 for (x = 0; x < 4; x++)
388 ycocg2rgba(dst + x * 4 + y * stride, 0);
389
390 return 16;
391}
392
393/**
394 * Decompress one block of a DXT5 texture with scaled YCoCg and store
395 * the resulting RGBA pixels in 'dst'. Alpha component is fully opaque.
396 *
397 * @param dst output buffer.
398 * @param stride scanline in bytes.
399 * @param block block to decompress.
400 * @return how much texture data has been consumed.
401 */
402static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
403{
404 int x, y;
405
406 /* This format is basically DXT5, with luma stored in alpha.
407 * Run a normal decompress and then reorder the components. */
409
410 for (y = 0; y < 4; y++)
411 for (x = 0; x < 4; x++)
412 ycocg2rgba(dst + x * 4 + y * stride, 1);
413
414 return 16;
415}
416
417static inline void rgtc_block_internal(uint8_t *dst, ptrdiff_t stride,
418 const uint8_t *block,
419 const int *color_tab, int mono, int offset, int pix_size)
420{
421 uint8_t indices[16];
422 int x, y;
423
424 decompress_indices(indices, block + 2);
425
426 /* Only one or two channels are stored at most, since it only used to
427 * compress specular (black and white) or normal (red and green) maps.
428 * Although the standard says to zero out unused components, many
429 * implementations fill all of them with the same value. */
430 for (y = 0; y < 4; y++) {
431 for (x = 0; x < 4; x++) {
432 int i = indices[x + y * 4];
433 /* Interval expansion from [-1 1] or [0 1] to [0 255]. */
434 int c = color_tab[i];
435
436 if (mono){
437 dst [x * pix_size + y * stride + offset] = (uint8_t)c;
438 }
439 else{
440 uint32_t pixel = RGBA(c, c, c, 255U);
441 AV_WL32(dst + x * pix_size + y * stride, pixel);
442 }
443 }
444 }
445}
446
447static inline void rgtc1_block_internal(uint8_t *dst, ptrdiff_t stride,
448 const uint8_t *block, int sign, int mono, int offset, int pix_size)
449{
450 int color_table[8];
451 int r0, r1;
452
453 if (sign) {
454 /* signed data is in [-128 127] so just offset it to unsigned
455 * and it can be treated exactly the same */
456 r0 = ((int8_t) block[0]) + 128;
457 r1 = ((int8_t) block[1]) + 128;
458 } else {
459 r0 = block[0];
460 r1 = block[1];
461 }
462
463 color_table[0] = r0;
464 color_table[1] = r1;
465
466 if (r0 > r1) {
467 /* 6 interpolated color values */
468 color_table[2] = (6 * r0 + 1 * r1) / 7; // bit code 010
469 color_table[3] = (5 * r0 + 2 * r1) / 7; // bit code 011
470 color_table[4] = (4 * r0 + 3 * r1) / 7; // bit code 100
471 color_table[5] = (3 * r0 + 4 * r1) / 7; // bit code 101
472 color_table[6] = (2 * r0 + 5 * r1) / 7; // bit code 110
473 color_table[7] = (1 * r0 + 6 * r1) / 7; // bit code 111
474 } else {
475 /* 4 interpolated color values */
476 color_table[2] = (4 * r0 + 1 * r1) / 5; // bit code 010
477 color_table[3] = (3 * r0 + 2 * r1) / 5; // bit code 011
478 color_table[4] = (2 * r0 + 3 * r1) / 5; // bit code 100
479 color_table[5] = (1 * r0 + 4 * r1) / 5; // bit code 101
480 color_table[6] = 0; /* min range */ // bit code 110
481 color_table[7] = 255; /* max range */ // bit code 111
482 }
483
485}
486
487/**
488 * Decompress one block of a RGRC1 texture with signed components
489 * and store the resulting RGBA pixels in 'dst'.
490 *
491 * @param dst output buffer.
492 * @param stride scanline in bytes.
493 * @param block block to decompress.
494 * @return how much texture data has been consumed.
495 */
496static int rgtc1s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
497{
498 rgtc1_block_internal(dst, stride, block, 1, 0, 0, 4);
499
500 return 8;
501}
502
503/**
504 * Decompress one block of a RGRC1 texture with unsigned components
505 * and store the resulting RGBA pixels in 'dst'.
506 *
507 * @param dst output buffer.
508 * @param stride scanline in bytes.
509 * @param block block to decompress.
510 * @return how much texture data has been consumed.
511 */
512static int rgtc1u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
513{
514 rgtc1_block_internal(dst, stride, block, 0, 0, 0, 4);
515
516 return 8;
517}
518
519/**
520 * Decompress one block of a RGTC1 texture with unsigned components
521 * and overwrite the alpha component in 'dst' (RGBA data).
522 *
523 * @param dst output buffer.
524 * @param stride scanline in bytes.
525 * @param block block to decompress.
526 * @return how much texture data has been consumed.
527 */
528static int rgtc1u_alpha_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
529{
530 rgtc1_block_internal(dst, stride, block, 0, 1, 3, 4);
531
532 return 8;
533}
534
535/**
536 * Decompress one block of a RGTC1 texture with unsigned components
537 * to Gray 8.
538 *
539 * @param dst output buffer.
540 * @param stride scanline in bytes.
541 * @param block block to decompress.
542 * @return how much texture data has been consumed.
543 */
544static int rgtc1u_gray_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
545{
546 rgtc1_block_internal(dst, stride, block, 0, 1, 0, 1);
547
548 return 8;
549}
550
551static inline void rgtc2_block_internal(uint8_t *dst, ptrdiff_t stride,
552 const uint8_t *block, int sign)
553{
554 /* 4x4 block containing 4 component pixels. */
555 uint8_t c0[4 * 4 * 4];
556 uint8_t c1[4 * 4 * 4];
557 int x, y;
558
559 /* Decompress the two channels separately and interleave them afterwards. */
560 rgtc1_block_internal(c0, 16, block, sign, 0, 0, 4);
561 rgtc1_block_internal(c1, 16, block + 8, sign, 0, 0, 4);
562
563 /* B is rebuilt exactly like a normal map. */
564 for (y = 0; y < 4; y++) {
565 for (x = 0; x < 4; x++) {
566 uint8_t *p = dst + x * 4 + y * stride;
567 int r = c0[x * 4 + y * 16];
568 int g = c1[x * 4 + y * 16];
569 int b = 127;
570
571 int d = (255 * 255 - r * r - g * g) / 2;
572 if (d > 0)
573 b = lrint(sqrtf(d));
574
575 p[0] = r;
576 p[1] = g;
577 p[2] = b;
578 p[3] = 255;
579 }
580 }
581}
582
583/**
584 * Decompress one block of a RGRC2 texture with signed components
585 * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
586 *
587 * @param dst output buffer.
588 * @param stride scanline in bytes.
589 * @param block block to decompress.
590 * @return how much texture data has been consumed.
591 */
592static int rgtc2s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
593{
595
596 return 16;
597}
598
599/**
600 * Decompress one block of a RGRC2 texture with unsigned components
601 * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
602 *
603 * @param dst output buffer.
604 * @param stride scanline in bytes.
605 * @param block block to decompress.
606 * @return how much texture data has been consumed.
607 */
608static int rgtc2u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
609{
611
612 return 16;
613}
614
615/**
616 * Decompress one block of a 3Dc texture with unsigned components
617 * and store the resulting RGBA pixels in 'dst'. Alpha is fully opaque.
618 *
619 * @param dst output buffer.
620 * @param stride scanline in bytes.
621 * @param block block to decompress.
622 * @return how much texture data has been consumed.
623 */
624static int dxn3dc_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
625{
626 int x, y;
628
629 /* This is the 3Dc variant of RGTC2, with swapped R and G. */
630 for (y = 0; y < 4; y++) {
631 for (x = 0; x < 4; x++) {
632 uint8_t *p = dst + x * 4 + y * stride;
633 FFSWAP(uint8_t, p[0], p[1]);
634 }
635 }
636
637 return 16;
638}
639
641{
642 c->dxt1_block = dxt1_block;
643 c->dxt1a_block = dxt1a_block;
644 c->dxt2_block = dxt2_block;
645 c->dxt3_block = dxt3_block;
646 c->dxt4_block = dxt4_block;
647 c->dxt5_block = dxt5_block;
648 c->dxt5y_block = dxt5y_block;
649 c->dxt5ys_block = dxt5ys_block;
650 c->rgtc1s_block = rgtc1s_block;
651 c->rgtc1u_block = rgtc1u_block;
652 c->rgtc1u_gray_block = rgtc1u_gray_block;
653 c->rgtc1u_alpha_block = rgtc1u_alpha_block;
654 c->rgtc2s_block = rgtc2s_block;
655 c->rgtc2u_block = rgtc2u_block;
656 c->dxn3dc_block = dxn3dc_block;
657}
658
659#define TEXTUREDSP_FUNC_NAME ff_texturedsp_exec_decompress_threads
660#define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(a, b, c)
661#include "texturedsp_template.c"
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
#define pixel
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
#define s(width, name)
Definition cbs_vp9.c:198
common internal and external API header
#define av_clip_uint8
Definition common.h:106
static __device__ float sqrtf(float a)
static int16_t block[64]
Definition dct.c:125
int a
static const int16_t alpha[]
Definition ilbcdata.h:55
#define r
Definition input.c:42
#define b
Definition input.c:43
#define AV_RL24(x)
#define AV_WL32(p, v)
#define AV_RL32(p)
#define AV_RL16(p)
unsigned offset
Definition libaomenc.c:763
Macro definitions for various function/variable attributes.
#define av_always_inline
Definition attributes.h:72
#define av_cold
Definition attributes.h:117
Replacements for frequently missing libm functions.
#define FFSWAP(type, a, b)
Definition macros.h:52
#define FFMIN(a, b)
Definition macros.h:49
static const uint64_t c1
Definition murmur3.c:52
const uint8_t * code
Definition spdifenc.c:433
#define stride
#define lrint
Definition tablegen.h:53
static uint8_t tmp[40]
Definition aes_ctr.c:52
#define src
Definition vp8dsp.c:248
static int rgtc1u_gray_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGTC1 texture with unsigned components to Gray 8.
Definition texturedsp.c:544
av_cold void ff_texturedsp_init(TextureDSPContext *c)
Definition texturedsp.c:640
static void dxt5_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition texturedsp.c:256
static int dxt4_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT4 texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:314
static void decompress_indices(uint8_t *dst, const uint8_t *src)
Decompress a BC 16x3 index block stored as h g f e d c b a p o n m l k j i.
Definition texturedsp.c:240
static int rgtc2u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGRC2 texture with unsigned components and store the resulting RGBA pixels ...
Definition texturedsp.c:608
static int dxt5_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT5 texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:338
static void rgtc_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block, const int *color_tab, int mono, int offset, int pix_size)
Definition texturedsp.c:417
static av_always_inline void ycocg2rgba(uint8_t *src, int scaled)
Convert a YCoCg buffer to RGBA.
Definition texturedsp.c:351
static av_always_inline void premult2straight(uint8_t *src)
Convert a premultiplied alpha pixel to a straight alpha pixel.
Definition texturedsp.c:171
static int dxn3dc_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a 3Dc texture with unsigned components and store the resulting RGBA pixels in...
Definition texturedsp.c:624
static int rgtc1u_alpha_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGTC1 texture with unsigned components and overwrite the alpha component in...
Definition texturedsp.c:528
static void dxt1_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block, uint8_t alpha)
Definition texturedsp.c:85
static int dxt1a_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT1 with 1-bit alpha texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:132
static int dxt1_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT1 texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:115
static int rgtc1s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGRC1 texture with signed components and store the resulting RGBA pixels in...
Definition texturedsp.c:496
static void dxt3_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Definition texturedsp.c:139
static void rgtc2_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block, int sign)
Definition texturedsp.c:551
static void rgtc1_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block, int sign, int mono, int offset, int pix_size)
Definition texturedsp.c:447
static int dxt5ys_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT5 texture with scaled YCoCg and store the resulting RGBA pixels in 'dst'...
Definition texturedsp.c:402
#define RGBA(r, g, b, a)
Definition texturedsp.c:35
static int dxt5y_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT5 texture with classic YCoCg and store the resulting RGBA pixels in 'dst...
Definition texturedsp.c:378
static int dxt2_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT2 texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:195
static av_always_inline void extract_color(uint32_t colors[4], uint16_t color0, uint16_t color1, int dxtn, int alpha)
Definition texturedsp.c:40
static int rgtc1u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGRC1 texture with unsigned components and store the resulting RGBA pixels ...
Definition texturedsp.c:512
static int dxt3_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a DXT3 texture and store the resulting RGBA pixels in 'dst'.
Definition texturedsp.c:219
static int rgtc2s_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
Decompress one block of a RGRC2 texture with signed components and store the resulting RGBA pixels in...
Definition texturedsp.c:592
Texture block (4x4) module.
const char * g
Definition vf_curves.c:128
static double b1(void *priv, double x, double y)
Definition vf_xfade.c:2034
static double b0(void *priv, double x, double y)
Definition vf_xfade.c:2033
static double c[64]
static const ColorEntry color_table[]
Definition xpmdec.c:51