aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-17 04:47:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-17 04:51:33 +0200
commitf8ae3a2108b612776e886d927b4a7289dde619f1 (patch)
treec10fc78e3c6340c9513f99faadf077ee6c7d2986 /libavcodec
parente6e7ba0ce3aadef32f7f16f706c4a0406b5bd70f (diff)
parent901ff51116f831c9082e14c80c7481dd3999aa30 (diff)
downloadffmpeg-f8ae3a2108b612776e886d927b4a7289dde619f1.tar.gz
Merge remote branch 'qatar/master'
12 files changed, 36 insertions(+), 81 deletions(-) yes thats 36 new lines in 14 commits * qatar/master: ffmpeg: fix -aspect cli option Restructure video filter implementation in ffmpeg.c. ffplay: remove audio_write_get_buf_size() forward declaration lavfi: print key-frame and picture type information in ff_dlog_ref() mathops: remove ancient confusing comment cws2fws: Improve error message wording. tools: Check the return value of write(). mpegaudio: move OUT_FMT macro to mpegaudiodec.c mpegaudio: remove OUT_MIN/MAX macros Add missing #includes to mp3_header_(de)compress bsf dct: fix indentation dct: bypass table allocation for DCT_II of size 32 h264dsp_mmx: Add #ifdefs around some mmxext functions on x86_64. Remove unused header mpegaudio3.h. Conflicts: ffmpeg.c libavcodec/mpegaudio.h libavcodec/mpegaudio3.h libavfilter/avfilter.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/dct.c37
-rw-r--r--libavcodec/mathops.h3
-rw-r--r--libavcodec/mp3_header_compress_bsf.c1
-rw-r--r--libavcodec/mp3_header_decompress_bsf.c1
-rw-r--r--libavcodec/mpegaudio.h15
-rw-r--r--libavcodec/mpegaudio3.h53
-rw-r--r--libavcodec/mpegaudiodec.c4
-rw-r--r--libavcodec/x86/h264dsp_mmx.c2
9 files changed, 30 insertions, 87 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index ac16e06df8..2b00575463 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -669,7 +669,6 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
-SKIPHEADERS += mpegaudio3.h
EXAMPLES = api
diff --git a/libavcodec/dct.c b/libavcodec/dct.c
index 83cf1b4896..ef3cd50a79 100644
--- a/libavcodec/dct.c
+++ b/libavcodec/dct.c
@@ -180,33 +180,36 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
int n = 1 << nbits;
int i;
+ memset(s, 0, sizeof(*s));
+
s->nbits = nbits;
s->inverse = inverse;
- ff_init_ff_cos_tabs(nbits+2);
+ if (inverse == DCT_II && nbits == 5) {
+ s->dct_calc = dct32_func;
+ } else {
+ ff_init_ff_cos_tabs(nbits+2);
- s->costab = ff_cos_tabs[nbits+2];
+ s->costab = ff_cos_tabs[nbits+2];
- s->csc2 = av_malloc(n/2 * sizeof(FFTSample));
+ s->csc2 = av_malloc(n/2 * sizeof(FFTSample));
- if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
- av_free(s->csc2);
- return -1;
- }
+ if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
+ av_free(s->csc2);
+ return -1;
+ }
- for (i = 0; i < n/2; i++)
- s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
+ for (i = 0; i < n/2; i++)
+ s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
- switch(inverse) {
- case DCT_I : s->dct_calc = ff_dct_calc_I_c; break;
- case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
- case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
- case DST_I : s->dct_calc = ff_dst_calc_I_c; break;
+ switch(inverse) {
+ case DCT_I : s->dct_calc = ff_dct_calc_I_c; break;
+ case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
+ case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
+ case DST_I : s->dct_calc = ff_dst_calc_I_c; break;
+ }
}
- if (inverse == DCT_II && nbits == 5)
- s->dct_calc = dct32_func;
-
s->dct32 = dct32;
if (HAVE_MMX) ff_dct_init_mmx(s);
diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index 4d88ed14c9..29b3cd0acb 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -45,9 +45,6 @@
#endif
#ifndef MULH
-//gcc 3.4 creates an incredibly bloated mess out of this
-//# define MULH(a,b) (((int64_t)(a) * (int64_t)(b))>>32)
-
static av_always_inline int MULH(int a, int b){
return ((int64_t)(a) * (int64_t)(b))>>32;
}
diff --git a/libavcodec/mp3_header_compress_bsf.c b/libavcodec/mp3_header_compress_bsf.c
index 006a3679e9..b67e78c046 100644
--- a/libavcodec/mp3_header_compress_bsf.c
+++ b/libavcodec/mp3_header_compress_bsf.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "mpegaudio.h"
diff --git a/libavcodec/mp3_header_decompress_bsf.c b/libavcodec/mp3_header_decompress_bsf.c
index f096d5e4fd..7af5a10e12 100644
--- a/libavcodec/mp3_header_decompress_bsf.c
+++ b/libavcodec/mp3_header_decompress_bsf.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "mpegaudio.h"
#include "mpegaudiodata.h"
diff --git a/libavcodec/mpegaudio.h b/libavcodec/mpegaudio.h
index 30ef349399..138085366f 100644
--- a/libavcodec/mpegaudio.h
+++ b/libavcodec/mpegaudio.h
@@ -35,8 +35,6 @@
#include "dsputil.h"
#include "dct.h"
-#define CONFIG_AUDIO_NONSHORT 0
-
/* max frame size, in samples */
#define MPA_FRAME_SIZE 1152
@@ -69,19 +67,9 @@
#if CONFIG_FLOAT
typedef float OUT_INT;
-#define OUT_FMT AV_SAMPLE_FMT_FLT
-#elif CONFIG_MPEGAUDIO_HP && CONFIG_AUDIO_NONSHORT
-typedef int32_t OUT_INT;
-#define OUT_MAX INT32_MAX
-#define OUT_MIN INT32_MIN
-#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 31)
-#define OUT_FMT AV_SAMPLE_FMT_S32
#else
typedef int16_t OUT_INT;
-#define OUT_MAX INT16_MAX
-#define OUT_MIN INT16_MIN
#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
-#define OUT_FMT AV_SAMPLE_FMT_S16
#endif
#if CONFIG_FLOAT
@@ -147,6 +135,9 @@ typedef struct MPADecodeContext {
DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT];
INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
GranuleDef granules[2][2]; /* Used in Layer 3 */
+#ifdef DEBUG
+ int frame_count;
+#endif
int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
int dither_state;
int error_recognition;
diff --git a/libavcodec/mpegaudio3.h b/libavcodec/mpegaudio3.h
deleted file mode 100644
index c374a59a76..0000000000
--- a/libavcodec/mpegaudio3.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2007 Michael Niedermayer
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/* layer 3 "granule" */
-typedef struct GranuleDef {
- uint8_t scfsi;
- int part2_3_length;
- int big_values;
- int global_gain;
- int scalefac_compress;
- uint8_t block_type;
- uint8_t switch_point;
- int table_select[3];
- int subblock_gain[3];
- uint8_t scalefac_scale;
- uint8_t count1table_select;
- int region_size[3]; /* number of huffman codes in each region */
- int preflag;
- int short_start, long_end; /* long/short band indexes */
- uint8_t scale_factors[40];
- int32_t sb_hybrid[SBLIMIT * 18]; /* 576 samples */
-} GranuleDef;
-
-void ff_mp3_init(void);
-
-/**
- * Compute huffman coded region sizes.
- */
-void ff_init_short_region(MPADecodeContext *s, GranuleDef *g);
-
-/**
- * Compute huffman coded region sizes.
- */
-void ff_init_long_region(MPADecodeContext *s, GranuleDef *g, int ra1, int ra2);
-
-void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g);
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index b1c9ef93a0..bdff815d4d 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -47,6 +47,7 @@
# define MULH3(x, y, s) ((s)*(y)*(x))
# define MULLx(x, y, s) ((y)*(x))
# define RENAME(a) a ## _float
+# define OUT_FMT AV_SAMPLE_FMT_FLT
#else
# define SHR(a,b) ((a)>>(b))
# define compute_antialias compute_antialias_integer
@@ -57,6 +58,7 @@
# define MULH3(x, y, s) MULH((s)*(x), y)
# define MULLx(x, y, s) MULL(x,y,s)
# define RENAME(a) a
+# define OUT_FMT AV_SAMPLE_FMT_S16
#endif
/****************/
@@ -490,7 +492,7 @@ static inline int round_sample(int64_t *sum)
int sum1;
sum1 = (int)((*sum) >> OUT_SHIFT);
*sum &= (1<<OUT_SHIFT)-1;
- return av_clip(sum1, OUT_MIN, OUT_MAX);
+ return av_clip_int16(sum1);
}
# define MULS(ra, rb) MUL64(ra, rb)
diff --git a/libavcodec/x86/h264dsp_mmx.c b/libavcodec/x86/h264dsp_mmx.c
index b331f94b5e..01791604d6 100644
--- a/libavcodec/x86/h264dsp_mmx.c
+++ b/libavcodec/x86/h264dsp_mmx.c
@@ -252,6 +252,7 @@ LF_IFUNC(v, chroma_intra, depth, avx)
LF_FUNCS( uint8_t, 8)
LF_FUNCS(uint16_t, 10)
+#if ARCH_X86_32
LF_FUNC (v8, luma, 8, mmxext)
static void ff_deblock_v_luma_8_mmxext(uint8_t *pix, int stride, int alpha, int beta, int8_t *tc0)
{
@@ -266,6 +267,7 @@ static void ff_deblock_v_luma_intra_8_mmxext(uint8_t *pix, int stride, int alpha
ff_deblock_v8_luma_intra_8_mmxext(pix+0, stride, alpha, beta);
ff_deblock_v8_luma_intra_8_mmxext(pix+8, stride, alpha, beta);
}
+#endif /* ARCH_X86_32 */
LF_FUNC (v, luma, 10, mmxext)
LF_IFUNC(v, luma_intra, 10, mmxext)