annotate liba52/resample.c @ 4104:04ff8026d9c0 libavcodec

dont set the sampling rate just because 1 mp3 packet header says so (fixes playback speed on some old mencoder generated avis which where then dumped to mp3)
author michael
date Mon, 30 Oct 2006 02:19:55 +0000
parents e2aafe2aa2df
children 2d53ef5a97cb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3696
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
1 /*
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
2 * copyright (C) 2001 Arpad Gereoffy
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
3 *
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
4 * This file is part of a52dec, a free ATSC A-52 stream decoder.
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
5 * See http://liba52.sourceforge.net/ for updates.
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
6 *
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
7 * a52dec is free software; you can redistribute it and/or modify
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
8 * it under the terms of the GNU General Public License as published by
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
10 * (at your option) any later version.
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
11 *
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
12 * a52dec is distributed in the hope that it will be useful,
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
15 * GNU General Public License for more details.
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
16 *
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
17 * You should have received a copy of the GNU General Public License
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
18 * along with this program; if not, write to the Free Software
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
e2aafe2aa2df Add proper GPL headers.
diego
parents: 3330
diff changeset
20 */
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
21
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
22 // a52_resample_init should find the requested converter (from type flags ->
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
23 // given number of channels) and set up some function pointers...
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
24
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
25 // a52_resample() should do the conversion.
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
26
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
27 #include "a52.h"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
28 #include "mm_accel.h"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
29 #include "config.h"
3330
5f28e617c078 libavcodec/libpostproc ---> libpostproc
diego
parents: 2967
diff changeset
30 #include "../../libpostproc/mangle.h"
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
31
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
32 int (* a52_resample) (float * _f, int16_t * s16)=NULL;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
33
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
34 #include "resample_c.c"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
35
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
36 #ifdef ARCH_X86
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
37 #include "resample_mmx.c"
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
38 #endif
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
39
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
40 void* a52_resample_init(uint32_t mm_accel,int flags,int chans){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
41 void* tmp;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
42
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
43 #ifdef ARCH_X86
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
44 if(mm_accel&MM_ACCEL_X86_MMX){
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
45 tmp=a52_resample_MMX(flags,chans);
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
46 if(tmp){
1602
fdb8244da1e5 av_log patch(2 of ?) by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1412
diff changeset
47 if(a52_resample==NULL) av_log(NULL, AV_LOG_INFO, "Using MMX optimized resampler\n");
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
48 a52_resample=tmp;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
49 return tmp;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
50 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
51 }
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
52 #endif
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
53
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
54 tmp=a52_resample_C(flags,chans);
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
55 if(tmp){
1602
fdb8244da1e5 av_log patch(2 of ?) by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1412
diff changeset
56 if(a52_resample==NULL) av_log(NULL, AV_LOG_INFO, "No accelerated resampler found\n");
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
57 a52_resample=tmp;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
58 return tmp;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
59 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 1602
diff changeset
60
1602
fdb8244da1e5 av_log patch(2 of ?) by (Michel Bardiaux <mbardiaux at peaktime dot be>)
michael
parents: 1412
diff changeset
61 av_log(NULL, AV_LOG_ERROR, "Unimplemented resampler for mode 0x%X -> %d channels conversion - Contact MPlayer developers!\n", flags, chans);
1193
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
62 return NULL;
6a6dbba3da95 Utility functions (CRC calc & float->int converters)
arpi_esp
parents:
diff changeset
63 }