29 static const SoftFloat FLOAT_0_017776489257 = {0x1234, 12};
30 static const SoftFloat FLOAT_1374_40625 = {0xabcd, 25};
31 static const SoftFloat FLOAT_0_1249694824218 = {0xFFF, 15};
45 printf(
"test1 double=%d\n", (
int)(d1 * (1<<24)));
51 printf(
"test1 sf =%d\n",
av_sf2int(sf1, 24));
54 for(i= 0; i<100; i++){
58 for(j= 0; j<1000; j++){
63 printf(
"test2 double=%d\n", (
int)(d1 * (1<<24)));
65 for(i= 0; i<100; i++){
69 for(j= 0; j<1000; j++){
74 printf(
"test2 sf =%d (%d %d)\n",
av_sf2int(sf1, 24), sf1.exp, sf1.mant);
81 printf(
"test3 double: %.10lf\n", d3);
83 sf1 = FLOAT_0_017776489257;
84 sf2 = FLOAT_1374_40625;
85 sf3 = FLOAT_0_1249694824218;
88 printf(
"test3 softfloat: %.10lf (0x%08x %d)\n", (
double)
av_sf2double(sf3), sf3.
mant, sf3.
exp);
91 printf(
"test4 softfloat: %.10lf (0x%08x %d)\n", (
double)
av_sf2double(sf1), sf1.mant, sf1.exp);
93 printf(
"test4 softfloat: %.10lf (0x%08x %d)\n", (
double)
av_sf2double(sf1), sf1.mant, sf1.exp);
96 printf(
"test4 softfloat: %.10lf (0x%08x %d)\n", (
double)
av_sf2double(sf1), sf1.mant, sf1.exp);
98 printf(
"test4 softfloat: %.10lf (0x%08x %d)\n", (
double)
av_sf2double(sf1), sf1.mant, sf1.exp);
100 for(i= 0; i<4*36; i++){
105 errs = (double)s/ (1<<30) - sin(i*
M_PI/36);
106 errc = (double)c/ (1<<30) - cos(i*
M_PI/36);
107 if (fabs(errs) > 0.00000002 || fabs(errc) >0.001) {
108 printf(
"sincos FAIL %d %f %f %f %f\n", i, (
float)s/ (1<<30), (
float)c/ (1<<30), sin(i*
M_PI/36), cos(i*
M_PI/36));
void av_log_set_level(int level)
Set the log level.
static av_const SoftFloat av_div_sf(SoftFloat a, SoftFloat b)
b has to be normalized and not zero.
static av_const double av_sf2double(SoftFloat v)
static av_const SoftFloat av_normalize_sf(SoftFloat a)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static av_unused void av_sincos_sf(int a, int *s, int *c)
Rounding-to-nearest used.
static av_const int av_sf2int(SoftFloat v, int frac_bits)
Rounding is to -inf.
static av_const SoftFloat av_add_sf(SoftFloat a, SoftFloat b)
common internal and external API header
static av_const SoftFloat av_mul_sf(SoftFloat a, SoftFloat b)
static av_const SoftFloat av_int2sf(int v, int frac_bits)
Converts a mantisse and exponent to a SoftFloat.
int main(int argc, char **argv)