1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2011-05-17 04:47:05 +02:00
commit f8ae3a2108
12 changed files with 59 additions and 104 deletions

View File

@ -171,8 +171,6 @@ static int loop_output = AVFMT_NOOUTPUTLOOP;
static int qp_hist = 0; static int qp_hist = 0;
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
static char *vfilters = NULL; static char *vfilters = NULL;
#else
static unsigned int sws_flags = SWS_BICUBIC;
#endif #endif
static int intra_only = 0; static int intra_only = 0;
@ -289,6 +287,7 @@ typedef struct AVOutputStream {
int resample_pix_fmt; int resample_pix_fmt;
float frame_aspect_ratio; float frame_aspect_ratio;
/* forced key frames */ /* forced key frames */
int64_t *forced_kf_pts; int64_t *forced_kf_pts;
int forced_kf_count; int forced_kf_count;
@ -1642,7 +1641,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
} }
#if CONFIG_AVFILTER #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++) { for(i=0;i<nb_ostreams;i++) {
ost = ost_table[i]; ost = ost_table[i];
if (ost->input_video_filter && ost->source_index == ist_index) { if (ost->input_video_filter && ost->source_index == ist_index) {
@ -1786,7 +1785,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
cont: cont:
frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) && frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
if(ost->picref) if (ost->picref)
avfilter_unref_buffer(ost->picref); avfilter_unref_buffer(ost->picref);
} }
#endif #endif
@ -3537,8 +3536,8 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
ost->frame_aspect_ratio = frame_aspect_ratio; ost->frame_aspect_ratio = frame_aspect_ratio;
frame_aspect_ratio = 0; frame_aspect_ratio = 0;
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
ost->avfilter= vfilters; ost->avfilter = vfilters;
vfilters= NULL; vfilters = NULL;
#endif #endif
} }

View File

@ -669,7 +669,6 @@ SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS += mpegaudio3.h
EXAMPLES = api EXAMPLES = api

View File

@ -180,32 +180,35 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
int n = 1 << nbits; int n = 1 << nbits;
int i; int i;
memset(s, 0, sizeof(*s));
s->nbits = nbits; s->nbits = nbits;
s->inverse = inverse; s->inverse = inverse;
ff_init_ff_cos_tabs(nbits+2); if (inverse == DCT_II && nbits == 5) {
s->costab = ff_cos_tabs[nbits+2];
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;
}
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;
}
if (inverse == DCT_II && nbits == 5)
s->dct_calc = dct32_func; s->dct_calc = dct32_func;
} else {
ff_init_ff_cos_tabs(nbits+2);
s->costab = ff_cos_tabs[nbits+2];
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;
}
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;
}
}
s->dct32 = dct32; s->dct32 = dct32;
if (HAVE_MMX) ff_dct_init_mmx(s); if (HAVE_MMX) ff_dct_init_mmx(s);

View File

@ -45,9 +45,6 @@
#endif #endif
#ifndef MULH #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){ static av_always_inline int MULH(int a, int b){
return ((int64_t)(a) * (int64_t)(b))>>32; return ((int64_t)(a) * (int64_t)(b))>>32;
} }

View File

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "mpegaudio.h" #include "mpegaudio.h"

View File

@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "mpegaudio.h" #include "mpegaudio.h"
#include "mpegaudiodata.h" #include "mpegaudiodata.h"

View File

