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:
commit
f8ae3a2108
11
ffmpeg.c
11
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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -180,32 +180,35 @@ 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);
|
||||
|
||||
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)
|
||||
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->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;
|
||||
if (HAVE_MMX) ff_dct_init_mmx(s);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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);
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user