1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

Merge remote branch 'qatar/master'

* qatar/master:
  mpegaudiodec: group #includes more sanely
  mpegaudio: remove #if 0 blocks
  ffmpeg.c: reset avoptions after each input/output file.
  ffmpeg.c: store per-output stream sws flags.
  mpegaudio: remove CONFIG_MPEGAUDIO_HP option
  mpegtsenc: Clear st->priv_data when freeing it
  udp: Fix receiving RTP data over multicast
  rtpproto: Remove an unused variable
  regtest: fix wma tests
NOT pulled:  mpegaudio: remove CONFIG_AUDIO_NONSHORT
  regtest: separate flags for encoding and decoding

Conflicts:
	ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-05-10 04:01:29 +02:00
commit b97b4b58a6
16 changed files with 56 additions and 161 deletions

View File

@ -84,6 +84,7 @@ void uninit_opts(void)
} }
av_freep(&opt_names); av_freep(&opt_names);
av_freep(&opt_values); av_freep(&opt_values);
opt_name_count = 0;
} }
void log_callback_help(void* ptr, int level, const char* fmt, va_list vl) void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)

3
configure vendored
View File

@ -94,7 +94,6 @@ Configuration options:
--enable-w32threads use Win32 threads [no] --enable-w32threads use Win32 threads [no]
--enable-x11grab enable X11 grabbing [no] --enable-x11grab enable X11 grabbing [no]
--disable-network disable network support [no] --disable-network disable network support [no]
--disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no]
--enable-gray enable full grayscale support (slower color) --enable-gray enable full grayscale support (slower color)
--disable-swscale-alpha disable alpha channel support in swscale --disable-swscale-alpha disable alpha channel support in swscale
--disable-fastdiv disable table-based division --disable-fastdiv disable table-based division
@ -957,7 +956,6 @@ CONFIG_LIST="
mdct mdct
memalign_hack memalign_hack
mlib mlib
mpegaudio_hp
network network
nonfree nonfree
pic pic
@ -1667,7 +1665,6 @@ enable ffmpeg
enable ffplay enable ffplay
enable ffprobe enable ffprobe
enable ffserver enable ffserver
enable mpegaudio_hp
enable network enable network
enable optimizations enable optimizations
enable protocols enable protocols

View File

@ -316,6 +316,8 @@ typedef struct AVOutputStream {
char *avfilter; char *avfilter;
AVFilterGraph *graph; AVFilterGraph *graph;
#endif #endif
int sws_flags;
} AVOutputStream; } AVOutputStream;
static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL }; static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL };
@ -393,7 +395,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
snprintf(args, 255, "%d:%d:flags=0x%X", snprintf(args, 255, "%d:%d:flags=0x%X",
codec->width, codec->width,
codec->height, codec->height,
(int)av_get_int(sws_opts, "sws_flags", NULL)); ost->sws_flags);
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"), if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
NULL, args, NULL, ost->graph)) < 0) NULL, args, NULL, ost->graph)) < 0)
return ret; return ret;
@ -402,7 +404,7 @@ static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
last_filter = filter; last_filter = filter;
} }
snprintf(args, sizeof(args), "flags=0x%X", (int)av_get_int(sws_opts, "sws_flags", NULL)); snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags);
ost->graph->scale_sws_opts = av_strdup(args); ost->graph->scale_sws_opts = av_strdup(args);
if (ost->avfilter) { if (ost->avfilter) {
@ -690,6 +692,8 @@ static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
} }
ost->file_index = file_idx; ost->file_index = file_idx;
ost->index = idx; ost->index = idx;
ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
return ost; return ost;
} }
@ -1227,10 +1231,9 @@ static void do_video_out(AVFormatContext *s,
} }
/* initialize a new scaler context */ /* initialize a new scaler context */
sws_freeContext(ost->img_resample_ctx); sws_freeContext(ost->img_resample_ctx);
sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
ost->img_resample_ctx = sws_getContext(dec->width, dec->height, dec->pix_fmt, ost->img_resample_ctx = sws_getContext(dec->width, dec->height, dec->pix_fmt,
enc->width, enc->height, enc->pix_fmt, enc->width, enc->height, enc->pix_fmt,
sws_flags, NULL, NULL, NULL); ost->sws_flags, NULL, NULL, NULL);
if (ost->img_resample_ctx == NULL) { if (ost->img_resample_ctx == NULL) {
fprintf(stderr, "Cannot get resampling context\n"); fprintf(stderr, "Cannot get resampling context\n");
ffmpeg_exit(1); ffmpeg_exit(1);
@ -3406,6 +3409,8 @@ static void opt_input_file(const char *filename)
av_freep(&video_codec_name); av_freep(&video_codec_name);
av_freep(&audio_codec_name); av_freep(&audio_codec_name);
av_freep(&subtitle_codec_name); av_freep(&subtitle_codec_name);
uninit_opts();
init_opts();
} }
static void check_inputs(int *has_video_ptr, static void check_inputs(int *has_video_ptr,
@ -3939,6 +3944,8 @@ static void opt_output_file(const char *filename)
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL);
av_freep(&forced_key_frames); av_freep(&forced_key_frames);
uninit_opts();
init_opts();
} }
/* same option as mencoder */ /* same option as mencoder */

