~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavcodec/resample.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Sample rate convertion for both audio and video
 
2
 * samplerate conversion for both audio and video
3
3
 * Copyright (c) 2000 Fabrice Bellard.
4
4
 *
5
5
 * This file is part of FFmpeg.
21
21
 
22
22
/**
23
23
 * @file resample.c
24
 
 * Sample rate convertion for both audio and video.
 
24
 * samplerate conversion for both audio and video
25
25
 */
26
26
 
27
27
#include "avcodec.h"
133
133
 
134
134
    if ( input_channels > 2)
135
135
      {
136
 
        av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.");
 
136
        av_log(NULL, AV_LOG_ERROR, "Resampling with input channels greater than 2 unsupported.\n");
137
137
        return NULL;
138
138
      }
139
139
 
140
140
    s = av_mallocz(sizeof(ReSampleContext));
141
141
    if (!s)
142
142
      {
143
 
        av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.");
 
143
        av_log(NULL, AV_LOG_ERROR, "Can't allocate memory for resample context.\n");
144
144
        return NULL;
145
145
      }
146
146
 
161
161
    if(s->filter_channels>2)
162
162
      s->filter_channels = 2;
163
163
 
164
 
    s->resample_context= av_resample_init(output_rate, input_rate, 16, 10, 0, 1.0);
 
164
#define TAPS 16
 
165
    s->resample_context= av_resample_init(output_rate, input_rate, TAPS, 10, 0, 0.8);
165
166
 
166
167
    return s;
167
168
}
184
185
 
185
186
    /* XXX: move those malloc to resample init code */
186
187
    for(i=0; i<s->filter_channels; i++){
187
 
        bufin[i]= (short*) av_malloc( (nb_samples + s->temp_len) * sizeof(short) );
 
188
        bufin[i]= av_malloc( (nb_samples + s->temp_len) * sizeof(short) );
188
189
        memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short));
189
190
        buftmp2[i] = bufin[i] + s->temp_len;
190
191
    }
191
192
 
192
193
    /* make some zoom to avoid round pb */
193
 
    lenout= (int)(nb_samples * s->ratio) + 16;
194
 
    bufout[0]= (short*) av_malloc( lenout * sizeof(short) );
195
 
    bufout[1]= (short*) av_malloc( lenout * sizeof(short) );
 
194
    lenout= 4*nb_samples * s->ratio + 16;
 
195
    bufout[0]= av_malloc( lenout * sizeof(short) );
 
196
    bufout[1]= av_malloc( lenout * sizeof(short) );
196
197
 
197
198
    if (s->input_channels == 2 &&
198
199
        s->output_channels == 1) {