~ubuntu-branches/ubuntu/intrepid/gstreamer0.10-ffmpeg/intrepid

« back to all changes in this revision

Viewing changes to gst-libs/ext/ffmpeg/libavutil/intfloat_readwrite.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-12-13 23:10:28 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061213231028-gb7p40u24i5dk331
Tags: 0.10.2-0ubuntu1
* Sync with pkg-gstreamer SVN:
  + debian/rules:
    - Enable the encoders again
* debian/control:
  + Add part about encoders to the description again

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "intfloat_readwrite.h"
28
28
 
29
29
double av_int2dbl(int64_t v){
30
 
    if(v+v > 0xFFELLU<<52)
 
30
    if(v+v > 0xFFEULL<<52)
31
31
        return 0.0/0.0;
32
32
    return ldexp(((v&((1LL<<52)-1)) + (1LL<<52)) * (v>>63|1), (v>>52&0x7FF)-1075);
33
33
}
43
43
    int e, i;
44
44
 
45
45
    for (i = 0; i < 8; i++)
46
 
        m |= (uint64_t)ext.mantissa[i]<<(56-(i<<3));
 
46
        m = (m<<8) + ext.mantissa[i];
47
47
    e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1];
48
48
    if (e == 0x7fff && m)
49
49
        return 0.0/0.0;
51
51
                             * mantissa bit is written as opposed to the
52
52
                             * single and double precision formats */
53
53
    if (ext.exponent[0]&0x80)
54
 
        return ldexp(-m, e);
 
54
        m= -m;
55
55
    return ldexp(m, e);
56
56
}
57
57
 
72
72
}
73
73
 
74
74
AVExtFloat av_dbl2ext(double d){
75
 
    struct AVExtFloat ext;
 
75
    struct AVExtFloat ext= {{0}};
76
76
    int e, i; double f; uint64_t m;
77
77
 
78
78
    f = fabs(frexp(d, &e));
83
83
        m = (uint64_t)ldexp(f, 64);
84
84
        for (i=0; i < 8; i++)
85
85
            ext.mantissa[i] = m>>(56-(i<<3));
86
 
    } else if (f == 0.0) {
87
 
        memset (&ext, 0, 10);
88
 
    } else {
 
86
    } else if (f != 0.0) {
89
87
        ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff;
90
 
        memset (&ext.mantissa, 0, 8);
91
88
        if (f != 1/0.0)
92
89
            ext.mantissa[0] = ~0;
93
90
    }