View File

@ -694,14 +694,6 @@ $(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF) $(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
$(M)./$< sin > $@ $(M)./$< sin > $@
ifdef CONFIG_MPEGAUDIO_HP
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=23
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=23
else
$(SUBDIR)mpegaudio_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DFRAC_BITS=15
$(SUBDIR)mpegaudio_tablegen.ho: CPPFLAGS += -DFRAC_BITS=15
endif
ifdef CONFIG_SMALL ifdef CONFIG_SMALL
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1 $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
else else

View File

@ -24,7 +24,6 @@
#include "config.h" #include "config.h"
#if CONFIG_MPEGAUDIO_HP
#define MULH(X,Y) ({ int xxo; \ #define MULH(X,Y) ({ int xxo; \
__asm__ ( \ __asm__ ( \
"a1 = %2.L * %1.L (FU);\n\t" \ "a1 = %2.L * %1.L (FU);\n\t" \
@ -34,15 +33,6 @@
"a1 = a1 >>> 16;\n\t" \ "a1 = a1 >>> 16;\n\t" \
"%0 = (a0 += a1);\n\t" \ "%0 = (a0 += a1);\n\t" \
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; }) : "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
#else
#define MULH(X,Y) ({ int xxo; \
__asm__ ( \
"a1 = %2.H * %1.L (IS,M);\n\t" \
"a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
"a1 = a1 >>> 16;\n\t" \
"%0 = (a0 += a1);\n\t" \
: "=d" (xxo) : "d" (X), "d" (Y) : "A0","A1"); xxo; })
#endif
/* signed 16x16 -> 32 multiply */ /* signed 16x16 -> 32 multiply */
#define MUL16(a, b) ({ int xxo; \ #define MUL16(a, b) ({ int xxo; \

View File

@ -58,12 +58,9 @@
#define MP3_MASK 0xFFFE0CCF #define MP3_MASK 0xFFFE0CCF
#if CONFIG_MPEGAUDIO_HP #ifndef FRAC_BITS
#define FRAC_BITS 23 /* fractional bits for sb_samples and dct */ #define FRAC_BITS 23 /* fractional bits for sb_samples and dct */
#define WFRAC_BITS 16 /* fractional bits for window */ #define WFRAC_BITS 16 /* fractional bits for window */
#else
#define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
#define WFRAC_BITS 14 /* fractional bits for window */
#endif #endif
#define FRAC_ONE (1 << FRAC_BITS) #define FRAC_ONE (1 << FRAC_BITS)

View File

