Changeset e6c4183305e9209735d6d8613ef8c7ef2b8e015c
- 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
| r32519eb |
re6c4183 |
|
| 2 | 2 | Not released yet |
|---|
| 3 | 3 | |
|---|
| | 4 | * ./modules/audio_filter/resampler/linear.c: new audio resampler based on |
|---|
| | 5 | linear interpolation |
|---|
| 4 | 6 | * ./modules/gui/macosx/prefs.m: new configuration interface |
|---|
| 5 | 7 | * ./src/misc/netutils.c: GetMacAddress Darwin support |
|---|
| r802def2 |
re6c4183 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * 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 $ |
|---|
| 6 | 6 | * |
|---|
| 7 | 7 | * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> |
|---|
| … | … | |
| 56 | 56 | { |
|---|
| 57 | 57 | aout_filter_t * p_filter = (aout_filter_t *)p_this; |
|---|
| 58 | | msg_Dbg( p_this, " trying the linear resampler"); |
|---|
| 59 | 58 | if ( p_filter->input.i_rate == p_filter->output.i_rate |
|---|
| 60 | 59 | || p_filter->input.i_format != p_filter->output.i_format |
|---|
| … | … | |
| 86 | 85 | int i_frame_bytes = i_nb_channels * sizeof(s32); |
|---|
| 87 | 86 | 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; |
|---|
| 89 | 88 | float f_pos = 1; |
|---|
| | 89 | |
|---|
| 90 | 90 | for( i_in = 0 ; i_in < i_in_nb - 1; i_in++ ) |
|---|
| 91 | 91 | { |
|---|
| 92 | 92 | f_pos--; |
|---|
| 93 | | while( f_pos < 1 ) |
|---|
| | 93 | while( f_pos <= 1 ) |
|---|
| 94 | 94 | { |
|---|
| 95 | 95 | for( i_chan = i_nb_channels ; i_chan ; ) |
|---|
| … | … | |
| 105 | 105 | p_in += i_nb_channels; |
|---|
| 106 | 106 | } |
|---|
| 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); |
|---|
| 117 | 112 | } |
|---|
| 118 | 113 | |
|---|