swscale: Move extern declarations for tables to swscale_internal.h

Also add missing ff_ prefixes where necessary.
This commit is contained in:
Diego Biurrun 2013-08-15 13:38:12 +02:00
parent d258531502
commit aa2ba8c99e
6 changed files with 40 additions and 40 deletions

View File

@ -46,14 +46,14 @@ DECLARE_ALIGNED(8, static const uint8_t, dither_2x2_8)[2][8]={
{ 0, 4, 0, 4, 0, 4, 0, 4, },
};
DECLARE_ALIGNED(8, const uint8_t, dither_4x4_16)[4][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_4x4_16)[4][8] = {
{ 8, 4, 11, 7, 8, 4, 11, 7, },
{ 2, 14, 1, 13, 2, 14, 1, 13, },
{ 10, 6, 9, 5, 10, 6, 9, 5, },
{ 0, 12, 3, 15, 0, 12, 3, 15, },
};
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_32)[8][8] = {
{ 17, 9, 23, 15, 16, 8, 22, 14, },
{ 5, 29, 3, 27, 4, 28, 2, 26, },
{ 21, 13, 19, 11, 20, 12, 18, 10, },
@ -64,7 +64,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_32)[8][8]={
{ 1, 25, 7, 31, 0, 24, 6, 30, },
};
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_73)[8][8] = {
{ 0, 55, 14, 68, 3, 58, 17, 72, },
{ 37, 18, 50, 32, 40, 22, 54, 35, },
{ 9, 64, 5, 59, 13, 67, 8, 63, },
@ -76,7 +76,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_73)[8][8]={
};
#if 1
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] = {
{117, 62, 158, 103, 113, 58, 155, 100, },
{ 34, 199, 21, 186, 31, 196, 17, 182, },
{144, 89, 131, 76, 141, 86, 127, 72, },
@ -88,7 +88,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
};
#elif 1
// tries to correct a gamma of 1.5
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] = {
{ 0, 143, 18, 200, 2, 156, 25, 215, },
{ 78, 28, 125, 64, 89, 36, 138, 74, },
{ 10, 180, 3, 161, 16, 195, 8, 175, },
@ -100,7 +100,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
};
#elif 1
// tries to correct a gamma of 2.0
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] = {
{ 0, 124, 8, 193, 0, 140, 12, 213, },
{ 55, 14, 104, 42, 66, 19, 119, 52, },
{ 3, 168, 1, 145, 6, 187, 3, 162, },
@ -112,7 +112,7 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
};
#else
// tries to correct a gamma of 2.5
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_220)[8][8] = {
{ 0, 107, 3, 187, 0, 125, 6, 212, },
{ 39, 7, 86, 28, 49, 11, 102, 36, },
{ 1, 158, 0, 131, 3, 180, 1, 151, },
@ -314,7 +314,7 @@ yuv2mono_X_c_template(SwsContext *c, const int16_t *lumFilter,
const int16_t **alpSrc, uint8_t *dest, int dstW,
int y, enum AVPixelFormat target)
{
const uint8_t * const d128=dither_8x8_220[y&7];
const uint8_t * const d128 = ff_dither_8x8_220[y&7];
int i;
unsigned acc = 0;
@ -353,7 +353,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
enum AVPixelFormat target)
{
const int16_t *buf0 = buf[0], *buf1 = buf[1];
const uint8_t * const d128 = dither_8x8_220[y & 7];
const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
int yalpha1 = 4096 - yalpha;
int i;
@ -387,7 +387,7 @@ yuv2mono_1_c_template(SwsContext *c, const int16_t *buf0,
const int16_t *abuf0, uint8_t *dest, int dstW,
int uvalpha, int y, enum AVPixelFormat target)
{
const uint8_t * const d128 = dither_8x8_220[y & 7];
const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
int i;
for (i = 0; i < dstW; i += 8) {
@ -880,12 +880,12 @@ yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2,
dg2 = dither_2x2_8[ y & 1 ][0];
db2 = dither_2x2_8[(y & 1) ^ 1][1];
} else {
dr1 = dither_4x4_16[ y & 3 ][0];
dg1 = dither_4x4_16[ y & 3 ][1];
db1 = dither_4x4_16[(y & 3) ^ 3][0];
dr2 = dither_4x4_16[ y & 3 ][1];
dg2 = dither_4x4_16[ y & 3 ][0];
db2 = dither_4x4_16[(y & 3) ^ 3][1];
dr1 = ff_dither_4x4_16[ y & 3 ][0];
dg1 = ff_dither_4x4_16[ y & 3 ][1];
db1 = ff_dither_4x4_16[(y & 3) ^ 3][0];
dr2 = ff_dither_4x4_16[ y & 3 ][1];
dg2 = ff_dither_4x4_16[ y & 3 ][0];
db2 = ff_dither_4x4_16[(y & 3) ^ 3][1];
}
dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1];
@ -898,15 +898,15 @@ yuv2rgb_write(uint8_t *_dest, int i, unsigned Y1, unsigned Y2,
int dr1, dg1, db1, dr2, dg2, db2;
if (target == AV_PIX_FMT_RGB8 || target == AV_PIX_FMT_BGR8) {
const uint8_t * const d64 = dither_8x8_73[y & 7];
const uint8_t * const d32 = dither_8x8_32[y & 7];
const uint8_t * const d64 = ff_dither_8x8_73[y & 7];
const uint8_t * const d32 = ff_dither_8x8_32[y & 7];
dr1 = dg1 = d32[(i * 2 + 0) & 7];
db1 = d64[(i * 2 + 0) & 7];
dr2 = dg2 = d32[(i * 2 + 1) & 7];
db2 = d64[(i * 2 + 1) & 7];
} else {
const uint8_t * const d64 = dither_8x8_73 [y & 7];
const uint8_t * const d128 = dither_8x8_220[y & 7];
const uint8_t * const d64 = ff_dither_8x8_73 [y & 7];
const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
dr1 = db1 = d128[(i * 2 + 0) & 7];
dg1 = d64[(i * 2 + 0) & 7];
dr2 = db2 = d128[(i * 2 + 1) & 7];

View File

@ -35,7 +35,7 @@
#include "swscale_internal.h"
#include "swscale.h"
DECLARE_ALIGNED(8, const uint8_t, dither_8x8_128)[8][8] = {
DECLARE_ALIGNED(8, const uint8_t, ff_dither_8x8_128)[8][8] = {
{ 36, 68, 60, 92, 34, 66, 58, 90, },
{ 100, 4, 124, 28, 98, 2, 122, 26, },
{ 52, 84, 44, 76, 50, 82, 42, 74, },
@ -548,8 +548,8 @@ static int swScale(SwsContext *c, const uint8_t *src[],
lastInLumBuf, lastInChrBuf);
#endif
if (should_dither) {
c->chrDither8 = dither_8x8_128[chrDstY & 7];
c->lumDither8 = dither_8x8_128[dstY & 7];
c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
c->lumDither8 = ff_dither_8x8_128[dstY & 7];
}
if (dstY >= dstH - 2) {
/* hmm looks like we can't use MMX here without overwriting

View File

@ -720,6 +720,14 @@ static av_always_inline int usePal(enum AVPixelFormat pix_fmt)
extern const uint64_t ff_dither4[2];
extern const uint64_t ff_dither8[2];
extern const uint8_t ff_dither_4x4_16[4][8];
extern const uint8_t ff_dither_8x8_32[8][8];
extern const uint8_t ff_dither_8x8_73[8][8];
extern const uint8_t ff_dither_8x8_128[8][8];
extern const uint8_t ff_dither_8x8_220[8][8];
extern const int32_t ff_yuv2rgb_coeffs[8][4];
extern const AVClass sws_context_class;
/**

View File

@ -64,7 +64,6 @@ DECLARE_ALIGNED(8, static const uint8_t, dither_8x8_64)[8][8] = {
{ 24, 40, 20, 36, 27, 43, 23, 39,},
{ 56, 8, 52, 4, 59, 11, 55, 7,},
};
extern const uint8_t dither_8x8_128[8][8];
DECLARE_ALIGNED(8, static const uint8_t, dither_8x8_256)[8][8] = {
{ 72, 136, 120, 184, 68, 132, 116, 180,},
{ 200, 8, 248, 56, 196, 4, 244, 52,},
@ -875,7 +874,7 @@ static int planarCopyWrapper(SwsContext *c, const uint8_t *src[],
if (dst_depth == 9) { \
DITHER_COPY(dstPtr2, dstStride[plane] / 2, wfunc, \
srcPtr2, srcStride[plane] / 2, rfunc, \
dither_8x8_128, 7, clip9); \
ff_dither_8x8_128, 7, clip9); \
} else { \
DITHER_COPY(dstPtr2, dstStride[plane] / 2, wfunc, \
srcPtr2, srcStride[plane] / 2, rfunc, \

View File

@ -194,8 +194,6 @@ int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt)
format_entries[pix_fmt].is_supported_endianness : 0;
}
extern const int32_t ff_yuv2rgb_coeffs[8][4];
const char *sws_format_name(enum AVPixelFormat format)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);

View File

@ -35,11 +35,6 @@
#include "swscale.h"
#include "swscale_internal.h"
extern const uint8_t dither_4x4_16[4][8];
extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8];
const int32_t ff_yuv2rgb_coeffs[8][4] = {
{ 117504, 138453, 13954, 34903 }, /* no sequence_display_extension */
{ 117504, 138453, 13954, 34903 }, /* ITU-R Rec. 709 (1990) */
@ -409,7 +404,7 @@ CLOSEYUV2RGBFUNC(8)
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_12_ordered_dither, uint16_t, 0)
const uint8_t *d16 = dither_4x4_16[y & 3];
const uint8_t *d16 = ff_dither_4x4_16[y & 3];
#define PUTRGB12(dst, src, i, o) \
Y = src[2 * i]; \
@ -440,8 +435,8 @@ CLOSEYUV2RGBFUNC(8)
// r, g, b, dst_1, dst_2
YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
const uint8_t *d32 = dither_8x8_32[y & 7];
const uint8_t *d64 = dither_8x8_73[y & 7];
const uint8_t *d32 = ff_dither_8x8_32[y & 7];
const uint8_t *d64 = ff_dither_8x8_73[y & 7];
#define PUTRGB8(dst, src, i, o) \
Y = src[2 * i]; \
@ -471,8 +466,8 @@ YUV2RGBFUNC(yuv2rgb_c_8_ordered_dither, uint8_t, 0)
CLOSEYUV2RGBFUNC(8)
YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
const uint8_t * d64 = dither_8x8_73[y & 7];
const uint8_t *d128 = dither_8x8_220[y & 7];
const uint8_t * d64 = ff_dither_8x8_73[y & 7];
const uint8_t *d128 = ff_dither_8x8_220[y & 7];
int acc;
#define PUTRGB4D(dst, src, i, o) \
@ -504,8 +499,8 @@ YUV2RGBFUNC(yuv2rgb_c_4_ordered_dither, uint8_t, 0)
CLOSEYUV2RGBFUNC(4)
YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
const uint8_t *d64 = dither_8x8_73[y & 7];
const uint8_t *d128 = dither_8x8_220[y & 7];
const uint8_t *d64 = ff_dither_8x8_73[y & 7];
const uint8_t *d128 = ff_dither_8x8_220[y & 7];
#define PUTRGB4DB(dst, src, i, o) \
Y = src[2 * i]; \
@ -535,7 +530,7 @@ YUV2RGBFUNC(yuv2rgb_c_4b_ordered_dither, uint8_t, 0)
CLOSEYUV2RGBFUNC(8)
YUV2RGBFUNC(yuv2rgb_c_1_ordered_dither, uint8_t, 0)
const uint8_t *d128 = dither_8x8_220[y & 7];
const uint8_t *d128 = ff_dither_8x8_220[y & 7];
char out_1 = 0, out_2 = 0;
g = c->table_gU[128] + c->table_gV[128];