~ubuntu-branches/ubuntu/hardy/avidemux/hardy

« back to all changes in this revision

Viewing changes to avidemux/ADM_audiocodec/ADM_8bits.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-12-15 17:13:20 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061215171320-w79pvpehxx2fr217
Tags: 1:2.3.0-0.0ubuntu1
* Merge from debian-multimedia.org, remaining Ubuntu change:
  - desktop file,
  - no support for ccache and make -j.
* Closes Ubuntu: #69614.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
{
48
48
 
49
49
}
50
 
uint8_t ADM_Audiocodec8Bits::run( uint8_t * ptr, uint32_t nbIn, uint8_t * outptr,   uint32_t * nbOut)
 
50
uint8_t ADM_Audiocodec8Bits::run(uint8_t *inptr, uint32_t nbIn, float *outptr, uint32_t *nbOut)
51
51
{
52
 
        uint32_t n=0;
53
 
        int16_t o;
54
 
        int16_t *pout;
55
 
        int8_t *pin;
56
 
 
57
 
        pout=(int16_t *)outptr;
58
 
        pin=(int8_t *)ptr;
59
 
 
60
 
        for(n=nbIn;n>0;n--)
61
 
        {
62
 
                if(_unsign)
63
 
                        o=(*pin-128);
64
 
                else
65
 
                        o=*pin;                 
66
 
                o*=256;
67
 
                *pout=o;
68
 
                pin++;
69
 
                pout++;
70
 
        }
71
 
        *nbOut=nbIn<<1;
 
52
  float f;
 
53
        for (int n = 0; n < nbIn; n++) {
 
54
                f=(float) *inptr++;
 
55
                if(_unsign)
 
56
                        *(outptr++) = (f - 128.) / 256.;
 
57
                else
 
58
                        *(outptr++) = f / 256.;
 
59
        }
 
60
        *nbOut=nbIn;
72
61
        return 1;
73
 
 
74
62
}
75
63
 
76
64