aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCompn <tempn@twmi.rr.com>2011-05-16 23:31:23 -0400
committerCompn <tempn@twmi.rr.com>2011-05-16 23:31:23 -0400
commit34b92dbd942f6aef50632bf86eb87bf3b0175b26 (patch)
tree0b66894590a0778142fc1ddefa0a466a21efbe4f
parentcb8b824a0899a086ed22eef84b0eedbcab6788c9 (diff)
parentf8ae3a2108b612776e886d927b4a7289dde619f1 (diff)
downloadffmpeg-34b92dbd942f6aef50632bf86eb87bf3b0175b26.tar.gz
Merge branch 'master' of git.videolan.org:ffmpeg
-rw-r--r--ffmpeg.c11
-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
-rw-r--r--tools/cws2fws.c19
-rw-r--r--tools/pktdumper.c6
12 files changed, 54 insertions, 99 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 5373b7593f..6ab6b9971a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -171,8 +171,6 @@ static int loop_output = AVFMT_NOOUTPUTLOOP;
static int qp_hist = 0;
#if CONFIG_AVFILTER
static char *vfilters = NULL;
-#else
-static unsigned int sws_flags = SWS_BICUBIC;
#endif
static int intra_only = 0;
@@ -289,6 +287,7 @@ typedef struct AVOutputStream {
int resample_pix_fmt;
float frame_aspect_ratio;
+
/* forced key frames */
int64_t *forced_kf_pts;
int forced_kf_count;
@@ -1642,7 +1641,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
}
#if CONFIG_AVFILTER
- if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
+ if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i];
if (ost->input_video_filter && ost->source_index == ist_index) {
@@ -1786,7 +1785,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
cont:
frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
- if(ost->picref)
+ if (ost->picref)
avfilter_unref_buffer(ost->picref);
}
#endif
@@ -3537,8 +3536,8 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
ost->frame_aspect_ratio = frame_aspect_ratio;
frame_aspect_ratio = 0;
#if CONFIG_AVFILTER
- ost->avfilter= vfilters;
- vfilters= NULL;
+ ost->avfilter = vfilters;
+ vfilters = NULL;
#endif
}
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)
diff --git a/tools/cws2fws.c b/tools/cws2fws.c
index aa7d690be3..b8535feaa4 100644
--- a/tools/cws2fws.c
+++ b/tools/cws2fws.c
@@ -35,14 +35,14 @@ int main(int argc, char *argv[])
fd_in = open(argv[1], O_RDONLY);
if (fd_in < 0)
{
- perror("Error while opening: ");
+ perror("Error opening input file");
exit(1);
}
fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
if (fd_out < 0)
{
- perror("Error while opening: ");
+ perror("Error opening output file");
close(fd_in);
exit(1);
}
@@ -69,7 +69,10 @@ int main(int argc, char *argv[])
// write out modified header
buf_in[0] = 'F';
- write(fd_out, &buf_in, 8);
+ if (write(fd_out, &buf_in, 8) < 8) {
+ perror("Error writing output file");
+ exit(1);
+ }
zstream.zalloc = NULL;
zstream.zfree = NULL;
@@ -101,7 +104,10 @@ int main(int argc, char *argv[])
zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
zstream.total_out-last_out);
- write(fd_out, &buf_out, zstream.total_out-last_out);
+ if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
+ perror("Error writing output file");
+ exit(1);
+ }
i += len;
@@ -120,7 +126,10 @@ int main(int argc, char *argv[])
buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
lseek(fd_out, 4, SEEK_SET);
- write(fd_out, &buf_in, 4);
+ if (write(fd_out, &buf_in, 4) < 4) {
+ perror("Error writing output file");
+ exit(1);
+ }
}
inflateEnd(&zstream);
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index ee60414060..ddb4b2b9fb 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -104,7 +104,11 @@ int main(int argc, char **argv)
//printf("open(\"%s\")\n", pktfilename);
if (!nowrite) {
fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
- write(fd, pkt.data, pkt.size);
+ err = write(fd, pkt.data, pkt.size);
+ if (err < 0) {
+ fprintf(stderr, "write: error %d\n", err);
+ return 1;
+ }
close(fd);
}
av_free_packet(&pkt);