mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
tests: K&R formatting cosmetics for test programs
This commit is contained in:
parent
aa2e4bb058
commit
b481bbc32a
@ -31,7 +31,8 @@ int main(void)
|
||||
int out_len = 0;
|
||||
int in;
|
||||
|
||||
#define putb64() do { \
|
||||
#define putb64() \
|
||||
do { \
|
||||
putchar(b64[(i_bits << 6 >> i_shift) & 0x3f]); \
|
||||
out_len++; \
|
||||
i_shift -= 6; \
|
||||
|
@ -226,7 +226,10 @@ static void gen_image(int num, int w, int h)
|
||||
for (i = 0; i < w; i++) {
|
||||
x += c;
|
||||
y -= s;
|
||||
put_pixel(i, j, ipol(tab_r, x, y), ipol(tab_g, x, y), ipol(tab_b, x, y));
|
||||
put_pixel(i, j,
|
||||
ipol(tab_r, x, y),
|
||||
ipol(tab_g, x, y),
|
||||
ipol(tab_b, x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ uint64_t exp16_table[21]={
|
||||
};
|
||||
|
||||
// 16.16 fixpoint log()
|
||||
static int64_t log16(uint64_t a){
|
||||
static int64_t log16(uint64_t a)
|
||||
{
|
||||
int i;
|
||||
int out = 0;
|
||||
|
||||
@ -63,7 +64,8 @@ static int64_t log16(uint64_t a){
|
||||
|
||||
for (i = 20; i >= 0; i--) {
|
||||
int64_t b = exp16_table[i];
|
||||
if(a<(b<<16)) continue;
|
||||
if (a < (b << 16))
|
||||
continue;
|
||||
out |= 1 << i;
|
||||
a = ((a / b) << 16) + (((a % b) << 16) + b / 2) / b;
|
||||
}
|
||||
@ -73,8 +75,8 @@ static int64_t log16(uint64_t a){
|
||||
static uint64_t int_sqrt(uint64_t a)
|
||||
{
|
||||
uint64_t ret = 0;
|
||||
int s;
|
||||
uint64_t ret_sq = 0;
|
||||
int s;
|
||||
|
||||
for (s = 31; s >= 0; s--) {
|
||||
uint64_t b = ret_sq + (1ULL << (s * 2)) + (ret << s) * 2;
|
||||
@ -86,7 +88,8 @@ static uint64_t int_sqrt(uint64_t a)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc,char* argv[]){
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
uint64_t sse = 0;
|
||||
uint64_t dev;
|
||||
@ -152,7 +155,8 @@ int main(int argc,char* argv[]){
|
||||
}
|
||||
sse += (a - b) * (a - b);
|
||||
dist = abs(a - b);
|
||||
if (dist > maxdist) maxdist = dist;
|
||||
if (dist > maxdist)
|
||||
maxdist = dist;
|
||||
}
|
||||
size0 += s0;
|
||||
size1 += s1;
|
||||
@ -161,19 +165,18 @@ int main(int argc,char* argv[]){
|
||||
}
|
||||
|
||||
i = FFMIN(size0, size1) / len;
|
||||
if(!i) i=1;
|
||||
if (!i)
|
||||
i = 1;
|
||||
dev = int_sqrt(((sse / i) * F * F) + (((sse % i) * F * F) + i / 2) / i);
|
||||
if (sse)
|
||||
psnr= ((2*log16(max<<16) + log16(i) - log16(sse))*284619LL*F + (1LL<<31)) / (1LL<<32);
|
||||
psnr = ((2 * log16(max << 16) + log16(i) - log16(sse)) *
|
||||
284619LL * F + (1LL << 31)) / (1LL << 32);
|
||||
else
|
||||
psnr = 1000 * F - 1; // floating point free infinity :)
|
||||
|
||||
printf("stddev:%5d.%02d PSNR:%3d.%02d MAXDIFF:%5d bytes:%9d/%9d\n",
|
||||
(int)(dev / F), (int)(dev % F),
|
||||
(int)(psnr / F), (int)(psnr % F),
|
||||
maxdist,
|
||||
size0, size1);
|
||||
maxdist, size0, size1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,10 +77,16 @@ static void rgb24_to_yuv420p(uint8_t *lum, uint8_t *cb, uint8_t *cr,
|
||||
lum[1] = (FIX(0.29900) * r + FIX(0.58700) * g +
|
||||
FIX(0.11400) * b + ONE_HALF) >> SCALEBITS;
|
||||
|
||||
cb[0] = ((- FIX(0.16874) * r1 - FIX(0.33126) * g1 +
|
||||
FIX(0.50000) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
|
||||
cr[0] = ((FIX(0.50000) * r1 - FIX(0.41869) * g1 -
|
||||
FIX(0.08131) * b1 + 4 * ONE_HALF - 1) >> (SCALEBITS + 2)) + 128;
|
||||
cb[0] = 128 + ((- FIX(0.16874) * r1 -
|
||||
FIX(0.33126) * g1 +
|
||||
FIX(0.50000) * b1 +
|
||||
4 * ONE_HALF - 1)
|
||||
>> (SCALEBITS + 2));
|
||||
cr[0] = 128 + ((FIX(0.50000) * r1 -
|
||||
FIX(0.41869) * g1 -
|
||||
FIX(0.08131) * b1 +
|
||||
4 * ONE_HALF - 1)
|
||||
>> (SCALEBITS + 2));
|
||||
|
||||
cb++;
|
||||
cr++;
|
||||
|
Loading…
Reference in New Issue
Block a user