Changeset e6c4183305e9209735d6d8613ef8c7ef2b8e015c

Show
Ignore:
Timestamp:
11/10/02 14:24:35 (6 years ago)
Author:
Sigmund Augdal Helberg <sigmunau@videolan.org>
git-committer:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1036934675 +0000
git-parent:

[bc398338bcc7fe5d666001144a2ed0fe5501cbde]

git-author:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1036934675 +0000
Message:

./ChangeLog: added entry for the linear resampler
./modules/audio_filter/resampler/linear.c: This should allways generate the

right number of samples now. The morale is never base your floating point
calculations on the output of integer divitions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ChangeLog

    r32519eb re6c4183  
    22Not released yet 
    33 
     4  * ./modules/audio_filter/resampler/linear.c: new audio resampler based on 
     5    linear interpolation 
    46  * ./modules/gui/macosx/prefs.m: new configuration interface 
    57  * ./src/misc/netutils.c: GetMacAddress Darwin support 
  • modules/audio_filter/resampler/linear.c

    r802def2 re6c4183  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: linear.c,v 1.1 2002/11/07 21:09:59 sigmunau Exp $ 
     5 * $Id: linear.c,v 1.2 2002/11/10 13:24:35 sigmunau Exp $ 
    66 * 
    77 * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> 
     
    5656{ 
    5757    aout_filter_t * p_filter = (aout_filter_t *)p_this; 
    58     msg_Dbg( p_this, " trying the linear resampler"); 
    5958    if ( p_filter->input.i_rate == p_filter->output.i_rate 
    6059          || p_filter->input.i_format != p_filter->output.i_format 
     
    8685    int i_frame_bytes = i_nb_channels * sizeof(s32); 
    8786    int i_in, i_chan, i_out = 0; 
    88     double f_step = (float)i_in_nb/i_out_nb
     87    double f_step = (float)p_filter->input.i_rate / p_filter->output.i_rate
    8988    float f_pos = 1; 
     89     
    9090    for( i_in = 0 ; i_in < i_in_nb - 1; i_in++ ) 
    9191    { 
    9292        f_pos--; 
    93         while( f_pos < 1 ) 
     93        while( f_pos <= 1 ) 
    9494        { 
    9595            for( i_chan = i_nb_channels ; i_chan ; ) 
     
    105105        p_in += i_nb_channels; 
    106106    } 
    107     if ( f_step < 1 ) { 
    108         for( i_chan = i_nb_channels ; i_chan ; ) 
    109         { 
    110             i_chan--; 
    111             p_out[i_chan] = p_in[i_chan]; 
    112             i_out++; 
    113         } 
    114     } 
    115     if ( i_out != i_out_nb * i_nb_channels ) { 
    116         msg_Warn( p_aout, "mismatch in sample nubers: %d requested, %d generated", i_out_nb* i_nb_channels, i_out); 
     107     
     108    if ( i_out != i_out_nb * i_nb_channels ) 
     109    { 
     110        msg_Warn( p_aout, "mismatch in sample numbers: %d requested, " 
     111                  "%d generated", i_out_nb* i_nb_channels, i_out); 
    117112    } 
    118113