Browse code

Merge commit 'aa2ba8c99e5708884a56aea9c1d96e014866f8a3'

* commit 'aa2ba8c99e5708884a56aea9c1d96e014866f8a3':
swscale: Move extern declarations for tables to swscale_internal.h

Conflicts:
libswscale/output.c
libswscale/swscale_internal.h
libswscale/swscale_unscaled.c
libswscale/utils.c
libswscale/yuv2rgb.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2013/08/16 19:53:24
Showing 5 changed files
... ...
@@ -36,19 +36,19 @@
36 36
 #include "swscale.h"
37 37
 #include "swscale_internal.h"
38 38
 
39
-DECLARE_ALIGNED(8, const uint8_t, dither_2x2_4)[][8]={
39
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_4)[][8] = {
40 40
 {  1,   3,   1,   3,   1,   3,   1,   3, },
41 41
 {  2,   0,   2,   0,   2,   0,   2,   0, },
42 42
 {  1,   3,   1,   3,   1,   3,   1,   3, },
43 43
 };
44 44
 
45
-DECLARE_ALIGNED(8, const uint8_t, dither_2x2_8)[][8]={
45
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_2x2_8)[][8] = {
46 46
 {  6,   2,   6,   2,   6,   2,   6,   2, },
47 47
 {  0,   4,   0,   4,   0,   4,   0,   4, },
48 48
 {  6,   2,   6,   2,   6,   2,   6,   2, },
49 49
 };
50 50
 
51
-DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[][8]={
51
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_4x4_16)[][8] = {
52 52
 {  8,   4,  11,   7,   8,   4,  11,   7, },
53 53
 {  2,  14,   1,  13,   2,  14,   1,  13, },
54 54
 { 10,   6,   9,   5,  10,   6,   9,   5, },
... ...
@@ -56,7 +56,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[][8]={
56 56
 {  8,   4,  11,   7,   8,   4,  11,   7, },
57 57
 };
58 58
 
59
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[][8]={
59
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_32)[][8] = {
60 60
 { 17,   9,  23,  15,  16,   8,  22,  14, },
61 61
 {  5,  29,   3,  27,   4,  28,   2,  26, },
62 62
 { 21,  13,  19,  11,  20,  12,  18,  10, },
... ...
@@ -68,7 +68,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[][8]={
68 68
 { 17,   9,  23,  15,  16,   8,  22,  14, },
69 69
 };
70 70
 
71
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[][8]={
71
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_73)[][8] = {
72 72
 {  0,  55,  14,  68,   3,  58,  17,  72, },
73 73
 { 37,  18,  50,  32,  40,  22,  54,  35, },
74 74
 {  9,  64,   5,  59,  13,  67,   8,  63, },
... ...
@@ -81,7 +81,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[][8]={
81 81
 };
82 82
 
83 83
 #if 1
84
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
84
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
85 85
 {117,  62, 158, 103, 113,  58, 155, 100, },
86 86
 { 34, 199,  21, 186,  31, 196,  17, 182, },
87 87
 {144,  89, 131,  76, 141,  86, 127,  72, },
... ...
@@ -94,7 +94,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
94 94
 };
95 95
 #elif 1
96 96
 // tries to correct a gamma of 1.5
97
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
97
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
98 98
 {  0, 143,  18, 200,   2, 156,  25, 215, },
99 99
 { 78,  28, 125,  64,  89,  36, 138,  74, },
100 100
 { 10, 180,   3, 161,  16, 195,   8, 175, },
... ...
@@ -107,7 +107,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
107 107
 };
108 108
 #elif 1
109 109
 // tries to correct a gamma of 2.0
110
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
110
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
111 111
 {  0, 124,   8, 193,   0, 140,  12, 213, },
112 112
 { 55,  14, 104,  42,  66,  19, 119,  52, },
113 113
 {  3, 168,   1, 145,   6, 187,   3, 162, },
... ...
@@ -120,7 +120,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
120 120
 };
121 121
 #else
122 122
 // tries to correct a gamma of 2.5