@ -38,6 +38,8 @@ static uint32_t expval_table[512][16];
static float exp_table_float[512]; static float exp_table_float[512];
static float expval_table_float[512][16]; static float expval_table_float[512][16];
#define FRAC_BITS 23
static void mpegaudio_tableinit(void) static void mpegaudio_tableinit(void)
{ {
int i, value, exponent; int i, value, exponent;

View File

@ -28,18 +28,16 @@
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h" #include "dsputil.h"
#include "mathops.h"
/* /*
* TODO: * TODO:
* - in low precision mode, use more 16 bit multiplies in synth filter
* - test lsf / mpeg25 extensively. * - test lsf / mpeg25 extensively.
*/ */
#include "mpegaudio.h" #include "mpegaudio.h"
#include "mpegaudiodecheader.h" #include "mpegaudiodecheader.h"
#include "mathops.h"
#if CONFIG_FLOAT #if CONFIG_FLOAT
# define SHR(a,b) ((a)*(1.0f/(1<<(b)))) # define SHR(a,b) ((a)*(1.0f/(1<<(b))))
# define compute_antialias compute_antialias_float # define compute_antialias compute_antialias_float
@ -248,14 +246,6 @@ static inline int l3_unscale(int value, int exponent)
static int dev_4_3_coefs[DEV_ORDER]; static int dev_4_3_coefs[DEV_ORDER];
#if 0 /* unused */
static int pow_mult3[3] = {
POW_FIX(1.0),
POW_FIX(1.25992104989487316476),
POW_FIX(1.58740105196819947474),
};
#endif
static av_cold void int_pow_init(void) static av_cold void int_pow_init(void)
{ {
int i, a; int i, a;
@ -267,53 +257,6 @@ static av_cold void int_pow_init(void)
} }
} }
#if 0 /* unused, remove? */
/* return the mantissa and the binary exponent */
static int int_pow(int i, int *exp_ptr)
{
int e, er, eq, j;
int a, a1;
/* renormalize */
a = i;
e = POW_FRAC_BITS;
while (a < (1 << (POW_FRAC_BITS - 1))) {
a = a << 1;
e--;
}
a -= (1 << POW_FRAC_BITS);
a1 = 0;
for(j = DEV_ORDER - 1; j >= 0; j--)
a1 = POW_MULL(a, dev_4_3_coefs[j] + a1);
a = (1 << POW_FRAC_BITS) + a1;
/* exponent compute (exact) */
e = e * 4;
er = e % 3;
eq = e / 3;
a = POW_MULL(a, pow_mult3[er]);
while (a >= 2 * POW_FRAC_ONE) {
a = a >> 1;
eq++;
}
/* convert to float */
while (a < POW_FRAC_ONE) {
a = a << 1;
eq--;
}
/* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */
#if POW_FRAC_BITS > FRAC_BITS
a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS);
/* correct overflow */
if (a >= 2 * (1 << FRAC_BITS)) {
a = a >> 1;
eq++;
}
#endif
*exp_ptr = eq;
return a;
}
#endif
static av_cold int decode_init(AVCodecContext * avctx) static av_cold int decode_init(AVCodecContext * avctx)
{ {
MPADecodeContext *s = avctx->priv_data; MPADecodeContext *s = avctx->priv_data;
@ -540,24 +483,6 @@ static inline float round_sample(float *sum)
#define MLSS(rt, ra, rb) rt-=(ra)*(rb) #define MLSS(rt, ra, rb) rt-=(ra)*(rb)
#elif FRAC_BITS <= 15
static inline int round_sample(int *sum)
{
int sum1;
sum1 = (*sum) >> OUT_SHIFT;
*sum &= (1<<OUT_SHIFT)-1;
return av_clip(sum1, OUT_MIN, OUT_MAX);
}
/* signed 16x16 -> 32 multiply add accumulate */
#define MACS(rt, ra, rb) MAC16(rt, ra, rb)
/* signed 16x16 -> 32 multiply */
#define MULS(ra, rb) MUL16(ra, rb)
#define MLSS(rt, ra, rb) MLS16(rt, ra, rb)
#else #else
static inline int round_sample(int64_t *sum) static inline int round_sample(int64_t *sum)
@ -624,8 +549,6 @@ void av_cold RENAME(ff_mpa_synth_init)(MPA_INT *window)
v = ff_mpa_enwindow[i]; v = ff_mpa_enwindow[i];
#if CONFIG_FLOAT #if CONFIG_FLOAT
v *= 1.0 / (1LL<<(16 + FRAC_BITS)); v *= 1.0 / (1LL<<(16 + FRAC_BITS));
#elif WFRAC_BITS < 16
v = (v + (1 << (16 - WFRAC_BITS - 1))) >> (16 - WFRAC_BITS);
#endif #endif
window[i] = v; window[i] = v;
if ((i & 63) != 0) if ((i & 63) != 0)
@ -652,8 +575,6 @@ static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window,
OUT_INT *samples2; OUT_INT *samples2;
#if CONFIG_FLOAT #if CONFIG_FLOAT
float sum, sum2; float sum, sum2;
#elif FRAC_BITS <= 15
int sum, sum2;
#else #else
int64_t sum, sum2; int64_t sum, sum2;
#endif #endif
@ -710,25 +631,11 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
{ {
register MPA_INT *synth_buf; register MPA_INT *synth_buf;
int offset; int offset;
#if FRAC_BITS <= 15
int32_t tmp[32];
int j;
#endif
offset = *synth_buf_offset; offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset; synth_buf = synth_buf_ptr + offset;
#if FRAC_BITS <= 15
dct32(tmp, sb_samples);
for(j=0;j<32;j++) {
/* NOTE: can cause a loss in precision if very high amplitude
sound */
synth_buf[j] = av_clip_int16(tmp[j]);
}
#else
dct32(synth_buf, sb_samples); dct32(synth_buf, sb_samples);
#endif
apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); apply_window_mp3_c(synth_buf, window, dither_state, samples, incr);
offset = (offset - 32) & 511; offset = (offset - 32) & 511;

View File

@ -27,8 +27,9 @@
#include "avcodec.h" #include "avcodec.h"
#include "put_bits.h" #include "put_bits.h"
#undef CONFIG_MPEGAUDIO_HP #define FRAC_BITS 15 /* fractional bits for sb_samples and dct */
#define CONFIG_MPEGAUDIO_HP 0 #define WFRAC_BITS 14 /* fractional bits for window */
#include "mpegaudio.h" #include "mpegaudio.h"
/* currently, cannot change these constants (need to modify /* currently, cannot change these constants (need to modify

View File

@ -588,7 +588,7 @@ static int mpegts_write_header(AVFormatContext *s)
av_free(pids); av_free(pids);
for(i = 0;i < s->nb_streams; i++) { for(i = 0;i < s->nb_streams; i++) {
st = s->streams[i]; st = s->streams[i];
av_free(st->priv_data); av_freep(&st->priv_data);
} }
return -1; return -1;
} }

View File

@ -138,15 +138,13 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
{ {
RTPContext *s; RTPContext *s;
int rtp_port, rtcp_port, int rtp_port, rtcp_port,
is_output, ttl, connect, ttl, connect,
local_rtp_port, local_rtcp_port, max_packet_size; local_rtp_port, local_rtcp_port, max_packet_size;
char hostname[256]; char hostname[256];
char buf[1024]; char buf[1024];
char path[1024]; char path[1024];
const char *p; const char *p;
is_output = (flags & AVIO_FLAG_WRITE);
s = av_mallocz(sizeof(RTPContext)); s = av_mallocz(sizeof(RTPContext));
if (!s) if (!s)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

View File

@ -315,7 +315,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
h->is_streamed = 1; h->is_streamed = 1;
h->max_packet_size = 1472; h->max_packet_size = 1472;
is_output = (flags & AVIO_FLAG_WRITE); is_output = !(flags & AVIO_FLAG_READ);
s = av_mallocz(sizeof(UDPContext)); s = av_mallocz(sizeof(UDPContext));
if (!s) if (!s)
@ -358,14 +358,14 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* XXX: fix av_url_split */ /* XXX: fix av_url_split */
if (hostname[0] == '\0' || hostname[0] == '?') { if (hostname[0] == '\0' || hostname[0] == '?') {
/* only accepts null hostname if input */ /* only accepts null hostname if input */
if (flags & AVIO_FLAG_WRITE) if (!(flags & AVIO_FLAG_READ))
goto fail; goto fail;
} else { } else {
if (ff_udp_set_remote_url(h, uri) < 0) if (ff_udp_set_remote_url(h, uri) < 0)
goto fail; goto fail;
} }
if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
s->local_port = port; s->local_port = port;
udp_fd = udp_socket_create(s, &my_addr, &len); udp_fd = udp_socket_create(s, &my_addr, &len);
if (udp_fd < 0) if (udp_fd < 0)
@ -382,7 +382,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
/* the bind is needed to give a port to the socket now */ /* the bind is needed to give a port to the socket now */
/* if multicast, try the multicast address bind first */ /* if multicast, try the multicast address bind first */
if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) { if (s->is_multicast && (h->flags & AVIO_FLAG_READ)) {
bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len); bind_ret = bind(udp_fd,(struct sockaddr *)&s->dest_addr, len);
} }
/* bind to the local address if not multicast or if the multicast /* bind to the local address if not multicast or if the multicast
@ -395,7 +395,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
s->local_port = udp_port(&my_addr, len); s->local_port = udp_port(&my_addr, len);
if (s->is_multicast) { if (s->is_multicast) {
if (h->flags & AVIO_FLAG_WRITE) { if (!(h->flags & AVIO_FLAG_READ)) {
/* output */ /* output */
if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0) if (udp_set_multicast_ttl(udp_fd, s->ttl, (struct sockaddr *)&s->dest_addr) < 0)
goto fail; goto fail;
@ -478,7 +478,7 @@ static int udp_close(URLContext *h)
{ {
UDPContext *s = h->priv_data; UDPContext *s = h->priv_data;
if (s->is_multicast && !(h->flags & AVIO_FLAG_WRITE)) if (s->is_multicast && (h->flags & AVIO_FLAG_READ))
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr); udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
closesocket(s->udp_fd); closesocket(s->udp_fd);
av_free(s); av_free(s);

View File

@ -61,7 +61,7 @@ do_video_decoding
# mpeg2 encoding interlaced # mpeg2 encoding interlaced
file=${outfile}mpeg2reuse.mpg file=${outfile}mpeg2reuse.mpg
do_ffmpeg $file -sameq -me_threshold 256 -mb_threshold 1024 -i ${target_path}/${outfile}mpeg2thread.mpg -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4 do_ffmpeg $file $DEC_OPTS -me_threshold 256 -i ${target_path}/${outfile}mpeg2thread.mpg $ENC_OPTS -sameq -me_threshold 256 -mb_threshold 1024 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 4
do_video_decoding do_video_decoding
fi fi
@ -328,12 +328,12 @@ fi
if [ -n "$do_wmav1" ] ; then if [ -n "$do_wmav1" ] ; then
do_audio_encoding wmav1.asf "-acodec wmav1" do_audio_encoding wmav1.asf "-acodec wmav1"
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav do_ffmpeg_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
fi fi
if [ -n "$do_wmav2" ] ; then if [ -n "$do_wmav2" ] ; then
do_audio_encoding wmav2.asf "-acodec wmav2" do_audio_encoding wmav2.asf "-acodec wmav2"
do_ffmpeg_nomd5 $pcm_dst -i $target_path/$file -f wav do_ffmpeg_nomd5 $pcm_dst $DEC_OPTS -i $target_path/$file -f wav
$tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile $tiny_psnr $pcm_dst $pcm_ref 2 8192 >> $logfile
fi fi

View File

@ -14,15 +14,15 @@ eval do_$test=y
do_lavf() do_lavf()
{ {
file=${outfile}lavf.$1 file=${outfile}lavf.$1
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src $2 do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $2
do_ffmpeg_crc $file -i $target_path/$file $3 do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file $3
} }
do_streamed_images() do_streamed_images()
{ {
file=${outfile}${1}pipe.$1 file=${outfile}${1}pipe.$1
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src -f image2pipe $ENC_OPTS -t 1 -qscale 10
do_ffmpeg_crc $file -f image2pipe -i $target_path/$file do_ffmpeg_crc $file $DEC_OPTS -f image2pipe -i $target_path/$file
} }
do_image_formats() do_image_formats()
@ -30,17 +30,17 @@ do_image_formats()
outfile="$datadir/images/$1/" outfile="$datadir/images/$1/"
mkdir -p "$outfile" mkdir -p "$outfile"
file=${outfile}%02d.$1 file=${outfile}%02d.$1
run_ffmpeg -t 0.5 -y -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src $2 $3 -flags +bitexact -sws_flags +accurate_rnd+bitexact $target_path/$file run_ffmpeg $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $2 $ENC_OPTS $3 -t 0.5 -y -qscale 10 $target_path/$file
do_md5sum ${outfile}02.$1 >> $logfile do_md5sum ${outfile}02.$1 >> $logfile
do_ffmpeg_crc $file $3 -i $target_path/$file do_ffmpeg_crc $file $DEC_OPTS $3 -i $target_path/$file
wc -c ${outfile}02.$1 >> $logfile wc -c ${outfile}02.$1 >> $logfile
} }
do_audio_only() do_audio_only()
{ {
file=${outfile}lavf.$1 file=${outfile}lavf.$1
do_ffmpeg $file -t 1 -qscale 10 $2 -f s16le -i $pcm_src $3 do_ffmpeg $file $DEC_OPTS $2 -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 $3
do_ffmpeg_crc $file -i $target_path/$file do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file
} }
rm -f "$logfile" rm -f "$logfile"
@ -56,7 +56,7 @@ fi
if [ -n "$do_rm" ] ; then if [ -n "$do_rm" ] ; then
file=${outfile}lavf.rm file=${outfile}lavf.rm
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -f s16le -i $pcm_src -acodec ac3_fixed do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -f s16le -i $pcm_src $ENC_OPTS -t 1 -qscale 10 -acodec ac3_fixed
# broken # broken
#do_ffmpeg_crc $file -i $target_path/$file #do_ffmpeg_crc $file -i $target_path/$file
fi fi
@ -127,13 +127,13 @@ fi
if [ -n "$do_gif" ] ; then if [ -n "$do_gif" ] ; then
file=${outfile}lavf.gif file=${outfile}lavf.gif
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src -pix_fmt rgb24 do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10 -pix_fmt rgb24
do_ffmpeg_crc $file -i $target_path/$file -pix_fmt rgb24 do_ffmpeg_crc $file $DEC_OPTS -i $target_path/$file -pix_fmt rgb24
fi fi
if [ -n "$do_yuv4mpeg" ] ; then if [ -n "$do_yuv4mpeg" ] ; then
file=${outfile}lavf.y4m file=${outfile}lavf.y4m
do_ffmpeg $file -t 1 -qscale 10 -f image2 -vcodec pgmyuv -i $raw_src do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS -t 1 -qscale 10
#do_ffmpeg_crc $file -i $target_path/$file #do_ffmpeg_crc $file -i $target_path/$file
fi fi
@ -227,9 +227,9 @@ conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
monob yuv440p yuvj440p" monob yuv440p yuvj440p"
for pix_fmt in $conversions ; do for pix_fmt in $conversions ; do
file=${outfile}${pix_fmt}.yuv file=${outfile}${pix_fmt}.yuv
do_ffmpeg_nocheck $file -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \ do_ffmpeg_nocheck $file $DEC_OPTS -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \
-f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
do_ffmpeg $file -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \ do_ffmpeg $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
-f rawvideo -s 352x288 -pix_fmt yuv444p $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
done done
fi fi