@ -35,8 +35,6 @@
#include "dsputil.h" #include "dsputil.h"
#include "dct.h" #include "dct.h"
#define CONFIG_AUDIO_NONSHORT 0
/* max frame size, in samples */ /* max frame size, in samples */
#define MPA_FRAME_SIZE 1152 #define MPA_FRAME_SIZE 1152
@ -69,19 +67,9 @@
#if CONFIG_FLOAT #if CONFIG_FLOAT
typedef float OUT_INT; 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 #else
typedef int16_t OUT_INT; 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_SHIFT (WFRAC_BITS + FRAC_BITS - 15)
#define OUT_FMT AV_SAMPLE_FMT_S16
#endif #endif
#if CONFIG_FLOAT #if CONFIG_FLOAT
@ -147,6 +135,9 @@ typedef struct MPADecodeContext {
DECLARE_ALIGNED(16, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; 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 */ INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */
GranuleDef granules[2][2]; /* Used in Layer 3 */ 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 adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
int dither_state; int dither_state;
int error_recognition; int error_recognition;

View File

@ -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);

View File

@ -47,6 +47,7 @@
# define MULH3(x, y, s) ((s)*(y)*(x)) # define MULH3(x, y, s) ((s)*(y)*(x))
# define MULLx(x, y, s) ((y)*(x)) # define MULLx(x, y, s) ((y)*(x))
# define RENAME(a) a ## _float # define RENAME(a) a ## _float
# define OUT_FMT AV_SAMPLE_FMT_FLT
#else #else
# define SHR(a,b) ((a)>>(b)) # define SHR(a,b) ((a)>>(b))
# define compute_antialias compute_antialias_integer # define compute_antialias compute_antialias_integer
@ -57,6 +58,7 @@
# define MULH3(x, y, s) MULH((s)*(x), y) # define MULH3(x, y, s) MULH((s)*(x), y)
# define MULLx(x, y, s) MULL(x,y,s) # define MULLx(x, y, s) MULL(x,y,s)
# define RENAME(a) a # define RENAME(a) a
# define OUT_FMT AV_SAMPLE_FMT_S16
#endif #endif
/****************/ /****************/
@ -490,7 +492,7 @@ static inline int round_sample(int64_t *sum)
int sum1; int sum1;
sum1 = (int)((*sum) >> OUT_SHIFT); sum1 = (int)((*sum) >> OUT_SHIFT);
*sum &= (1<<OUT_SHIFT)-1; *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) # define MULS(ra, rb) MUL64(ra, rb)

View File

@ -252,6 +252,7 @@ LF_IFUNC(v, chroma_intra, depth, avx)
LF_FUNCS( uint8_t, 8) LF_FUNCS( uint8_t, 8)
LF_FUNCS(uint16_t, 10) LF_FUNCS(uint16_t, 10)
#if ARCH_X86_32
LF_FUNC (v8, luma, 8, mmxext) 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) 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+0, stride, alpha, beta);
ff_deblock_v8_luma_intra_8_mmxext(pix+8, 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_FUNC (v, luma, 10, mmxext)
LF_IFUNC(v, luma_intra, 10, mmxext) LF_IFUNC(v, luma_intra, 10, mmxext)

View File

@ -35,14 +35,14 @@ int main(int argc, char *argv[])
fd_in = open(argv[1], O_RDONLY); fd_in = open(argv[1], O_RDONLY);
if (fd_in < 0) if (fd_in < 0)
{ {
perror("Error while opening: "); perror("Error opening input file");
exit(1); exit(1);
} }
fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644); fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
if (fd_out < 0) if (fd_out < 0)
{ {
perror("Error while opening: "); perror("Error opening output file");
close(fd_in); close(fd_in);
exit(1); exit(1);
} }
@ -69,7 +69,10 @@ int main(int argc, char *argv[])
// write out modified header // write out modified header
buf_in[0] = 'F'; 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.zalloc = NULL;
zstream.zfree = 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.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
zstream.total_out-last_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; i += len;
@ -120,7 +126,10 @@ int main(int argc, char *argv[])
buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff; buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
lseek(fd_out, 4, SEEK_SET); 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); inflateEnd(&zstream);

View File

@ -104,7 +104,11 @@ int main(int argc, char **argv)
//printf("open(\"%s\")\n", pktfilename); //printf("open(\"%s\")\n", pktfilename);
if (!nowrite) { if (!nowrite) {
fd = open(pktfilename, O_WRONLY|O_CREAT, 0644); 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); close(fd);
} }
av_free_packet(&pkt); av_free_packet(&pkt);