123
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[][8]={
123
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[][8] = {
124 124
 {  0, 107,   3, 187,   0, 125,   6, 212, },
125 125
 { 39,   7,  86,  28,  49,  11, 102,  36, },
126 126
 {  1, 158,   0, 131,   3, 180,   1, 151, },
... ...
@@ -329,7 +329,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,
329 329
                       const int16_t **alpSrc, uint8_t *dest, int dstW,
330 330
                       int y, enum AVPixelFormat target)
331 331
 {
332
-    const uint8_t * const d128=dither_8x8_220[y&7];
332
+    const uint8_t * const d128 = ff_dither_8x8_220[y&7];
333 333
     int i;
334 334
     unsigned acc = 0;
335 335
     int err = 0;
... ...
@@ -382,7 +382,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
382 382
                       enum AVPixelFormat target)
383 383
 {
384 384
     const int16_t *buf0  = buf[0],  *buf1  = buf[1];
385
-    const uint8_t * const d128 = dither_8x8_220[y & 7];
385
+    const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
386 386
     int  yalpha1 = 4096 - yalpha;
387 387
     int i;
388 388
 
... ...
@@ -440,7 +440,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
440 440
                       const int16_t *abuf0, uint8_t *dest, int dstW,
441 441
                       int uvalpha, int y, enum AVPixelFormat target)
442 442
 {
443
-    const uint8_t * const d128 = dither_8x8_220[y & 7];
443
+    const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
444 444
     int i;
445 445
 
446 446
     if (c->dither == SWS_DITHER_ED) {
... ...
@@ -1188,26 +1188,26 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
1188 1188
         int dr1, dg1, db1, dr2, dg2, db2;
1189 1189
 
1190 1190
         if (target == AV_PIX_FMT_RGB565 || target == AV_PIX_FMT_BGR565) {
1191
-            dr1 = dither_2x2_8[ y & 1     ][0];
1192
-            dg1 = dither_2x2_4[ y & 1     ][0];
1193
-            db1 = dither_2x2_8[(y & 1) ^ 1][0];
1194
-            dr2 = dither_2x2_8[ y & 1     ][1];
1195
-            dg2 = dither_2x2_4[ y & 1     ][1];
1196
-            db2 = dither_2x2_8[(y & 1) ^ 1][1];
1191
+            dr1 = ff_dither_2x2_8[ y & 1     ][0];
1192
+            dg1 = ff_dither_2x2_4[ y & 1     ][0];
1193
+            db1 = ff_dither_2x2_8[(y & 1) ^ 1][0];
1194
+            dr2 = ff_dither_2x2_8[ y & 1     ][1];
1195
+            dg2 = ff_dither_2x2_4[ y & 1     ][1];
1196
+            db2 = ff_dither_2x2_8[(y & 1) ^ 1][1];
1197 1197
         } else if (target == AV_PIX_FMT_RGB555 || target == AV_PIX_FMT_BGR555) {
1198
-            dr1 = dither_2x2_8[ y & 1     ][0];
1199
-            dg1 = dither_2x2_8[ y & 1     ][1];
1200
-            db1 = dither_2x2_8[(y & 1) ^ 1][0];
1201
-            dr2 = dither_2x2_8[ y & 1     ][1];
1202
-            dg2 = dither_2x2_8[ y & 1     ][0];
1203
-            db2 = dither_2x2_8[(y & 1) ^ 1][1];
1198
+            dr1 = ff_dither_2x2_8[ y & 1     ][0];
1199
+            dg1 = ff_dither_2x2_8[ y & 1     ][1];
1200
+            db1 = ff_dither_2x2_8[(y & 1) ^ 1][0];
1201
+            dr2 = ff_dither_2x2_8[ y & 1     ][1];
1202
+            dg2 = ff_dither_2x2_8[ y & 1     ][0];
1203
+            db2 = ff_dither_2x2_8[(y & 1) ^ 1][1];
1204 1204
         } else {
1205
-            dr1 = dither_4x4_16[ y & 3     ][0];
1206
-            dg1 = dither_4x4_16[ y & 3     ][1];
1207
-            db1 = dither_4x4_16[(y & 3) ^ 3][0];
1208
-            dr2 = dither_4x4_16[ y & 3     ][1];
1209
-            dg2 = dither_4x4_16[ y & 3     ][0];
1210
-            db2 = dither_4x4_16[(y & 3) ^ 3][1];
1205
+            dr1 = ff_dither_4x4_16[ y & 3     ][0];
1206
+            dg1 = ff_dither_4x4_16[ y & 3     ][1];
1207
+            db1 = ff_dither_4x4_16[(y & 3) ^ 3][0];
1208
+            dr2 = ff_dither_4x4_16[ y & 3     ][1];
1209
+            dg2 = ff_dither_4x4_16[ y & 3     ][0];
1210
+            db2 = ff_dither_4x4_16[(y & 3) ^ 3][1];
1211 1211
         }
1212 1212
 
1213 1213
         dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
... ...
@@ -1220,15 +1220,15 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
1220 1220
         int dr1, dg1, db1, dr2, dg2, db2;
1221 1221
 
1222 1222
         if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) {
1223
-            const uint8_t * const d64 = dither_8x8_73[y & 7];
1224
-            const uint8_t * const d32 = dither_8x8_32[y & 7];
1223
+            const uint8_t * const d64 = ff_dither_8x8_73[y & 7];
1224
+            const uint8_t * const d32 = ff_dither_8x8_32[y & 7];
1225 1225
             dr1 = dg1 = d32[(i * 2 + 0) & 7];
1226 1226
             db1 =       d64[(i * 2 + 0) & 7];
1227 1227
             dr2 = dg2 = d32[(i * 2 + 1) & 7];
1228 1228
             db2 =       d64[(i * 2 + 1) & 7];
1229 1229
         } else {
1230
-            const uint8_t * const d64  = dither_8x8_73 [y & 7];
1231
-            const uint8_t * const d128 = dither_8x8_220[y & 7];
1230
+            const uint8_t * const d64  = ff_dither_8x8_73 [y & 7];
1231
+            const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
1232 1232
             dr1 = db1 = d128[(i * 2 + 0) & 7];
1233 1233
             dg1 =        d64[(i * 2 + 0) & 7];
1234 1234
             dr2 = db2 = d128[(i * 2 + 1) & 7];
... ...
@@ -35,7 +35,7 @@
35 35
 #include "swscale_internal.h"
36 36
 #include "swscale.h"
37 37
 
38
-DECLARE_ALIGNED(8, const uint8_t, dither_8x8_128)[8][8] = {
38
+DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_128)[][8] = {
39 39
     {  36, 68,  60, 92,  34, 66,  58, 90, },
40 40
     { 100,  4, 124, 28,  98,  2, 122, 26, },
41 41
     {  52, 84,  44, 76,  50, 82,  42, 74, },
... ...
@@ -557,8 +557,8 @@ static int swScale(SwsContext *c, const uint8_t *src[],
557 557
                               lastInLumBuf, lastInChrBuf);
558 558
 #endif
559 559
         if (should_dither) {
560
-            c->chrDither8 = dither_8x8_128[chrDstY & 7];
561
-            c->lumDither8 = dither_8x8_128[dstY    & 7];
560
+            c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
561
+            c->lumDither8 = ff_dither_8x8_128[dstY    & 7];
562 562
         }
563 563
         if (dstY >= dstH - 2) {
564 564
             /* hmm looks like we can't use MMX here without overwriting
... ...
@@ -815,6 +815,15 @@ static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
815 815
 extern const uint64_t ff_dither4[2];
816 816
 extern const uint64_t ff_dither8[2];
817 817
 
818
+extern const uint8_t ff_dither_2x2_4[3][8];
819
+extern const uint8_t ff_dither_2x2_8[3][8];
820
+extern const uint8_t ff_dither_4x4_16[5][8];
821
+extern const uint8_t ff_dither_8x8_32[9][8];
822
+extern const uint8_t ff_dither_8x8_73[9][8];
823
+extern const uint8_t ff_dither_8x8_128[8][8];
824
+extern const uint8_t ff_dither_8x8_220[9][8];
825
+
826
+extern const int32_t ff_yuv2rgb_coeffs[8][4];
818 827
 
819 828
 extern const AVClass sws_context_class;
820 829
 
... ...
@@ -226,8 +226,6 @@ int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
226 226
            format_entries[pix_fmt].is_supported_endianness : 0;
227 227
 }
228 228
 
229
-extern const int32_t ff_yuv2rgb_coeffs[8][4];
230
-
231 229
 #if FF_API_SWS_FORMAT_NAME
232 230
 const char *sws_format_name(enum AVPixelFormat format)
233 231
 {
... ...
@@ -35,13 +35,6 @@
35 35
 #include "swscale_internal.h"
36 36
 #include "libavutil/pixdesc.h"
37 37
 
38
-extern const uint8_t dither_2x2_4[3][8];
39
-extern const uint8_t dither_2x2_8[3][8];
40
-extern const uint8_t dither_4x4_16[5][8];
41
-extern const uint8_t dither_8x8_32[9][8];
42
-extern const uint8_t dither_8x8_73[9][8];
43
-extern const uint8_t dither_8x8_220[9][8];
44
-
45 38
 const int32_t ff_yuv2rgb_coeffs[8][4] = {
46 39
     { 117504, 138453, 13954, 34903 }, /* no sequence_display_extension */
47 40
     { 117504, 138453, 13954, 34903 }, /* ITU-R Rec. 709 (1990) */
... ...
@@ -390,9 +383,9 @@ ENDYUV2RGBLINE(24, 1)
390 390
 ENDYUV2RGBFUNC()
391 391
 
392 392
 YUV2RGBFUNC(yuv2rgb_c_16_ordered_dither, uint16_t, 0)
393
-    const uint8_t *d16 = dither_2x2_8[y & 1];
394
-    const uint8_t *e16 = dither_2x2_4[y & 1];
395
-    const uint8_t *f16 = dither_2x2_8[(y & 1)^1];
393
+    const uint8_t *d16 = ff_dither_2x2_8[y & 1];
394
+    const uint8_t *e16 = ff_dither_2x2_4[y & 1];
395
+    const uint8_t *f16 = ff_dither_2x2_8[(y & 1)^1];
396 396
 
397 397
 #define PUTRGB16(dst, src, i, o)                    \
398 398
     Y              = src[2 * i];                    \
... ...
@@ -421,8 +414,8 @@ YUV2RGBFUNC(yuv2rgb_c_16_ordered_dither, uint16_t, 0)
421 421
 CLOSEYUV2RGBFUNC(8)
422 422
 
423 423
 YUV2RGBFUNC(yuv2rgb_c_15_ordered_dither, uint16_t, 0)
424
-    const uint8_t *d16 = dither_2x2_8[y & 1];
425
-    const uint8_t *e16 = dither_2x2_8[(y & 1)^1];
424
+    const uint8_t *d16 = ff_dither_2x2_8[y & 1];
425
+    const uint8_t *e16 = ff_dither_2x2_8[(y & 1)^1];
426 426
 
427 427
 #define PUTRGB15(dst, src, i, o)                    \
428 428
     Y              = src[2 * i];                    \
... ...
@@ -452,7 +445,7 @@ CLOSEYUV2RGBFUNC(8)
452 452
 
453 453
 // r, g, b, dst_1, dst_2
454 454
 YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0)
455
-    const uint8_t *d16 = dither_4x4_16[y & 3];
455
+    const uint8_t *d16 = ff_dither_4x4_16[y & 3];
456 456
 
457 457
 #define PUTRGB12(dst, src, i, o)                    \
458 458
     Y              = src[2 * i];                    \
... ...
@@ -483,8 +476,8 @@ CLOSEYUV2RGBFUNC(8)
483 483
 
484 484
 // r, g, b, dst_1, dst_2
485 485
 YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
486
-    const uint8_t *d32 = dither_8x8_32[y & 7];
487
-    const uint8_t *d64 = dither_8x8_73[y & 7];
486
+    const uint8_t *d32 = ff_dither_8x8_32[y & 7];
487
+    const uint8_t *d64 = ff_dither_8x8_73[y & 7];
488 488
 
489 489
 #define PUTRGB8(dst, src, i, o)                     \
490 490
     Y              = src[2 * i];                    \
... ...
@@ -514,8 +507,8 @@ YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
514 514
 CLOSEYUV2RGBFUNC(8)
515 515
 
516 516
 YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
517
-    const uint8_t * d64 = dither_8x8_73[y & 7];
518
-    const uint8_t *d128 = dither_8x8_220[y & 7];
517
+    const uint8_t * d64 = ff_dither_8x8_73[y & 7];
518
+    const uint8_t *d128 = ff_dither_8x8_220[y & 7];
519 519
     int acc;
520 520
 
521 521
 #define PUTRGB4D(dst, src, i, o)                    \
... ...
@@ -547,8 +540,8 @@ YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
547 547
 CLOSEYUV2RGBFUNC(4)
548 548
 
549 549
 YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
550
-    const uint8_t *d64  = dither_8x8_73[y & 7];
551
-    const uint8_t *d128 = dither_8x8_220[y & 7];
550
+    const uint8_t *d64  = ff_dither_8x8_73[y & 7];
551
+    const uint8_t *d128 = ff_dither_8x8_220[y & 7];
552 552
 
553 553
 #define PUTRGB4DB(dst, src, i, o)                   \
554 554
     Y              = src[2 * i];                    \
... ...
@@ -578,7 +571,7 @@ YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
578 578
 CLOSEYUV2RGBFUNC(8)
579 579
 
580 580
 YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
581
-    const uint8_t *d128 = dither_8x8_220[y & 7];
581
+    const uint8_t *d128 = ff_dither_8x8_220[y & 7];
582 582
     char out_1 = 0, out_2 = 0;
583 583
     g = c->table_gU[128 + YUVRGB_TABLE_HEADROOM] + c->table_gV[128 + YUVRGB_TABLE_HEADROOM];
584 584