View File

@ -19,8 +19,8 @@ do_video_filter() {
filters=$2 filters=$2
shift 2 shift 2
printf '%-20s' $label >>$logfile printf '%-20s' $label >>$logfile
run_ffmpeg -f image2 -vcodec pgmyuv -i $raw_src \ run_ffmpeg $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src \
-vf "$filters" -vcodec rawvideo $* -f nut md5: >>$logfile $ENC_OPTS -vf "$filters" -vcodec rawvideo $* -f nut md5: >>$logfile
} }
do_lavfi() { do_lavfi() {

View File

@ -53,7 +53,10 @@ echov(){
. $(dirname $0)/md5.sh . $(dirname $0)/md5.sh
FFMPEG_OPTS="-v 0 -threads $threads -y -flags +bitexact -dct fastint -idct simple -sws_flags +accurate_rnd+bitexact" FFMPEG_OPTS="-v 0 -y"
COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact"
DEC_OPTS="$COMMON_OPTS -threads $threads"
ENC_OPTS="$COMMON_OPTS -dct fastint"
run_ffmpeg() run_ffmpeg()
{ {
@ -115,22 +118,22 @@ do_ffmpeg_nocheck()
do_video_decoding() do_video_decoding()
{ {
do_ffmpeg $raw_dst $1 -i $target_path/$file -f rawvideo $2 do_ffmpeg $raw_dst $DEC_OPTS $1 -i $target_path/$file -f rawvideo $ENC_OPTS $2
} }
do_video_encoding() do_video_encoding()
{ {
file=${outfile}$1 file=${outfile}$1
do_ffmpeg $file -f image2 -vcodec pgmyuv -i $raw_src $2 do_ffmpeg $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $ENC_OPTS $2
} }
do_audio_encoding() do_audio_encoding()
{ {
file=${outfile}$1 file=${outfile}$1
do_ffmpeg $file -ab 128k -ac 2 -f s16le -i $pcm_src $2 do_ffmpeg $file $DEC_OPTS -ac 2 -f s16le -i $pcm_src -ab 128k $ENC_OPTS $2
} }
do_audio_decoding() do_audio_decoding()
{ {
do_ffmpeg $pcm_dst -i $target_path/$file -sample_fmt s16 -f wav do_ffmpeg $pcm_dst $DEC_OPTS -i $target_path/$file -sample_fmt s16 -f wav
} }