diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-23 04:02:17 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-23 04:02:17 +0100 |
commit | 0b9a69f244e399565d67100a6862886201a594a4 (patch) | |
tree | 22d82b11955930051b34da252f95b992095e91fd | |
parent | a8e6d4d403c9174b4f57475b80bb5f80e1c57a1f (diff) | |
parent | 963f6855356fa527a27b08b55e026f683a12cebc (diff) | |
download | ffmpeg-0b9a69f244e399565d67100a6862886201a594a4.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
aacdec: Fix PS in ADTS.
avconv: Consistently use PIX_FMT_NONE.
dsputil: use cpuflags in x86 emu_edge_core
dsputil: use movups instead of movdqu in ff_emu_edge_core_sse()
wma: initialize prev_block_len_bits, next_block_len_bits, and block_len_bits.
mov: Remove some redundant and obsolete comments.
Add libavutil/mathematics.h #includes for INFINITY
doxy: structure libavformat groups
doxy: introduce an empty structure in libavcodec
doxy: provide a start page and document libavutil
doxy: cleanup pixfmt.h
regtest: split video encode/decode tests into individual targets
ARM: add explicit .arch and .fpu directives to asm.S
pthread: do not touch has_b_frames
avconv: cleanup the transcoding loop in output_packet().
avconv: split subtitle transcoding out of output_packet().
avconv: split video transcoding out of output_packet().
avconv: split audio transcoding out of output_packet().
avconv: reindent.
avconv: move streamcopy-only code out of decoding loop.
...
Conflicts:
avconv.c
libavcodec/aaccoder.c
libavcodec/pthread.c
libavcodec/version.h
libavutil/audioconvert.h
libavutil/avutil.h
libavutil/mem.h
tests/ref/vsynth1/dv
tests/ref/vsynth1/mpeg2thread
tests/ref/vsynth2/dv
tests/ref/vsynth2/mpeg2thread
Merged-by: Michael Niedermayer <michaelni@gmx.at>
64 files changed, 1390 insertions, 866 deletions
@@ -722,11 +722,11 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec) p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE}; } } - for(; *p!=-1; p++){ + for (; *p != PIX_FMT_NONE; p++) { if(*p == st->codec->pix_fmt) break; } - if (*p == -1) { + if (*p == PIX_FMT_NONE) { if(st->codec->pix_fmt != PIX_FMT_NONE) av_log(NULL, AV_LOG_WARNING, "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", @@ -1596,26 +1596,338 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) } } +/* + * Check whether a packet from ist should be written into ost at this time + */ +static int check_output_constraints(InputStream *ist, OutputStream *ost) +{ + OutputFile *of = &output_files[ost->file_index]; + int ist_index = ist - input_streams; + + if (ost->source_index != ist_index) + return 0; + + if (of->start_time && ist->pts < of->start_time) + return 0; + + if (of->recording_time != INT64_MAX && + av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time, + (AVRational){1, 1000000}) >= 0) { + ost->is_past_recording_time = 1; + return 0; + } + + return 1; +} + +static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt) +{ + OutputFile *of = &output_files[ost->file_index]; + int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); + AVPicture pict; + AVPacket opkt; + + av_init_packet(&opkt); + + if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && + !ost->copy_initial_nonkeyframes) + return; + + /* force the input stream PTS */ + if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + audio_size += pkt->size; + else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + video_size += pkt->size; + ost->sync_opts++; + } + + opkt.stream_index = ost->index; + if (pkt->pts != AV_NOPTS_VALUE) + opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; + else + opkt.pts = AV_NOPTS_VALUE; + + if (pkt->dts == AV_NOPTS_VALUE) + opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base); + else + opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); + opkt.dts -= ost_tb_start_time; + + opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); + opkt.flags = pkt->flags; + + //FIXME remove the following 2 lines they shall be replaced by the bitstream filters + if( ost->st->codec->codec_id != CODEC_ID_H264 + && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO + && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO + ) { + if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY)) + opkt.destruct = av_destruct_packet; + } else { + opkt.data = pkt->data; + opkt.size = pkt->size; + } + if (of->ctx->oformat->flags & AVFMT_RAWPICTURE) { + /* store AVPicture in AVPacket, as expected by the output format */ + avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); + opkt.data = (uint8_t *)&pict; + opkt.size = sizeof(AVPicture); + opkt.flags |= AV_PKT_FLAG_KEY; + } + + write_frame(of->ctx, &opkt, ost->st->codec, ost->bitstream_filters); + ost->st->codec->frame_number++; + ost->frame_number++; + av_free_packet(&opkt); +} + +static void rate_emu_sleep(InputStream *ist) +{ + if (input_files[ist->file_index].rate_emu) { + int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE); + int64_t now = av_gettime() - ist->start; + if (pts > now) + usleep(pts - now); + } +} + +static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) +{ + static unsigned int samples_size = 0; + int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); + uint8_t *decoded_data_buf = NULL; + int decoded_data_size = 0; + int i, ret; + + if (pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) { + av_free(samples); + samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE); + samples = av_malloc(samples_size); + } + decoded_data_size = samples_size; + + ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size, + pkt); + if (ret < 0) + return ret; + pkt->data += ret; + pkt->size -= ret; + *got_output = decoded_data_size > 0; + + /* Some bug in mpeg audio decoder gives */ + /* decoded_data_size < 0, it seems they are overflows */ + if (!*got_output) { + /* no audio frame */ + return 0; + } + + decoded_data_buf = (uint8_t *)samples; + ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) / + (ist->st->codec->sample_rate * ist->st->codec->channels); + + // preprocess audio (volume) + if (audio_volume != 256) { + switch (ist->st->codec->sample_fmt) { + case AV_SAMPLE_FMT_U8: + { + uint8_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; + *volp++ = av_clip_uint8(v); + } + break; + } + case AV_SAMPLE_FMT_S16: + { + int16_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int v = ((*volp) * audio_volume + 128) >> 8; + *volp++ = av_clip_int16(v); + } + break; + } + case AV_SAMPLE_FMT_S32: + { + int32_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); + *volp++ = av_clipl_int32(v); + } + break; + } + case AV_SAMPLE_FMT_FLT: + { + float *volp = samples; + float scale = audio_volume / 256.f; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + *volp++ *= scale; + } + break; + } + case AV_SAMPLE_FMT_DBL: + { + double *volp = samples; + double scale = audio_volume / 256.; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + *volp++ *= scale; + } + break; + } + default: + av_log(NULL, AV_LOG_FATAL, + "Audio volume adjustment on sample format %s is not supported.\n", + av_get_sample_fmt_name(ist->st->codec->sample_fmt)); + exit_program(1); + } + } + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + do_audio_out(output_files[ost->file_index].ctx, ost, ist, + decoded_data_buf, decoded_data_size); + } + return 0; +} + +static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts) +{ + AVFrame *decoded_frame, *filtered_frame = NULL; + void *buffer_to_free = NULL; + int i, ret = 0; + float quality; +#if CONFIG_AVFILTER + int frame_available = 1; +#endif + + if (!(decoded_frame = avcodec_alloc_frame())) + return AVERROR(ENOMEM); + pkt->pts = *pkt_pts; + pkt->dts = ist->pts; + *pkt_pts = AV_NOPTS_VALUE; + + ret = avcodec_decode_video2(ist->st->codec, + decoded_frame, got_output, pkt); + if (ret < 0) + goto fail; + + quality = same_quant ? decoded_frame->quality : 0; + if (!*got_output) { + /* no picture yet */ + av_freep(&decoded_frame); + return 0; + } + ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp; + if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : + ist->st->codec->ticks_per_frame; + ist->next_pts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; + } + pkt->size = 0; + pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + int frame_size; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + +#if CONFIG_AVFILTER + if (ost->input_video_filter) { + if (!decoded_frame->sample_aspect_ratio.num) + decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + decoded_frame->pts = ist->pts; + + av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); + if (!(filtered_frame = avcodec_alloc_frame())) { + ret = AVERROR(ENOMEM); + goto fail; + } + frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]); + } + while (frame_available) { + if (ost->output_video_filter) { + AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; + if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0) + goto cont; + if (ost->picref) { + avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); + ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); + } + } + if (ost->picref->video && !ost->frame_aspect_ratio) + ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; +#else + filtered_frame = decoded_frame; +#endif + + do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size, + same_quant ? quality : ost->st->codec->global_quality); + if (vstats_filename && frame_size) + do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); +#if CONFIG_AVFILTER + cont: + frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); + if (ost->picref) + avfilter_unref_buffer(ost->picref); + } + av_freep(&filtered_frame); +#endif + } + +fail: + av_free(buffer_to_free); + av_freep(&decoded_frame); + return ret; +} + +static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) +{ + AVSubtitle subtitle; + int i, ret = avcodec_decode_subtitle2(ist->st->codec, + &subtitle, got_output, pkt); + if (ret < 0) + return ret; + if (!*got_output) + return 0; + + pkt->size = 0; + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + + do_subtitle_out(output_files[ost->file_index].ctx, ost, ist, &subtitle, pkt->pts); + } + + avsubtitle_free(&subtitle); + return 0; +} + /* pkt = NULL means EOF (needed to flush decoder buffers) */ static int output_packet(InputStream *ist, int ist_index, OutputStream *ost_table, int nb_ostreams, const AVPacket *pkt) { - AVFormatContext *os; OutputStream *ost; int ret = 0, i; int got_output; - void *buffer_to_free = NULL; - static unsigned int samples_size= 0; - AVSubtitle subtitle, *subtitle_to_free; int64_t pkt_pts = AV_NOPTS_VALUE; -#if CONFIG_AVFILTER - int frame_available; -#endif - float quality; AVPacket avpkt; - int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); if(ist->next_pts == AV_NOPTS_VALUE) ist->next_pts= ist->pts; @@ -1636,10 +1948,7 @@ static int output_packet(InputStream *ist, int ist_index, pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); //while we have more to decode or while the decoder did output something on EOF - while (avpkt.size > 0 || (!pkt && got_output)) { - uint8_t *data_buf, *decoded_data_buf; - int data_size, decoded_data_size; - AVFrame *decoded_frame, *filtered_frame; + while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { handle_eof: ist->pts= ist->next_pts; @@ -1648,329 +1957,56 @@ static int output_packet(InputStream *ist, int ist_index, "Multiple frames in a packet from stream %d\n", pkt->stream_index); ist->showed_multi_packet_warning=1; - /* decode the packet if needed */ - decoded_frame = filtered_frame = NULL; - decoded_data_buf = NULL; /* fail safe */ - decoded_data_size= 0; - data_buf = avpkt.data; - data_size = avpkt.size; - subtitle_to_free = NULL; - if (ist->decoding_needed) { - switch(ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO:{ - if(pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) { - samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE); - av_free(samples); - samples= av_malloc(samples_size); - } - decoded_data_size= samples_size; - /* XXX: could avoid copy if PCM 16 bits with same - endianness as CPU */ - ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size, - &avpkt); - if (ret < 0) - return ret; - avpkt.data += ret; - avpkt.size -= ret; - data_size = ret; - got_output = decoded_data_size > 0; - /* Some bug in mpeg audio decoder gives */ - /* decoded_data_size < 0, it seems they are overflows */ - if (!got_output) { - /* no audio frame */ - continue; - } - decoded_data_buf = (uint8_t *)samples; - ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) / - (ist->st->codec->sample_rate * ist->st->codec->channels); - break;} - case AVMEDIA_TYPE_VIDEO: - if (!(decoded_frame = avcodec_alloc_frame())) - return AVERROR(ENOMEM); - avpkt.pts = pkt_pts; - avpkt.dts = ist->pts; - pkt_pts = AV_NOPTS_VALUE; - - ret = avcodec_decode_video2(ist->st->codec, - decoded_frame, &got_output, &avpkt); - quality = same_quant ? decoded_frame->quality : 0; - if (ret < 0) - goto fail; - if (!got_output) { - /* no picture yet */ - av_freep(&decoded_frame); - goto discard_packet; - } - ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp; - if (ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - ist->next_pts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } - avpkt.size = 0; - buffer_to_free = NULL; - pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); - break; - case AVMEDIA_TYPE_SUBTITLE: - ret = avcodec_decode_subtitle2(ist->st->codec, - &subtitle, &got_output, &avpkt); - if (ret < 0) - return ret; - if (!got_output) { - goto discard_packet; - } - subtitle_to_free = &subtitle; - avpkt.size = 0; - break; - default: - return -1; - } - } else { - switch(ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / - ist->st->codec->sample_rate; - break; - case AVMEDIA_TYPE_VIDEO: - if (ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - ist->next_pts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } - break; - } - avpkt.size = 0; - } - - // preprocess audio (volume) - if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - if (audio_volume != 256) { - switch (ist->st->codec->sample_fmt) { - case AV_SAMPLE_FMT_U8: - { - uint8_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; - *volp++ = av_clip_uint8(v); - } - break; - } - case AV_SAMPLE_FMT_S16: - { - int16_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int v = ((*volp) * audio_volume + 128) >> 8; - *volp++ = av_clip_int16(v); - } - break; - } - case AV_SAMPLE_FMT_S32: - { - int32_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); - *volp++ = av_clipl_int32(v); - } - break; - } - case AV_SAMPLE_FMT_FLT: - { - float *volp = samples; - float scale = audio_volume / 256.f; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - *volp++ *= scale; - } - break; - } - case AV_SAMPLE_FMT_DBL: - { - double *volp = samples; - double scale = audio_volume / 256.; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - *volp++ *= scale; - } - break; - } - default: - av_log(NULL, AV_LOG_FATAL, - "Audio volume adjustment on sample format %s is not supported.\n", - av_get_sample_fmt_name(ist->st->codec->sample_fmt)); - exit_program(1); - } - } - } - - /* frame rate emulation */ - if (input_files[ist->file_index].rate_emu) { - int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE); - int64_t now = av_gettime() - ist->start; - if (pts > now) - usleep(pts - now); + switch(ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ret = transcode_audio (ist, &avpkt, &got_output); + break; + case AVMEDIA_TYPE_VIDEO: + ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts); + break; + case AVMEDIA_TYPE_SUBTITLE: + ret = transcode_subtitles(ist, &avpkt, &got_output); + break; + default: + return -1; } - /* if output time reached then transcode raw format, - encode packets and output them */ - for (i = 0; i < nb_ostreams; i++) { - OutputFile *of = &output_files[ost_table[i].file_index]; - int frame_size; - - ost = &ost_table[i]; - if (ost->source_index != ist_index) - continue; - - if (of->start_time && ist->pts < of->start_time) - continue; - if (of->recording_time != INT64_MAX && - av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time, - (AVRational){1, 1000000}) >= 0) { - ost->is_past_recording_time = 1; + if (ret < 0) + return ret; + if (!got_output) { + if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) continue; - } + goto discard_packet; + } + } + discard_packet: -#if CONFIG_AVFILTER - if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && - ost->input_video_filter) { - if (!decoded_frame->sample_aspect_ratio.num) - decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; - decoded_frame->pts = ist->pts; - - av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); - if (!(filtered_frame = avcodec_alloc_frame())) { - ret = AVERROR(ENOMEM); - goto fail; - } + /* handle stream copy */ + if (!ist->decoding_needed) { + rate_emu_sleep(ist); + switch (ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / + ist->st->codec->sample_rate; + break; + case AVMEDIA_TYPE_VIDEO: + if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; + ist->next_pts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; } - frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || - !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]); - while (frame_available) { - if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter) { - AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; - if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0) - goto cont; - if (ost->picref) { - avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); - ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); - } - } -#else - filtered_frame = decoded_frame; -#endif - os = output_files[ost->file_index].ctx; - - /* set the input output pts pairs */ - //ost->sync_ipts = (double)(ist->pts + input_files[ist->file_index].ts_offset - start_time)/ AV_TIME_BASE; - - if (ost->encoding_needed) { - av_assert0(ist->decoding_needed); - switch(ost->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size); - break; - case AVMEDIA_TYPE_VIDEO: -#if CONFIG_AVFILTER - if (ost->picref->video && !ost->frame_aspect_ratio) - ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; -#endif - do_video_out(os, ost, ist, filtered_frame, &frame_size, - same_quant ? quality : ost->st->codec->global_quality); - if (vstats_filename && frame_size) - do_video_stats(os, ost, frame_size); - break; - case AVMEDIA_TYPE_SUBTITLE: - do_subtitle_out(os, ost, ist, &subtitle, - pkt->pts); - break; - default: - abort(); - } - } else { - AVPicture pict; - AVPacket opkt; - int64_t ost_tb_start_time= av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); - av_init_packet(&opkt); - - if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && - !ost->copy_initial_nonkeyframes) -#if !CONFIG_AVFILTER - continue; -#else - goto cont; -#endif - - /* no reencoding needed : output the packet directly */ - /* force the input stream PTS */ - - if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - audio_size += data_size; - else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - video_size += data_size; - ost->sync_opts++; - } - - opkt.stream_index= ost->index; - if(pkt->pts != AV_NOPTS_VALUE) - opkt.pts= av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; - else - opkt.pts= AV_NOPTS_VALUE; - - if (pkt->dts == AV_NOPTS_VALUE) - opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base); - else - opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); - opkt.dts -= ost_tb_start_time; - - opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); - opkt.flags= pkt->flags; - - //FIXME remove the following 2 lines they shall be replaced by the bitstream filters - if( ost->st->codec->codec_id != CODEC_ID_H264 - && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO - && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO - ) { - if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY)) - opkt.destruct= av_destruct_packet; - } else { - opkt.data = data_buf; - opkt.size = data_size; - } + break; + } + } + for (i = 0; pkt && i < nb_ostreams; i++) { + ost = &ost_table[i]; - if (os->oformat->flags & AVFMT_RAWPICTURE) { - /* store AVPicture in AVPacket, as expected by the output format */ - avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); - opkt.data = (uint8_t *)&pict; - opkt.size = sizeof(AVPicture); - opkt.flags |= AV_PKT_FLAG_KEY; - } - write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters); - ost->st->codec->frame_number++; - ost->frame_number++; - av_free_packet(&opkt); - } -#if CONFIG_AVFILTER - 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) - avfilter_unref_buffer(ost->picref); - } - av_freep(&filtered_frame); -#endif - } + if (!check_output_constraints(ist, ost) || ost->encoding_needed) + continue; -fail: - av_free(buffer_to_free); - /* XXX: allocate the subtitles in the codec ? */ - if (subtitle_to_free) { - avsubtitle_free(subtitle_to_free); - subtitle_to_free = NULL; - } - av_freep(&decoded_frame); - if (ret < 0) - return ret; + do_streamcopy(ist, ost, pkt); } - discard_packet: return 0; } diff --git a/cmdutils.c b/cmdutils.c index 76ec5b665a..ee7d66063e 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -35,6 +35,7 @@ #include "libswscale/swscale.h" #include "libpostproc/postprocess.h" #include "libavutil/avstring.h" +#include "libavutil/mathematics.h" #include "libavutil/parseutils.h" #include "libavutil/pixdesc.h" #include "libavutil/eval.h" @@ -1677,7 +1677,7 @@ test_deps _encoder _decoder \ asv2 \ bmp \ dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \ - dvvideo="dv dv50" \ + dvvideo="dv dv_411 dv50" \ ffv1 \ flac \ flashsv \ @@ -1690,8 +1690,10 @@ test_deps _encoder _decoder \ mjpeg="jpg mjpeg ljpeg" \ mp2 \ mpeg1video="mpeg mpeg1b" \ - mpeg2video="mpeg2 mpeg2thread" \ - mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \ + mpeg2video="mpeg2 mpeg2_422 mpeg2_idct_int mpeg2_ilace mpeg2_ivlc_qprd" \ + mpeg2video="mpeg2thread mpeg2thread_ilace" \ + mpeg4="mpeg4 mpeg4_adap mpeg4_qpel mpeg4_qprd mpeg4adv mpeg4nr" \ + mpeg4="mpeg4thread error rc" \ msmpeg4v3=msmpeg4 \ msmpeg4v2 \ pbm=pbmpipe \ @@ -770,11 +770,11 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec) p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE}; } } - for(; *p!=-1; p++){ + for (; *p != PIX_FMT_NONE; p++) { if(*p == st->codec->pix_fmt) break; } - if (*p == -1) { + if (*p == PIX_FMT_NONE) { if(st->codec->pix_fmt != PIX_FMT_NONE) av_log(NULL, AV_LOG_WARNING, "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", @@ -1621,27 +1621,360 @@ static void flush_encoders(OutputStream *ost_table, int nb_ostreams) } } +/* + * Check whether a packet from ist should be written into ost at this time + */ +static int check_output_constraints(InputStream *ist, OutputStream *ost) +{ + OutputFile *of = &output_files[ost->file_index]; + int ist_index = ist - input_streams; + + if (ost->source_index != ist_index) + return 0; + + if (of->start_time && ist->pts < of->start_time) + return 0; + + if (of->recording_time != INT64_MAX && + av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time, + (AVRational){1, 1000000}) >= 0) { + ost->is_past_recording_time = 1; + return 0; + } + + return 1; +} + +static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt) +{ + OutputFile *of = &output_files[ost->file_index]; + int64_t ost_tb_start_time = av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); + AVPicture pict; + AVPacket opkt; + + av_init_packet(&opkt); + + if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && + !ost->copy_initial_nonkeyframes) + return; + + /* force the input stream PTS */ + if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + audio_size += pkt->size; + else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + video_size += pkt->size; + ost->sync_opts++; + } + + opkt.stream_index = ost->index; + if (pkt->pts != AV_NOPTS_VALUE) + opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; + else + opkt.pts = AV_NOPTS_VALUE; + + if (pkt->dts == AV_NOPTS_VALUE) + opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base); + else + opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); + opkt.dts -= ost_tb_start_time; + + opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); + opkt.flags = pkt->flags; + + //FIXME remove the following 2 lines they shall be replaced by the bitstream filters + if( ost->st->codec->codec_id != CODEC_ID_H264 + && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO + && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO + ) { + if (av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, pkt->data, pkt->size, pkt->flags & AV_PKT_FLAG_KEY)) + opkt.destruct = av_destruct_packet; + } else { + opkt.data = pkt->data; + opkt.size = pkt->size; + } + if (of->ctx->oformat->flags & AVFMT_RAWPICTURE) { + /* store AVPicture in AVPacket, as expected by the output format */ + avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); + opkt.data = (uint8_t *)&pict; + opkt.size = sizeof(AVPicture); + opkt.flags |= AV_PKT_FLAG_KEY; + } + + write_frame(of->ctx, &opkt, ost->st->codec, ost->bitstream_filters); + ost->st->codec->frame_number++; + ost->frame_number++; + av_free_packet(&opkt); +} + +static void rate_emu_sleep(InputStream *ist) +{ + if (input_files[ist->file_index].rate_emu) { + int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE); + int64_t now = av_gettime() - ist->start; + if (pts > now) + usleep(pts - now); + } +} + +static int transcode_audio(InputStream *ist, AVPacket *pkt, int *got_output) +{ + static unsigned int samples_size = 0; + int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); + uint8_t *decoded_data_buf = NULL; + int decoded_data_size = 0; + int i, ret; + + if (pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) { + av_free(samples); + samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE); + samples = av_malloc(samples_size); + } + decoded_data_size = samples_size; + + ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size, + pkt); + if (ret < 0) + return ret; + pkt->data += ret; + pkt->size -= ret; + *got_output = decoded_data_size > 0; + + /* Some bug in mpeg audio decoder gives */ + /* decoded_data_size < 0, it seems they are overflows */ + if (!*got_output) { + /* no audio frame */ + return 0; + } + + decoded_data_buf = (uint8_t *)samples; + ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) / + (ist->st->codec->sample_rate * ist->st->codec->channels); + + // preprocess audio (volume) + if (audio_volume != 256) { + switch (ist->st->codec->sample_fmt) { + case AV_SAMPLE_FMT_U8: + { + uint8_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; + *volp++ = av_clip_uint8(v); + } + break; + } + case AV_SAMPLE_FMT_S16: + { + int16_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int v = ((*volp) * audio_volume + 128) >> 8; + *volp++ = av_clip_int16(v); + } + break; + } + case AV_SAMPLE_FMT_S32: + { + int32_t *volp = samples; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); + *volp++ = av_clipl_int32(v); + } + break; + } + case AV_SAMPLE_FMT_FLT: + { + float *volp = samples; + float scale = audio_volume / 256.f; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + *volp++ *= scale; + } + break; + } + case AV_SAMPLE_FMT_DBL: + { + double *volp = samples; + double scale = audio_volume / 256.; + for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { + *volp++ *= scale; + } + break; + } + default: + av_log(NULL, AV_LOG_FATAL, + "Audio volume adjustment on sample format %s is not supported.\n", + av_get_sample_fmt_name(ist->st->codec->sample_fmt)); + exit_program(1); + } + } + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + do_audio_out(output_files[ost->file_index].ctx, ost, ist, + decoded_data_buf, decoded_data_size); + } + return 0; +} + +static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts, int64_t *pkt_dts) +{ + AVFrame *decoded_frame, *filtered_frame = NULL; + void *buffer_to_free = NULL; + int i, ret = 0; + float quality = 0; +#if CONFIG_AVFILTER + int frame_available = 1; +#endif + + if (!(decoded_frame = avcodec_alloc_frame())) + return AVERROR(ENOMEM); + pkt->pts = *pkt_pts; + pkt->dts = *pkt_dts; + *pkt_pts = AV_NOPTS_VALUE; + + if(*pkt_dts != AV_NOPTS_VALUE && ist->st->codec->time_base.num != 0) { + int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; + *pkt_dts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; + }else + *pkt_dts = AV_NOPTS_VALUE; + + ret = avcodec_decode_video2(ist->st->codec, + decoded_frame, got_output, pkt); + if (ret < 0) + goto fail; + + quality = same_quant ? decoded_frame->quality : 0; + if (!*got_output) { + /* no picture yet */ + av_freep(&decoded_frame); + return 0; + } + + if(decoded_frame->best_effort_timestamp != AV_NOPTS_VALUE) + ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp; + + if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : + ist->st->codec->ticks_per_frame; + ist->next_pts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; + } + pkt->size = 0; + + pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); + +#if CONFIG_AVFILTER + for(i=0;i<nb_output_streams;i++) { + OutputFile *of = &output_files[output_streams[i].file_index]; + OutputStream *ost = ost = &output_streams[i]; + if(check_output_constraints(ist, ost)){ + if (!decoded_frame->sample_aspect_ratio.num) + decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + decoded_frame->pts = ist->pts; + + av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); + } + } +#endif + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + int frame_size; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + +#if CONFIG_AVFILTER + if (ost->input_video_filter) { + frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]); + } + while (frame_available) { + if (ost->output_video_filter) { + AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; + if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0) + goto cont; + if (!filtered_frame && !(filtered_frame = avcodec_alloc_frame())) { + ret = AVERROR(ENOMEM); + goto fail; + } + *filtered_frame= *decoded_frame; //for me_threshold + if (ost->picref) { + avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); + ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); + } + } + if (ost->picref->video && !ost->frame_aspect_ratio) + ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; +#else + filtered_frame = decoded_frame; +#endif + + do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size, + same_quant ? quality : ost->st->codec->global_quality); + if (vstats_filename && frame_size) + do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); +#if CONFIG_AVFILTER + cont: + frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); + avfilter_unref_buffer(ost->picref); + } + av_freep(&filtered_frame); +#endif + } + +fail: + av_free(buffer_to_free); + av_freep(&decoded_frame); + return ret; +} + +static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) +{ + AVSubtitle subtitle; + int i, ret = avcodec_decode_subtitle2(ist->st->codec, + &subtitle, got_output, pkt); + if (ret < 0) + return ret; + if (!*got_output) + return 0; + + pkt->size = 0; + + rate_emu_sleep(ist); + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = &output_streams[i]; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + + do_subtitle_out(output_files[ost->file_index].ctx, ost, ist, &subtitle, pkt->pts); + } + + avsubtitle_free(&subtitle); + return 0; +} + /* pkt = NULL means EOF (needed to flush decoder buffers) */ static int output_packet(InputStream *ist, int ist_index, OutputStream *ost_table, int nb_ostreams, const AVPacket *pkt) { - AVFormatContext *os; OutputStream *ost; int ret = 0, i; int got_output; - void *buffer_to_free = NULL; - static unsigned int samples_size= 0; - AVSubtitle subtitle, *subtitle_to_free; int64_t pkt_dts = AV_NOPTS_VALUE; int64_t pkt_pts = AV_NOPTS_VALUE; -#if CONFIG_AVFILTER - int frame_available; -#endif - float quality = 0; AVPacket avpkt; - int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt); if(ist->next_pts == AV_NOPTS_VALUE) ist->next_pts= ist->pts; @@ -1665,10 +1998,7 @@ static int output_packet(InputStream *ist, int ist_index, pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); //while we have more to decode or while the decoder did output something on EOF - while (avpkt.size > 0 || (!pkt && got_output)) { - uint8_t *data_buf, *decoded_data_buf; - int data_size, decoded_data_size; - AVFrame *decoded_frame, *filtered_frame; + while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { handle_eof: ist->pts= ist->next_pts; @@ -1677,348 +2007,56 @@ static int output_packet(InputStream *ist, int ist_index, "Multiple frames in a packet from stream %d\n", pkt->stream_index); ist->showed_multi_packet_warning=1; - /* decode the packet if needed */ - decoded_frame = filtered_frame = NULL; - decoded_data_buf = NULL; /* fail safe */ - decoded_data_size= 0; - data_buf = avpkt.data; - data_size = avpkt.size; - subtitle_to_free = NULL; - if (ist->decoding_needed) { - switch(ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO:{ - if(pkt && samples_size < FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE)) { - samples_size = FFMAX(pkt->size * bps, AVCODEC_MAX_AUDIO_FRAME_SIZE); - av_free(samples); - samples= av_malloc(samples_size); - } - decoded_data_size= samples_size; - /* XXX: could avoid copy if PCM 16 bits with same - endianness as CPU */ - ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size, - &avpkt); - if (ret < 0) - return ret; - avpkt.data += ret; - avpkt.size -= ret; - data_size = ret; - got_output = decoded_data_size > 0; - /* Some bug in mpeg audio decoder gives */ - /* decoded_data_size < 0, it seems they are overflows */ - if (!got_output) { - /* no audio frame */ - continue; - } - decoded_data_buf = (uint8_t *)samples; - ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) / - (ist->st->codec->sample_rate * ist->st->codec->channels); - break;} - case AVMEDIA_TYPE_VIDEO: - if (!(decoded_frame = avcodec_alloc_frame())) - return AVERROR(ENOMEM); - avpkt.pts = pkt_pts; - avpkt.dts = pkt_dts; - pkt_pts = AV_NOPTS_VALUE; - if(pkt_dts != AV_NOPTS_VALUE && ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - pkt_dts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - }else - pkt_dts = AV_NOPTS_VALUE; - - ret = avcodec_decode_video2(ist->st->codec, - decoded_frame, &got_output, &avpkt); - quality = same_quant ? decoded_frame->quality : 0; - if (ret < 0) - goto fail; - if (!got_output) { - /* no picture yet */ - av_freep(&decoded_frame); - goto discard_packet; - } - - if(decoded_frame->best_effort_timestamp != AV_NOPTS_VALUE) - ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp; - - if (ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - ist->next_pts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } - avpkt.size = 0; - buffer_to_free = NULL; - pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); - break; - case AVMEDIA_TYPE_SUBTITLE: - ret = avcodec_decode_subtitle2(ist->st->codec, - &subtitle, &got_output, &avpkt); - if (ret < 0) - return ret; - if (!got_output) { - goto discard_packet; - } - subtitle_to_free = &subtitle; - avpkt.size = 0; - break; - default: - return -1; - } - } else { - switch(ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / - ist->st->codec->sample_rate; - break; - case AVMEDIA_TYPE_VIDEO: - if (ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - ist->next_pts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } - break; - } - avpkt.size = 0; + switch(ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ret = transcode_audio (ist, &avpkt, &got_output); + break; + case AVMEDIA_TYPE_VIDEO: + ret = transcode_video (ist, &avpkt, &got_output, &pkt_pts, &pkt_dts); + break; + case AVMEDIA_TYPE_SUBTITLE: + ret = transcode_subtitles(ist, &avpkt, &got_output); + break; + default: + return -1; } -#if CONFIG_AVFILTER - if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - for(i=0;i<nb_ostreams;i++) { - OutputFile *of = &output_files[ost_table[i].file_index]; - if (of->start_time == 0 || ist->pts >= of->start_time) { - ost = &ost_table[i]; - if (ost->input_video_filter && ost->source_index == ist_index) { - if (!decoded_frame->sample_aspect_ratio.num) - decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; - decoded_frame->pts = ist->pts; - - av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); - } - } + if (ret < 0) + return ret; + if (!got_output) { + if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + continue; + goto discard_packet; } -#endif + } + discard_packet: - // preprocess audio (volume) - if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - if (audio_volume != 256) { - switch (ist->st->codec->sample_fmt) { - case AV_SAMPLE_FMT_U8: - { - uint8_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int v = (((*volp - 128) * audio_volume + 128) >> 8) + 128; - *volp++ = av_clip_uint8(v); - } - break; - } - case AV_SAMPLE_FMT_S16: - { - int16_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int v = ((*volp) * audio_volume + 128) >> 8; - *volp++ = av_clip_int16(v); - } - break; - } - case AV_SAMPLE_FMT_S32: - { - int32_t *volp = samples; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - int64_t v = (((int64_t)*volp * audio_volume + 128) >> 8); - *volp++ = av_clipl_int32(v); - } - break; - } - case AV_SAMPLE_FMT_FLT: - { - float *volp = samples; - float scale = audio_volume / 256.f; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - *volp++ *= scale; - } - break; - } - case AV_SAMPLE_FMT_DBL: - { - double *volp = samples; - double scale = audio_volume / 256.; - for (i = 0; i < (decoded_data_size / sizeof(*volp)); i++) { - *volp++ *= scale; - } - break; - } - default: - av_log(NULL, AV_LOG_FATAL, - "Audio volume adjustment on sample format %s is not supported.\n", - av_get_sample_fmt_name(ist->st->codec->sample_fmt)); - exit_program(1); - } + /* handle stream copy */ + if (!ist->decoding_needed) { + rate_emu_sleep(ist); + switch (ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / + ist->st->codec->sample_rate; + break; + case AVMEDIA_TYPE_VIDEO: + if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; + ist->next_pts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; } + break; } + } + for (i = 0; pkt && i < nb_ostreams; i++) { + ost = &ost_table[i]; - /* frame rate emulation */ - if (input_files[ist->file_index].rate_emu) { - int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE); - int64_t now = av_gettime() - ist->start; - if (pts > now) - usleep(pts - now); - } - /* if output time reached then transcode raw format, - encode packets and output them */ - for (i = 0; i < nb_ostreams; i++) { - OutputFile *of = &output_files[ost_table[i].file_index]; - int frame_size; - - ost = &ost_table[i]; - if (ost->source_index != ist_index) - continue; - - if (of->start_time && ist->pts < of->start_time) - continue; - - if (of->recording_time != INT64_MAX && - av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time, - (AVRational){1, 1000000}) >= 0) { - ost->is_past_recording_time = 1; - continue; - } - -#if CONFIG_AVFILTER - frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || - !ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]); - while (frame_available) { - if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter) { - AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; - if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0) - goto cont; - if (!filtered_frame && !(filtered_frame = avcodec_alloc_frame())) { - ret = AVERROR(ENOMEM); - goto fail; - } - *filtered_frame= *decoded_frame; //for me_threshold - if (ost->picref) { - avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); - ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); - } - } -#else - filtered_frame = decoded_frame; -#endif - os = output_files[ost->file_index].ctx; - - /* set the input output pts pairs */ - //ost->sync_ipts = (double)(ist->pts + input_files[ist->file_index].ts_offset - start_time)/ AV_TIME_BASE; - - if (ost->encoding_needed) { - av_assert0(ist->decoding_needed); - switch(ost->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size); - break; - case AVMEDIA_TYPE_VIDEO: -#if CONFIG_AVFILTER - if (ost->picref->video && !ost->frame_aspect_ratio) - ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; -#endif - do_video_out(os, ost, ist, filtered_frame, &frame_size, - same_quant ? quality : ost->st->codec->global_quality); - if (vstats_filename && frame_size) - do_video_stats(os, ost, frame_size); - break; - case AVMEDIA_TYPE_SUBTITLE: - do_subtitle_out(os, ost, ist, &subtitle, - pkt->pts); - break; - default: - abort(); - } - } else { - AVPicture pict; - AVPacket opkt; - int64_t ost_tb_start_time= av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base); - av_init_packet(&opkt); - - if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && - !ost->copy_initial_nonkeyframes) -#if !CONFIG_AVFILTER - continue; -#else - goto cont; -#endif - - /* no reencoding needed : output the packet directly */ - /* force the input stream PTS */ - - if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - audio_size += data_size; - else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - video_size += data_size; - ost->sync_opts++; - } - - opkt.stream_index= ost->index; - if(pkt->pts != AV_NOPTS_VALUE) - opkt.pts= av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; - else - opkt.pts= AV_NOPTS_VALUE; - - if (pkt->dts == AV_NOPTS_VALUE) - opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base); - else - opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); - opkt.dts -= ost_tb_start_time; - - opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); - opkt.flags= pkt->flags; - - //FIXME remove the following 2 lines they shall be replaced by the bitstream filters - if( ost->st->codec->codec_id != CODEC_ID_H264 - && ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO - && ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO - ) { - if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY)) - opkt.destruct= av_destruct_packet; - } else { - opkt.data = data_buf; - opkt.size = data_size; - } - - if (os->oformat->flags & AVFMT_RAWPICTURE) { - /* store AVPicture in AVPacket, as expected by the output format */ - avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); - opkt.data = (uint8_t *)&pict; - opkt.size = sizeof(AVPicture); - opkt.flags |= AV_PKT_FLAG_KEY; - } - write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters); - ost->st->codec->frame_number++; - ost->frame_number++; - av_free_packet(&opkt); - } -#if CONFIG_AVFILTER - cont: - frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) && - ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); - avfilter_unref_buffer(ost->picref); - } - av_freep(&filtered_frame); -#endif - } + if (!check_output_constraints(ist, ost) || ost->encoding_needed) + continue; -fail: - av_free(buffer_to_free); - /* XXX: allocate the subtitles in the codec ? */ - if (subtitle_to_free) { - avsubtitle_free(subtitle_to_free); - subtitle_to_free = NULL; - } - av_freep(&decoded_frame); - if (ret < 0) - return ret; + do_streamcopy(ist, ost, pkt); } - discard_packet: return 0; } diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index b61af18056..31d3b23d24 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -33,7 +33,7 @@ #include "libavutil/libm.h" // brought forward to work around cygwin header breakage #include <float.h> -#include <math.h> +#include "libavutil/mathematics.h" #include "avcodec.h" #include "put_bits.h" #include "aac.h" diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 2166928294..b7f21e0c11 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -2087,7 +2087,8 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ac->m4ac.chan_config = hdr_info.chan_config; if (set_default_channel_config(ac->avctx, new_che_pos, hdr_info.chan_config)) return -7; - if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, OC_TRIAL_FRAME)) + if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, + FFMAX(ac->output_configured, OC_TRIAL_FRAME))) return -7; } else if (ac->output_configured != OC_LOCKED) { ac->m4ac.chan_config = 0; diff --git a/libavcodec/arm/asm.S b/libavcodec/arm/asm.S index 856d2e986f..d711cb8f11 100644 --- a/libavcodec/arm/asm.S +++ b/libavcodec/arm/asm.S @@ -34,6 +34,22 @@ # define T @ #endif +#if HAVE_NEON + .arch armv7-a +#elif HAVE_ARMV6T2 + .arch armv6t2 +#elif HAVE_ARMV6 + .arch armv6 +#elif HAVE_ARMV5TE + .arch armv5te +#endif + +#if HAVE_NEON + .fpu neon +#elif HAVE_ARMVFP + .fpu vfp +#endif + .syntax unified T .thumb diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index dfd396c180..18e16ff584 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -36,6 +36,37 @@ #include "libavutil/rational.h" #include "libavcodec/version.h" +/** + * @defgroup libavc Encoding/Decoding Library + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + * + */ + /** * Identify the syntax and semantics of the bitstream. diff --git a/libavcodec/nellymoserenc.c b/libavcodec/nellymoserenc.c index 5af1c5c6ca..725270c9fa 100644 --- a/libavcodec/nellymoserenc.c +++ b/libavcodec/nellymoserenc.c @@ -35,6 +35,7 @@ * http://wiki.multimedia.cx/index.php?title=Nellymoser */ +#include "libavutil/mathematics.h" #include "nellymoser.h" #include "avcodec.h" #include "dsputil.h" diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 8a2cdbdcdb..83ecaad069 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -365,8 +365,8 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src, } if (for_user) { - dst->delay = src->thread_count - 1; - dst->coded_frame = src->coded_frame; + dst->delay = src->thread_count - 1; + dst->coded_frame = src->coded_frame; } else { if (dst->codec->update_thread_context) err = dst->codec->update_thread_context(dst, src); diff --git a/libavcodec/version.h b/libavcodec/version.h index a2d96a4900..591d419d26 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -21,7 +21,7 @@ #define AVCODEC_VERSION_H #define LIBAVCODEC_VERSION_MAJOR 53 -#define LIBAVCODEC_VERSION_MINOR 36 +#define LIBAVCODEC_VERSION_MINOR 37 #define LIBAVCODEC_VERSION_MICRO 0 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ diff --git a/libavcodec/wma.c b/libavcodec/wma.c index 67599b7eab..8f464619c2 100644 --- a/libavcodec/wma.c +++ b/libavcodec/wma.c @@ -137,6 +137,9 @@ int ff_wma_init(AVCodecContext *avctx, int flags2) /* compute MDCT block size */ s->frame_len_bits = ff_wma_get_frame_len_bits(s->sample_rate, s->version, 0); + s->next_block_len_bits = s->frame_len_bits; + s->prev_block_len_bits = s->frame_len_bits; + s->block_len_bits = s->frame_len_bits; s->frame_len = 1 << s->frame_len_bits; if (s->use_variable_block_len) { diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c index 83b9219135..a27c3b53d6 100644 --- a/libavcodec/x86/dsputil_mmx.c +++ b/libavcodec/x86/dsputil_mmx.c @@ -2855,6 +2855,10 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) #if HAVE_YASM c->scalarproduct_float = ff_scalarproduct_float_sse; c->butterflies_float_interleave = ff_butterflies_float_interleave_sse; + + if (!high_bit_depth) + c->emulated_edge_mc = emulated_edge_mc_sse; + c->gmc = gmc_sse; #endif } if (HAVE_AMD3DNOW && (mm_flags & AV_CPU_FLAG_3DNOW)) @@ -2875,10 +2879,6 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx) c->apply_window_int16 = ff_apply_window_int16_sse2; } } - - if (!high_bit_depth) - c->emulated_edge_mc = emulated_edge_mc_sse; - c->gmc= gmc_sse; #endif } if (mm_flags & AV_CPU_FLAG_SSSE3) { diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm index 0e497c9cda..64c87226a7 100644 --- a/libavcodec/x86/dsputil_yasm.asm +++ b/libavcodec/x86/dsputil_yasm.asm @@ -497,14 +497,14 @@ cglobal scalarproduct_float_sse, 3,3,2, v1, v2, offset ; ... and then the same for left/right extend also. See below for loop ; function implementations. Fast are fixed-width, slow is variable-width -%macro EMU_EDGE_FUNC 1 +%macro EMU_EDGE_FUNC 0 %ifdef ARCH_X86_64 %define w_reg r10 -cglobal emu_edge_core_%1, 6, 7, 1 +cglobal emu_edge_core, 6, 7, 1 mov r11, r5 ; save block_h %else %define w_reg r6 -cglobal emu_edge_core_%1, 2, 7, 0 +cglobal emu_edge_core, 2, 7, 0 mov r4, r4m ; end_y mov r5, r5m ; block_h %endif @@ -630,18 +630,18 @@ cglobal emu_edge_core_%1, 2, 7, 0 ; - if (%2 & 3 == 3) fills 2 bytes into r6, and 1 into ebx ; - else fills remaining bytes into ebx ; writing data out is in the same way -%macro READ_NUM_BYTES 3 +%macro READ_NUM_BYTES 2 %assign %%src_off 0 ; offset in source buffer %assign %%smidx 0 ; mmx register idx %assign %%sxidx 0 ; xmm register idx -%ifnidn %3, mmx +%if cpuflag(sse) %rep %2/16 - movdqu xmm %+ %%sxidx, [r1+%%src_off] + movups xmm %+ %%sxidx, [r1+%%src_off] %assign %%src_off %%src_off+16 %assign %%sxidx %%sxidx+1 %endrep ; %2/16 -%endif ; !mmx +%endif %ifdef ARCH_X86_64 %if (%2-%%src_off) == 8 @@ -679,14 +679,14 @@ cglobal emu_edge_core_%1, 2, 7, 0 %endif ; (%2-%%src_off) == 1/2/3 %endmacro ; READ_NUM_BYTES -%macro WRITE_NUM_BYTES 3 +%macro WRITE_NUM_BYTES 2 %assign %%dst_off 0 ; offset in destination buffer %assign %%dmidx 0 ; mmx register idx %assign %%dxidx 0 ; xmm register idx -%ifnidn %3, mmx +%if cpuflag(sse) %rep %2/16 - movdqu [r0+%%dst_off], xmm %+ %%dxidx + movups [r0+%%dst_off], xmm %+ %%dxidx %assign %%dst_off %%dst_off+16 %assign %%dxidx %%dxidx+1 %endrep ; %2/16 @@ -734,7 +734,7 @@ cglobal emu_edge_core_%1, 2, 7, 0 ; those out into the destination buffer ; r0=buf,r1=src,r2=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h ; r6(eax/64)/r3(ebx/32)=val_reg -%macro VERTICAL_EXTEND 1 +%macro VERTICAL_EXTEND 0 %assign %%n 1 %rep 22 ALIGN 128 @@ -747,9 +747,9 @@ ALIGN 128 cmp dword r3m, 0 je .emuedge_copy_body_ %+ %%n %+ _loop %endif ; ARCH_X86_64/32 - READ_NUM_BYTES top, %%n, %1 ; read bytes + READ_NUM_BYTES top, %%n ; read bytes .emuedge_extend_top_ %+ %%n %+ _loop: ; do { - WRITE_NUM_BYTES top, %%n, %1 ; write bytes + WRITE_NUM_BYTES top, %%n ; write bytes add r0 , r2 ; dst += linesize %ifdef ARCH_X86_64 dec r3d @@ -760,8 +760,8 @@ ALIGN 128 ; copy body pixels .emuedge_copy_body_ %+ %%n %+ _loop: ; do { - READ_NUM_BYTES body, %%n, %1 ; read bytes - WRITE_NUM_BYTES body, %%n, %1 ; write bytes + READ_NUM_BYTES body, %%n ; read bytes + WRITE_NUM_BYTES body, %%n ; write bytes add r0 , r2 ; dst += linesize add r1 , r2 ; src += linesize dec r4d @@ -771,9 +771,9 @@ ALIGN 128 test r5 , r5 ; if (!block_h) jz .emuedge_v_extend_end_ %+ %%n ; goto end sub r1 , r2 ; src -= linesize - READ_NUM_BYTES bottom, %%n, %1 ; read bytes + READ_NUM_BYTES bottom, %%n ; read bytes .emuedge_extend_bottom_ %+ %%n %+ _loop: ; do { - WRITE_NUM_BYTES bottom, %%n, %1 ; write bytes + WRITE_NUM_BYTES bottom, %%n ; write bytes add r0 , r2 ; dst += linesize dec r5d jnz .emuedge_extend_bottom_ %+ %%n %+ _loop ; } while (--block_h) @@ -796,17 +796,17 @@ ALIGN 128 ; lowest two bytes of the register (so val*0x0101), and are splatted ; into each byte of mm0 as well if n_pixels >= 8 -%macro READ_V_PIXEL 3 +%macro READ_V_PIXEL 2 mov vall, %2 mov valh, vall %if %1 >= 8 movd mm0, vald -%ifidn %3, mmx +%if cpuflag(mmx2) + pshufw mm0, mm0, 0 +%else ; mmx punpcklwd mm0, mm0 punpckldq mm0, mm0 -%else ; !mmx - pshufw mm0, mm0, 0 -%endif ; mmx +%endif ; sse %endif ; %1 >= 8 %endmacro @@ -831,13 +831,13 @@ ALIGN 128 %endmacro ; r0=buf+block_h*linesize, r1=start_x, r2=linesize, r5=block_h, r6/r3=val -%macro LEFT_EXTEND 1 +%macro LEFT_EXTEND 0 %assign %%n 2 %rep 11 ALIGN 64 .emuedge_extend_left_ %+ %%n: ; do { sub r0, r2 ; dst -= linesize - READ_V_PIXEL %%n, [r0+r1], %1 ; read pixels + READ_V_PIXEL %%n, [r0+r1] ; read pixels WRITE_V_PIXEL %%n, r0 ; write pixels dec r5 jnz .emuedge_extend_left_ %+ %%n ; } while (--block_h) @@ -851,19 +851,19 @@ ALIGN 64 %endmacro ; LEFT_EXTEND ; r3/r0=buf+block_h*linesize, r2=linesize, r11/r5=block_h, r0/r6=end_x, r6/r3=val -%macro RIGHT_EXTEND 1 +%macro RIGHT_EXTEND 0 %assign %%n 2 %rep 11 ALIGN 64 .emuedge_extend_right_ %+ %%n: ; do { %ifdef ARCH_X86_64 sub r3, r2 ; dst -= linesize - READ_V_PIXEL %%n, [r3+w_reg-1], %1 ; read pixels + READ_V_PIXEL %%n, [r3+w_reg-1] ; read pixels WRITE_V_PIXEL %%n, r3+r4-%%n ; write pixels dec r11 %else ; ARCH_X86_32 sub r0, r2 ; dst -= linesize - READ_V_PIXEL %%n, [r0+w_reg-1], %1 ; read pixels + READ_V_PIXEL %%n, [r0+w_reg-1] ; read pixels WRITE_V_PIXEL %%n, r0+r4-%%n ; write pixels dec r5 %endif ; ARCH_X86_64/32 @@ -905,17 +905,17 @@ ALIGN 64 .%1_skip_%4_px: %endmacro -%macro V_COPY_ROW 3 +%macro V_COPY_ROW 2 %ifidn %1, bottom sub r1, linesize %endif .%1_copy_loop: xor cnt_reg, cnt_reg -%ifidn %3, mmx +%if notcpuflag(sse) %define linesize r2m V_COPY_NPX %1, mm0, movq, 8, 0xFFFFFFF8 -%else ; !mmx - V_COPY_NPX %1, xmm0, movdqu, 16, 0xFFFFFFF0 +%else ; sse + V_COPY_NPX %1, xmm0, movups, 16, 0xFFFFFFF0 %ifdef ARCH_X86_64 %define linesize r2 V_COPY_NPX %1, rax , mov, 8 @@ -923,7 +923,7 @@ ALIGN 64 %define linesize r2m V_COPY_NPX %1, mm0, movq, 8 %endif ; ARCH_X86_64/32 -%endif ; mmx +%endif ; sse V_COPY_NPX %1, vald, mov, 4 V_COPY_NPX %1, valw, mov, 2 V_COPY_NPX %1, vall, mov, 1 @@ -936,7 +936,7 @@ ALIGN 64 jnz .%1_copy_loop %endmacro -%macro SLOW_V_EXTEND 1 +%macro SLOW_V_EXTEND 0 .slow_v_extend_loop: ; r0=buf,r1=src,r2(64)/r2m(32)=linesize,r3(64)/r3m(32)=start_x,r4=end_y,r5=block_h ; r11(64)/r3(later-64)/r2(32)=cnt_reg,r6(64)/r3(32)=val_reg,r10(64)/r6(32)=w=end_x-start_x @@ -945,16 +945,16 @@ ALIGN 64 test r3, r3 %define cnt_reg r11 jz .do_body_copy ; if (!start_y) goto do_body_copy - V_COPY_ROW top, r3, %1 + V_COPY_ROW top, r3 %else cmp dword r3m, 0 %define cnt_reg r2 je .do_body_copy ; if (!start_y) goto do_body_copy - V_COPY_ROW top, dword r3m, %1 + V_COPY_ROW top, dword r3m %endif .do_body_copy: - V_COPY_ROW body, r4, %1 + V_COPY_ROW body, r4 %ifdef ARCH_X86_64 pop r11 ; restore old value of block_h @@ -966,7 +966,7 @@ ALIGN 64 %else jz .skip_bottom_extend %endif - V_COPY_ROW bottom, r5, %1 + V_COPY_ROW bottom, r5 %ifdef ARCH_X86_32 .skip_bottom_extend: mov r2, r2m @@ -974,12 +974,12 @@ ALIGN 64 jmp .v_extend_end %endmacro -%macro SLOW_LEFT_EXTEND 1 +%macro SLOW_LEFT_EXTEND 0 .slow_left_extend_loop: ; r0=buf+block_h*linesize,r2=linesize,r6(64)/r3(32)=val,r5=block_h,r4=cntr,r10/r6=start_x mov r4, 8 sub r0, linesize - READ_V_PIXEL 8, [r0+w_reg], %1 + READ_V_PIXEL 8, [r0+w_reg] .left_extend_8px_loop: movq [r0+r4-8], mm0 add r4, 8 @@ -1002,7 +1002,7 @@ ALIGN 64 jmp .right_extend %endmacro -%macro SLOW_RIGHT_EXTEND 1 +%macro SLOW_RIGHT_EXTEND 0 .slow_right_extend_loop: ; r3(64)/r0(32)=buf+block_h*linesize,r2=linesize,r4=block_w,r11(64)/r5(32)=block_h, ; r10(64)/r6(32)=end_x,r6/r3=val,r1=cntr @@ -1015,7 +1015,7 @@ ALIGN 64 %endif lea r1, [r4-8] sub buf_reg, linesize - READ_V_PIXEL 8, [buf_reg+w_reg-1], %1 + READ_V_PIXEL 8, [buf_reg+w_reg-1] .right_extend_8px_loop: movq [buf_reg+r1], mm0 sub r1, 8 @@ -1036,13 +1036,14 @@ ALIGN 64 %endmacro %macro emu_edge 1 -EMU_EDGE_FUNC %1 -VERTICAL_EXTEND %1 -LEFT_EXTEND %1 -RIGHT_EXTEND %1 -SLOW_V_EXTEND %1 -SLOW_LEFT_EXTEND %1 -SLOW_RIGHT_EXTEND %1 +INIT_XMM %1 +EMU_EDGE_FUNC +VERTICAL_EXTEND +LEFT_EXTEND +RIGHT_EXTEND +SLOW_V_EXTEND +SLOW_LEFT_EXTEND +SLOW_RIGHT_EXTEND %endmacro emu_edge sse diff --git a/libavformat/avformat.h b/libavformat/avformat.h index e0e9c1f734..752645e2c5 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -21,6 +21,40 @@ #ifndef AVFORMAT_AVFORMAT_H #define AVFORMAT_AVFORMAT_H +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * @defgroup lavf_decoding Demuxing + * @{ + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * @} + * + * @defgroup lavf_proto I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ /** * Return the LIBAVFORMAT_VERSION_INT constant. diff --git a/libavformat/mov.c b/libavformat/mov.c index e940427685..a30b6bb7d2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -44,21 +44,6 @@ /* * First version by Francois Revol revol@free.fr * Seek function by Gael Chardon gael.dev@4now.net - * - * Features and limitations: - * - reads most of the QT files I have (at least the structure), - * Sample QuickTime files with mp3 audio can be found at: http://www.3ivx.com/showcase.html - * - the code is quite ugly... maybe I won't do it recursive next time :-) - * - * Funny I didn't know about http://sourceforge.net/projects/qt-ffmpeg/ - * when coding this :) (it's a writer anyway) - * - * Reference documents: - * http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt - * Apple: - * http://developer.apple.com/documentation/QuickTime/QTFF/ - * http://developer.apple.com/documentation/QuickTime/QTFF/qtff.pdf - * QuickTime is a trademark of Apple (AFAIK :)) */ #include "qtpalette.h" @@ -67,13 +52,7 @@ #undef NDEBUG #include <assert.h> -/* XXX: it's the first time I make a recursive parser I think... sorry if it's ugly :P */ - /* those functions parse an atom */ -/* return code: - 0: continue to parse next atom - <0: error occurred, exit -*/ /* links atom IDs to parse functions */ typedef struct MOVParseTableEntry { uint32_t type; diff --git a/libavutil/adler32.h b/libavutil/adler32.h index 0b890bcc11..e926ef6cc2 100644 --- a/libavutil/adler32.h +++ b/libavutil/adler32.h @@ -25,6 +25,7 @@ #include "attributes.h" /** + * @ingroup lavu_crypto * Calculate the Adler32 checksum of a buffer. * * Passing the return value to a subsequent av_adler32_update() call diff --git a/libavutil/aes.h b/libavutil/aes.h index 368f70cbbb..bafa4cc3c4 100644 --- a/libavutil/aes.h +++ b/libavutil/aes.h @@ -23,6 +23,12 @@ #include <stdint.h> +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + extern const int av_aes_size; struct AVAES; @@ -44,4 +50,8 @@ int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); */ void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); +/** + * @} + */ + #endif /* AVUTIL_AES_H */ diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h index 4e0e98c9b4..766ef8b9da 100644 --- a/libavutil/audioconvert.h +++ b/libavutil/audioconvert.h @@ -29,7 +29,15 @@ * audio conversion routines */ -/* Audio channel masks */ +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * @{ + */ #define AV_CH_FRONT_LEFT 0x00000001 #define AV_CH_FRONT_RIGHT 0x00000002 #define AV_CH_FRONT_CENTER 0x00000004 @@ -56,7 +64,11 @@ to be the native codec channel order. */ #define AV_CH_LAYOUT_NATIVE 0x8000000000000000LL -/* Audio channel convenience macros */ +/** + * @} + * @defgroup channel_mask_c Audio channel convenience macros + * @{ + * */ #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) #define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) #define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) @@ -74,6 +86,10 @@ #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) /** + * @} + */ + +/** * Return a channel layout id that matches name, 0 if no match. * name can be one or several of the following notations, * separated by '+' or '|': @@ -109,4 +125,8 @@ int av_get_channel_layout_nb_channels(int64_t channel_layout); */ int64_t av_get_default_channel_layout(int nb_channels); +/** + * @} + */ + #endif /* AVUTIL_AUDIOCONVERT_H */ diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 4ea64e46a9..147d7acbe5 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -25,6 +25,11 @@ #include "attributes.h" /** + * @addtogroup lavu_string + * @{ + */ + +/** * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to * the address of the first character in str after the prefix. * @@ -72,7 +77,7 @@ char *av_stristr(const char *haystack, const char *needle); * @param size size of destination buffer * @return the length of src * - * WARNING: since the return value is the length of src, src absolutely + * @warning since the return value is the length of src, src absolutely * _must_ be a properly 0-terminated string, otherwise this will read beyond * the end of the buffer and possibly crash. */ @@ -90,9 +95,9 @@ size_t av_strlcpy(char *dst, const char *src, size_t size); * @param size size of destination buffer * @return the total length of src and dst * - * WARNING: since the return value use the length of src and dst, these absolutely - * _must_ be a properly 0-terminated strings, otherwise this will read beyond - * the end of the buffer and possibly crash. + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. */ size_t av_strlcat(char *dst, const char *src, size_t size); @@ -187,14 +192,18 @@ static inline int av_tolower(int c) /** * Locale independent case-insensitive compare. - * Note: This means only ASCII-range characters are case-insensitive + * @note This means only ASCII-range characters are case-insensitive */ int av_strcasecmp(const char *a, const char *b); /** * Locale independent case-insensitive compare. - * Note: This means only ASCII-range characters are case-insensitive + * @note This means only ASCII-range characters are case-insensitive */ int av_strncasecmp(const char *a, const char *b, size_t n); +/** + * @} + */ + #endif /* AVUTIL_AVSTRING_H */ diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 0fa46b8230..a654f8b332 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -26,6 +26,95 @@ * external API header */ +/** + * @mainpage + * + * @section libav_intro Introduction + * + * This document describe the usage of the different libraries + * provided by Libav. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @subpage libavfilter graph based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @subpage libpostproc post processing library + * @li @subpage libswscale color conversion and scaling library + * + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other Libav + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + */ + + +/** + * @defgroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ #define AV_STRINGIFY(s) AV_TOSTRING(s) #define AV_TOSTRING(s) #s @@ -35,10 +124,34 @@ #define AV_PRAGMA(s) _Pragma(#s) +/** + * @} + */ + +/** + * @defgroup version_utils Library Version Macros + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + #define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) +/** + * @} + * + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 26 #define LIBAVUTIL_VERSION_MICRO 0 @@ -54,8 +167,16 @@ #define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) /** + * @} + * + * @defgroup depr_guards Deprecation guards * Those FF_API_* defines are not part of public API. * They may change, break or disappear at any time. + * + * They are used mostly internally to mark code that will be removed + * on the next major version. + * + * @{ */ #ifndef FF_API_OLD_EVAL_NAMES #define FF_API_OLD_EVAL_NAMES (LIBAVUTIL_VERSION_MAJOR < 52) @@ -74,6 +195,15 @@ #endif /** + * @} + */ + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** * Return the LIBAVUTIL_VERSION_INT constant. */ unsigned avutil_version(void); @@ -88,13 +218,22 @@ const char *avutil_configuration(void); */ const char *avutil_license(void); +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + enum AVMediaType { - AVMEDIA_TYPE_UNKNOWN = -1, + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA AVMEDIA_TYPE_VIDEO, AVMEDIA_TYPE_AUDIO, - AVMEDIA_TYPE_DATA, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous AVMEDIA_TYPE_SUBTITLE, - AVMEDIA_TYPE_ATTACHMENT, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse AVMEDIA_TYPE_NB }; @@ -104,6 +243,16 @@ enum AVMediaType { */ const char *av_get_media_type_string(enum AVMediaType media_type); +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + #define FF_LAMBDA_SHIFT 7 #define FF_LAMBDA_SCALE (1<<FF_LAMBDA_SHIFT) #define FF_QP2LAMBDA 118 ///< factor to convert from H.263 QP to lambda @@ -111,10 +260,46 @@ const char *av_get_media_type_string(enum AVMediaType media_type); #define FF_QUALITY_SCALE FF_LAMBDA_SCALE //FIXME maybe remove +/** + * @} + * @defgroup lavu_time Timestamp specific + * + * Libav internal timebase and timestamp definitions + * + * @{ + */ + +/** + * @brief Undefined timestamp value + * + * Usually reported by demuxer that work on containers that do not provide + * either pts or dts. + */ + #define AV_NOPTS_VALUE INT64_C(0x8000000000000000) + +/** + * Internal time base represented as integer + */ + #define AV_TIME_BASE 1000000 + +/** + * Internal time base represented as fractional value + */ + #define AV_TIME_BASE_Q (AVRational){1, AV_TIME_BASE} +/** + * @} + * @} + * @defgroup lavu_picture Image related + * + * AVPicture types, pixel formats and basic image planes manipulation. + * + * @{ + */ + enum AVPictureType { AV_PICTURE_TYPE_NONE = 0, ///< Undefined AV_PICTURE_TYPE_I, ///< Intra @@ -136,6 +321,10 @@ enum AVPictureType { char av_get_picture_type_char(enum AVPictureType pict_type); /** + * @} + */ + +/** * Return x default pointer in case p is NULL. */ static inline const void *av_x_if_null(const void *p, const void *x) @@ -151,4 +340,9 @@ static inline const void *av_x_if_null(const void *p, const void *x) #include "log.h" #include "pixfmt.h" +/** + * @} + * @} + */ + #endif /* AVUTIL_AVUTIL_H */ diff --git a/libavutil/base64.h b/libavutil/base64.h index 092980b093..b095576130 100644 --- a/libavutil/base64.h +++ b/libavutil/base64.h @@ -24,6 +24,13 @@ #include <stdint.h> /** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** * Decode a base64-encoded string. * * @param out buffer for decoded data @@ -51,4 +58,8 @@ char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); */ #define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + /** + * @} + */ + #endif /* AVUTIL_BASE64_H */ diff --git a/libavutil/dict.h b/libavutil/dict.h index 84f58ec473..2adf28c124 100644 --- a/libavutil/dict.h +++ b/libavutil/dict.h @@ -32,7 +32,11 @@ #define AVUTIL_DICT_H /** - * @defgroup dict_api Public Dictionary API + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * * @{ * Dictionaries are used for storing key:value pairs. To create * an AVDictionary, simply pass an address of a NULL pointer to @@ -58,7 +62,6 @@ * av_dict_free(&d); * @endcode * - * @} */ #define AV_DICT_MATCH_CASE 1 @@ -117,4 +120,8 @@ void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); */ void av_dict_free(AVDictionary **m); +/** + * @} + */ + #endif // AVUTIL_DICT_H diff --git a/libavutil/error.h b/libavutil/error.h index 47d366ebbc..fa18afcdf1 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -27,6 +27,13 @@ #include <errno.h> #include "avutil.h" +/** + * @addtogroup lavu_error + * + * @{ + */ + + /* error handling */ #if EDOM > 0 #define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. @@ -65,4 +72,8 @@ */ int av_strerror(int errnum, char *errbuf, size_t errbuf_size); +/** + * @} + */ + #endif /* AVUTIL_ERROR_H */ diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h index f976d210b9..9b53815fb6 100644 --- a/libavutil/imgutils.h +++ b/libavutil/imgutils.h @@ -22,6 +22,9 @@ /** * @file * misc image utilities + * + * @addtogroup lavu_picture + * @{ */ #include "avutil.h" @@ -127,4 +130,9 @@ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *lo int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt); +/** + * @} + */ + + #endif /* AVUTIL_IMGUTILS_H */ diff --git a/libavutil/intmath.h b/libavutil/intmath.h index 8b400ef054..0feedf8cfd 100644 --- a/libavutil/intmath.h +++ b/libavutil/intmath.h @@ -25,6 +25,11 @@ #include "config.h" #include "attributes.h" +/** + * @addtogroup lavu_internal + * @{ + */ + extern const uint32_t ff_inverse[257]; #if ARCH_ARM @@ -76,4 +81,7 @@ static inline av_const unsigned int ff_sqrt(unsigned int a) return b - (a < b * b); } +/** + * @} + */ #endif /* AVUTIL_INTMATH_H */ diff --git a/libavutil/lzo.h b/libavutil/lzo.h index ae5fc53c61..1603d3b3bc 100644 --- a/libavutil/lzo.h +++ b/libavutil/lzo.h @@ -22,6 +22,13 @@ #ifndef AVUTIL_LZO_H #define AVUTIL_LZO_H +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + #include <stdint.h> /** @name Error flags returned by av_lzo1x_decode @@ -63,4 +70,8 @@ int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); */ void av_memcpy_backptr(uint8_t *dst, int back, int cnt); +/** + * @} + */ + #endif /* AVUTIL_LZO_H */ diff --git a/libavutil/mathematics.h b/libavutil/mathematics.h index 882a516393..ad39e263ce 100644 --- a/libavutil/mathematics.h +++ b/libavutil/mathematics.h @@ -57,6 +57,12 @@ #define INFINITY (1.0/0.0) #endif +/** + * @addtogroup lavu_math + * @{ + */ + + enum AVRounding { AV_ROUND_ZERO = 0, ///< Round toward zero. AV_ROUND_INF = 1, ///< Round away from zero. @@ -109,4 +115,8 @@ int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); */ int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); +/** + * @} + */ + #endif /* AVUTIL_MATHEMATICS_H */ diff --git a/libavutil/md5.h b/libavutil/md5.h index 969202a807..1333ab2ddf 100644 --- a/libavutil/md5.h +++ b/libavutil/md5.h @@ -23,6 +23,12 @@ #include <stdint.h> +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + extern const int av_md5_size; struct AVMD5; @@ -32,5 +38,9 @@ void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); +/** + * @} + */ + #endif /* AVUTIL_MD5_H */ diff --git a/libavutil/mem.h b/libavutil/mem.h index 179e12f32f..f148c637bb 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -30,6 +30,12 @@ #include "error.h" #include "avutil.h" +/** + * @addtogroup lavu_mem + * @{ + */ + + #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v @@ -170,4 +176,8 @@ static inline int av_size_mult(size_t a, size_t b, size_t *r) return 0; } +/** + * @} + */ + #endif /* AVUTIL_MEM_H */ diff --git a/libavutil/opt.h b/libavutil/opt.h index f8a14e0876..a0730a7d3b 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -34,6 +34,7 @@ /** * @defgroup avoptions AVOptions + * @ingroup lavu_data * @{ * AVOptions provide a generic system to declare options on arbitrary structs * ("objects"). An option can have a help text, a type and a range of possible @@ -212,7 +213,6 @@ * filled with option as a parameter. This allows to set some options * that cannot be set otherwise, since e.g. the input file format is not known * before the file is actually opened. - * @} */ enum AVOptionType{ @@ -586,6 +586,7 @@ int av_opt_get_double(void *obj, const char *name, int search_flags, double int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); /** * @} + * @} */ #endif /* AVUTIL_OPT_H */ diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 37b694e7bf..f711de7828 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -25,21 +25,21 @@ * @file * pixel format definitions * - * @warning This file has to be considered an internal but installed - * header, so it should not be directly included in your projects. */ #include "libavutil/avconfig.h" /** - * Pixel format. Notes: + * Pixel format. * + * @note * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA * color is put together as: * (A << 24) | (R << 16) | (G << 8) | B * This is stored as BGRA on little-endian CPU architectures and ARGB on * big-endian CPUs. * + * @par * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized * image data is stored in AVFrame.data[0]. The palette is transported in * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is @@ -49,13 +49,15 @@ * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. * + * @par * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like * for pal8. This palette is filled in automatically by the function * allocating the picture. * - * Note, make sure that all newly added big endian formats have pix_fmt&1==1 - * and that all newly added little endian formats have pix_fmt&1==0 - * this allows simpler detection of big vs little endian. + * @note + * make sure that all newly added big endian formats have pix_fmt&1==1 + * and that all newly added little endian formats have pix_fmt&1==0 + * this allows simpler detection of big vs little endian. */ enum PixelFormat { PIX_FMT_NONE= -1, diff --git a/libavutil/random_seed.h b/libavutil/random_seed.h index bb957879be..0462a048e0 100644 --- a/libavutil/random_seed.h +++ b/libavutil/random_seed.h @@ -22,6 +22,10 @@ #define AVUTIL_RANDOM_SEED_H #include <stdint.h> +/** + * @addtogroup lavu_crypto + * @{ + */ /** * Get a seed to use in conjunction with random functions. @@ -32,4 +36,8 @@ */ uint32_t av_get_random_seed(void); +/** + * @} + */ + #endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/libavutil/rational.h b/libavutil/rational.h index 789e4aca2c..8c2bdb5529 100644 --- a/libavutil/rational.h +++ b/libavutil/rational.h @@ -33,6 +33,11 @@ #include "attributes.h" /** + * @addtogroup lavu_math + * @{ + */ + +/** * rational number numerator/denominator */ typedef struct AVRational{ @@ -132,4 +137,8 @@ int av_nearer_q(AVRational q, AVRational q1, AVRational q2); */ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); +/** + * @} + */ + #endif /* AVUTIL_RATIONAL_H */ diff --git a/libavutil/sha.h b/libavutil/sha.h index 543f5a1949..d891cae87f 100644 --- a/libavutil/sha.h +++ b/libavutil/sha.h @@ -23,6 +23,12 @@ #include <stdint.h> +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ + extern const int av_sha_size; struct AVSHA; @@ -53,4 +59,8 @@ void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len) */ void av_sha_final(struct AVSHA* context, uint8_t *digest); +/** + * @} + */ + #endif /* AVUTIL_SHA_H */ diff --git a/libavutil/tree.h b/libavutil/tree.h index 8c7de2ffbf..81610b6b79 100644 --- a/libavutil/tree.h +++ b/libavutil/tree.h @@ -21,14 +21,24 @@ /** * @file * A tree container. - * Insertion, removal, finding equal, largest which is smaller than and - * smallest which is larger than, all have O(log n) worst case complexity. * @author Michael Niedermayer <michaelni@gmx.at> */ #ifndef AVUTIL_TREE_H #define AVUTIL_TREE_H +/** + * @addtogroup lavu_tree AVTree + * @ingroup lavu_data + * + * Low complexity tree container + * + * Insertion, removal, finding equal, largest which is smaller than and + * smallest which is larger than, all have O(log n) worst case complexity. + * @{ + */ + + struct AVTreeNode; extern const int av_tree_node_size; @@ -91,5 +101,8 @@ void av_tree_destroy(struct AVTreeNode *t); */ void av_tree_enumerate(struct AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem)); +/** + * @} + */ #endif /* AVUTIL_TREE_H */ diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh index 4fd5d17d17..12f74f055d 100755 --- a/tests/codec-regression.sh +++ b/tests/codec-regression.sh @@ -29,19 +29,27 @@ if [ -n "$do_mpeg2" ] ; then # mpeg2 do_video_encoding mpeg2.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video" do_video_decoding +fi +if [ -n "$do_mpeg2_ivlc_qprd" ]; then # mpeg2 encoding intra vlc qprd do_video_encoding mpeg2ivlc-qprd.mpg "-vb 500k -bf 2 -trellis 1 -flags +qprd+mv0 -flags2 +ivlc -cmp 2 -subcmp 2 -mbd rd -vcodec mpeg2video -f mpeg2video" do_video_decoding +fi +if [ -n "$do_mpeg2_422" ]; then #mpeg2 4:2:2 encoding do_video_encoding mpeg2_422.mpg "-vb 1000k -bf 2 -trellis 1 -flags +qprd+mv0+ildct+ilme -flags2 +ivlc -mbd rd -vcodec mpeg2video -pix_fmt yuv422p -f mpeg2video" do_video_decoding +fi +if [ -n "$do_mpeg2_idct_int" ]; then # mpeg2 -do_video_encoding mpeg2.mpg "-qscale 10 -vcodec mpeg2video -idct int -dct int -f mpeg1video" +do_video_encoding mpeg2_idct_int.mpg "-qscale 10 -vcodec mpeg2video -idct int -dct int -f mpeg1video" do_video_decoding "-idct int" +fi +if [ -n "$do_mpeg2_ilace" ]; then # mpeg2 encoding interlaced do_video_encoding mpeg2i.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -flags +ildct+ilme" do_video_decoding @@ -51,7 +59,9 @@ if [ -n "$do_mpeg2thread" ] ; then # mpeg2 encoding interlaced do_video_encoding mpeg2thread.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -threads 2" do_video_decoding +fi +if [ -n "$do_mpeg2thread_ilace" ]; then # mpeg2 encoding interlaced using intra vlc do_video_encoding mpeg2threadivlc.mpg "-qscale 10 -vcodec mpeg2video -f mpeg1video -bf 2 -flags +ildct+ilme -flags2 +ivlc -threads 2" do_video_decoding @@ -125,13 +135,19 @@ fi if [ -n "$do_mpeg4adv" ] ; then do_video_encoding mpeg4-adv.avi "-qscale 9 -flags +mv4+part+aic -trellis 1 -mbd bits -ps 200 -an -vcodec mpeg4" do_video_decoding +fi +if [ -n "$do_mpeg4_qprd" ]; then do_video_encoding mpeg4-qprd.avi "-b 450k -bf 2 -trellis 1 -flags +mv4+qprd+mv0 -cmp 2 -subcmp 2 -mbd rd -an -vcodec mpeg4" do_video_decoding +fi +if [ -n "$do_mpeg4_adap" ]; then do_video_encoding mpeg4-adap.avi "-b 550k -bf 2 -flags +mv4+mv0 -trellis 1 -cmp 1 -subcmp 2 -mbd rd -scplx_mask 0.3 -an -vcodec mpeg4" do_video_decoding +fi +if [ -n "$do_mpeg4_qpel" ]; then do_video_encoding mpeg4-Q.avi "-qscale 7 -flags +mv4+qpel -mbd 2 -bf 2 -cmp 1 -subcmp 2 -an -vcodec mpeg4" do_video_decoding fi @@ -219,7 +235,9 @@ fi if [ -n "$do_dv" ] ; then do_video_encoding dv.dv "-dct int -s pal -an" do_video_decoding "" "-s cif" +fi +if [ -n "$do_dv_411" ]; then do_video_encoding dv411.dv "-dct int -s pal -an -pix_fmt yuv411p -sws_flags area+accurate_rnd+bitexact" do_video_decoding "" "-s cif -sws_flags area+accurate_rnd+bitexact" fi diff --git a/tests/ref/seek/mpeg2_mpg b/tests/ref/seek/mpeg2_idct_int_mpg index b096f6fe7c..b096f6fe7c 100644 --- a/tests/ref/seek/mpeg2_mpg +++ b/tests/ref/seek/mpeg2_idct_int_mpg diff --git a/tests/ref/vsynth1/dv b/tests/ref/vsynth1/dv index 5b55c4f357..3e71feceeb 100644 --- a/tests/ref/vsynth1/dv +++ b/tests/ref/vsynth1/dv @@ -1,8 +1,4 @@ 4d572f758b55a1756adf9f54132f3b9e *./tests/data/vsynth1/dv.dv 7200000 ./tests/data/vsynth1/dv.dv 02ac7cdeab91d4d5621e7ce96dddc498 *./tests/data/dv.vsynth1.out.yuv -stddev: 6.90 PSNR: 31.34 MAXDIFF: 76 bytes: 7603200/ 7603200 -f179899efba432c6f01149c36c709092 *./tests/data/vsynth1/dv411.dv -7200000 ./tests/data/vsynth1/dv411.dv -b6640a3a572353f51284acb746eb00c4 *./tests/data/dv.vsynth1.out.yuv -stddev: 30.76 PSNR: 18.37 MAXDIFF: 205 bytes: 7603200/ 7603200 +stddev: 6.90 PSNR: 31.34 MAXDIFF: 76 bytes: 7603200/ 7603200
\ No newline at end of file diff --git a/tests/ref/vsynth1/dv_411 b/tests/ref/vsynth1/dv_411 new file mode 100644 index 0000000000..c45b593c02 --- /dev/null +++ b/tests/ref/vsynth1/dv_411 @@ -0,0 +1,4 @@ +f179899efba432c6f01149c36c709092 *./tests/data/vsynth1/dv411.dv +7200000 ./tests/data/vsynth1/dv411.dv +b6640a3a572353f51284acb746eb00c4 *./tests/data/dv_411.vsynth1.out.yuv +stddev: 30.76 PSNR: 18.37 MAXDIFF: 205 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2 b/tests/ref/vsynth1/mpeg2 index e6d404dc09..0df3b7f248 100644 --- a/tests/ref/vsynth1/mpeg2 +++ b/tests/ref/vsynth1/mpeg2 @@ -2,19 +2,3 @@ fbddea2368cd2028fc8db4dfd4682e94 *./tests/data/vsynth1/mpeg2.mpg 728044 ./tests/data/vsynth1/mpeg2.mpg b41ca49c1a02e66ce64d262e2cdaec15 *./tests/data/mpeg2.vsynth1.out.yuv stddev: 7.65 PSNR: 30.45 MAXDIFF: 84 bytes: 7603200/ 7603200 -8f6b20714918e6443e0c03716ed06f0d *./tests/data/vsynth1/mpeg2ivlc-qprd.mpg -783552 ./tests/data/vsynth1/mpeg2ivlc-qprd.mpg -98eb9da15f880978e7f2ee1e7ce476ef *./tests/data/mpeg2.vsynth1.out.yuv -stddev: 10.07 PSNR: 28.06 MAXDIFF: 165 bytes: 7603200/ 7603200 -af0cb75451aaa807beb5102707a98823 *./tests/data/vsynth1/mpeg2_422.mpg -728200 ./tests/data/vsynth1/mpeg2_422.mpg -29b518282493203e83b27a939795dc3a *./tests/data/mpeg2.vsynth1.out.yuv -stddev: 63.33 PSNR: 12.10 MAXDIFF: 242 bytes: 10137600/ 7603200 -4c067397b504d65532d7779cd36f3f88 *./tests/data/vsynth1/mpeg2.mpg -725668 ./tests/data/vsynth1/mpeg2.mpg -9f7b065f98d57cdecf90e6f7a2524eb5 *./tests/data/mpeg2.vsynth1.out.yuv -stddev: 7.65 PSNR: 30.45 MAXDIFF: 81 bytes: 7603200/ 7603200 -ec3f6713c88a2b41f6c369fd64341077 *./tests/data/vsynth1/mpeg2i.mpg -737473 ./tests/data/vsynth1/mpeg2i.mpg -97615390fdd69abfcbc7e02df863a7d2 *./tests/data/mpeg2.vsynth1.out.yuv -stddev: 7.67 PSNR: 30.43 MAXDIFF: 84 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2_422 b/tests/ref/vsynth1/mpeg2_422 new file mode 100644 index 0000000000..beef80bdfd --- /dev/null +++ b/tests/ref/vsynth1/mpeg2_422 @@ -0,0 +1,4 @@ +af0cb75451aaa807beb5102707a98823 *./tests/data/vsynth1/mpeg2_422.mpg +728200 ./tests/data/vsynth1/mpeg2_422.mpg +29b518282493203e83b27a939795dc3a *./tests/data/mpeg2_422.vsynth1.out.yuv +stddev: 63.33 PSNR: 12.10 MAXDIFF: 242 bytes: 10137600/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2_idct_int b/tests/ref/vsynth1/mpeg2_idct_int new file mode 100644 index 0000000000..be73750373 --- /dev/null +++ b/tests/ref/vsynth1/mpeg2_idct_int @@ -0,0 +1,4 @@ +4c067397b504d65532d7779cd36f3f88 *./tests/data/vsynth1/mpeg2_idct_int.mpg +725668 ./tests/data/vsynth1/mpeg2_idct_int.mpg +9f7b065f98d57cdecf90e6f7a2524eb5 *./tests/data/mpeg2_idct_int.vsynth1.out.yuv +stddev: 7.65 PSNR: 30.45 MAXDIFF: 81 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2_ilace b/tests/ref/vsynth1/mpeg2_ilace new file mode 100644 index 0000000000..e05951fc64 --- /dev/null +++ b/tests/ref/vsynth1/mpeg2_ilace @@ -0,0 +1,4 @@ +ec3f6713c88a2b41f6c369fd64341077 *./tests/data/vsynth1/mpeg2i.mpg +737473 ./tests/data/vsynth1/mpeg2i.mpg +97615390fdd69abfcbc7e02df863a7d2 *./tests/data/mpeg2_ilace.vsynth1.out.yuv +stddev: 7.67 PSNR: 30.43 MAXDIFF: 84 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2_ivlc_qprd b/tests/ref/vsynth1/mpeg2_ivlc_qprd new file mode 100644 index 0000000000..c8a6694d82 --- /dev/null +++ b/tests/ref/vsynth1/mpeg2_ivlc_qprd @@ -0,0 +1,4 @@ +8f6b20714918e6443e0c03716ed06f0d *./tests/data/vsynth1/mpeg2ivlc-qprd.mpg +783552 ./tests/data/vsynth1/mpeg2ivlc-qprd.mpg +98eb9da15f880978e7f2ee1e7ce476ef *./tests/data/mpeg2_ivlc_qprd.vsynth1.out.yuv +stddev: 10.07 PSNR: 28.06 MAXDIFF: 165 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg2thread b/tests/ref/vsynth1/mpeg2thread index 470c2e91b2..b12997eaa7 100644 --- a/tests/ref/vsynth1/mpeg2thread +++ b/tests/ref/vsynth1/mpeg2thread @@ -1,12 +1,4 @@ ecd183706688bd977c9994c3d1b23d61 *./tests/data/vsynth1/mpeg2thread.mpg 801313 ./tests/data/vsynth1/mpeg2thread.mpg d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread.vsynth1.out.yuv -stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200 -23d600b026222253c2340e23300a4c02 *./tests/data/vsynth1/mpeg2threadivlc.mpg -791773 ./tests/data/vsynth1/mpeg2threadivlc.mpg -d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread.vsynth1.out.yuv -stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200 -d119fe917dd81d1ff758b4ce684a8d9d *./tests/data/vsynth1/mpeg2reuse.mpg -2074636 ./tests/data/vsynth1/mpeg2reuse.mpg -92ced6afe8c02304943c400cce51a5f4 *./tests/data/mpeg2thread.vsynth1.out.yuv -stddev: 7.66 PSNR: 30.44 MAXDIFF: 111 bytes: 7603200/ 7603200 +stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200
\ No newline at end of file diff --git a/tests/ref/vsynth1/mpeg2thread_ilace b/tests/ref/vsynth1/mpeg2thread_ilace new file mode 100644 index 0000000000..f9c3339585 --- /dev/null +++ b/tests/ref/vsynth1/mpeg2thread_ilace @@ -0,0 +1,8 @@ +23d600b026222253c2340e23300a4c02 *./tests/data/vsynth1/mpeg2threadivlc.mpg +791773 ./tests/data/vsynth1/mpeg2threadivlc.mpg +d1658911ca83f5616c1d32abc40750de *./tests/data/mpeg2thread_ilace.vsynth1.out.yuv +stddev: 7.63 PSNR: 30.48 MAXDIFF: 110 bytes: 7603200/ 7603200 +d119fe917dd81d1ff758b4ce684a8d9d *./tests/data/vsynth1/mpeg2reuse.mpg +2074636 ./tests/data/vsynth1/mpeg2reuse.mpg +92ced6afe8c02304943c400cce51a5f4 *./tests/data/mpeg2thread_ilace.vsynth1.out.yuv +stddev: 7.66 PSNR: 30.44 MAXDIFF: 111 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg4_adap b/tests/ref/vsynth1/mpeg4_adap new file mode 100644 index 0000000000..7513a22f08 --- /dev/null +++ b/tests/ref/vsynth1/mpeg4_adap @@ -0,0 +1,4 @@ +2d870c0da9ab2231ab5fc06981e70399 *./tests/data/vsynth1/mpeg4-adap.avi +403456 ./tests/data/vsynth1/mpeg4-adap.avi +fa2049396479b5f170aa764fed5b2a31 *./tests/data/mpeg4_adap.vsynth1.out.yuv +stddev: 14.05 PSNR: 25.17 MAXDIFF: 184 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg4_qpel b/tests/ref/vsynth1/mpeg4_qpel new file mode 100644 index 0000000000..51547d8038 --- /dev/null +++ b/tests/ref/vsynth1/mpeg4_qpel @@ -0,0 +1,4 @@ +3bf17c3d04f52988386ce106a2a58976 *./tests/data/vsynth1/mpeg4-Q.avi +860678 ./tests/data/vsynth1/mpeg4-Q.avi +756928496245ecc701f79eebeec8e5e6 *./tests/data/mpeg4_qpel.vsynth1.out.yuv +stddev: 5.63 PSNR: 33.12 MAXDIFF: 70 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg4_qprd b/tests/ref/vsynth1/mpeg4_qprd new file mode 100644 index 0000000000..aa3b506a76 --- /dev/null +++ b/tests/ref/vsynth1/mpeg4_qprd @@ -0,0 +1,4 @@ +d6b7e724a6ad66ab5e4c5a499218b40d *./tests/data/vsynth1/mpeg4-qprd.avi +710944 ./tests/data/vsynth1/mpeg4-qprd.avi +e65f4c7f343fe2bad1cac44b7da5f7c4 *./tests/data/mpeg4_qprd.vsynth1.out.yuv +stddev: 9.79 PSNR: 28.31 MAXDIFF: 176 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth1/mpeg4adv b/tests/ref/vsynth1/mpeg4adv index d61431028a..374f0b206e 100644 --- a/tests/ref/vsynth1/mpeg4adv +++ b/tests/ref/vsynth1/mpeg4adv @@ -2,15 +2,3 @@ 589716 ./tests/data/vsynth1/mpeg4-adv.avi f8b226876b1b2c0b98fd6928fd9adbd8 *./tests/data/mpeg4adv.vsynth1.out.yuv stddev: 6.98 PSNR: 31.25 MAXDIFF: 84 bytes: 7603200/ 7603200 -d6b7e724a6ad66ab5e4c5a499218b40d *./tests/data/vsynth1/mpeg4-qprd.avi -710944 ./tests/data/vsynth1/mpeg4-qprd.avi -e65f4c7f343fe2bad1cac44b7da5f7c4 *./tests/data/mpeg4adv.vsynth1.out.yuv -stddev: 9.79 PSNR: 28.31 MAXDIFF: 176 bytes: 7603200/ 7603200 -2d870c0da9ab2231ab5fc06981e70399 *./tests/data/vsynth1/mpeg4-adap.avi -403456 ./tests/data/vsynth1/mpeg4-adap.avi -fa2049396479b5f170aa764fed5b2a31 *./tests/data/mpeg4adv.vsynth1.out.yuv -stddev: 14.05 PSNR: 25.17 MAXDIFF: 184 bytes: 7603200/ 7603200 -3bf17c3d04f52988386ce106a2a58976 *./tests/data/vsynth1/mpeg4-Q.avi -860678 ./tests/data/vsynth1/mpeg4-Q.avi -756928496245ecc701f79eebeec8e5e6 *./tests/data/mpeg4adv.vsynth1.out.yuv -stddev: 5.63 PSNR: 33.12 MAXDIFF: 70 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/dv b/tests/ref/vsynth2/dv index b05dc4fffe..613312d837 100644 --- a/tests/ref/vsynth2/dv +++ b/tests/ref/vsynth2/dv @@ -1,8 +1,4 @@ 85b8d55b0b68bb3fc2e90babb580f9b7 *./tests/data/vsynth2/dv.dv 7200000 ./tests/data/vsynth2/dv.dv 7ec62bd3350a6848364669e6e1e4b9cc *./tests/data/dv.vsynth2.out.yuv -stddev: 1.71 PSNR: 43.47 MAXDIFF: 33 bytes: 7603200/ 7603200 -e428508f400327aeb96969c08fb9e1b5 *./tests/data/vsynth2/dv411.dv -7200000 ./tests/data/vsynth2/dv411.dv -7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv.vsynth2.out.yuv -stddev: 10.09 PSNR: 28.05 MAXDIFF: 60 bytes: 7603200/ 7603200 +stddev: 1.71 PSNR: 43.47 MAXDIFF: 33 bytes: 7603200/ 7603200
\ No newline at end of file diff --git a/tests/ref/vsynth2/dv_411 b/tests/ref/vsynth2/dv_411 new file mode 100644 index 0000000000..708ac889f6 --- /dev/null +++ b/tests/ref/vsynth2/dv_411 @@ -0,0 +1,4 @@ +e428508f400327aeb96969c08fb9e1b5 *./tests/data/vsynth2/dv411.dv +7200000 ./tests/data/vsynth2/dv411.dv +7f9fa421028aabb11eaf4c6513a5a843 *./tests/data/dv_411.vsynth2.out.yuv +stddev: 10.09 PSNR: 28.05 MAXDIFF: 60 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2 b/tests/ref/vsynth2/mpeg2 index a6ab3f6b90..5232eea988 100644 --- a/tests/ref/vsynth2/mpeg2 +++ b/tests/ref/vsynth2/mpeg2 @@ -2,19 +2,3 @@ 198667 ./tests/data/vsynth2/mpeg2.mpg b7cae8a1f751b821cddcbe4d5dbc518c *./tests/data/mpeg2.vsynth2.out.yuv stddev: 4.96 PSNR: 34.20 MAXDIFF: 59 bytes: 7603200/ 7603200 -1ba5efeb53fab7b4b71edc96d86f6c91 *./tests/data/vsynth2/mpeg2ivlc-qprd.mpg -244694 ./tests/data/vsynth2/mpeg2ivlc-qprd.mpg -b26e21599dee48a174bdbc40b2817e55 *./tests/data/mpeg2.vsynth2.out.yuv -stddev: 4.15 PSNR: 35.76 MAXDIFF: 74 bytes: 7603200/ 7603200 -2c8e33c2d2efab86fc16a195f6877682 *./tests/data/vsynth2/mpeg2_422.mpg -356124 ./tests/data/vsynth2/mpeg2_422.mpg -de44597c6c470f3e7019b31245a3ff69 *./tests/data/mpeg2.vsynth2.out.yuv -stddev: 54.55 PSNR: 13.39 MAXDIFF: 201 bytes: 10137600/ 7603200 -f979bcca866e6e4cad5dc6cb06e56cfb *./tests/data/vsynth2/mpeg2.mpg -198041 ./tests/data/vsynth2/mpeg2.mpg -f6d9bf24ff8676a7f6076c05cd2c81a3 *./tests/data/mpeg2.vsynth2.out.yuv -stddev: 4.97 PSNR: 34.19 MAXDIFF: 58 bytes: 7603200/ 7603200 -f90197a8b6e62ae25f82625337f27240 *./tests/data/vsynth2/mpeg2i.mpg -204579 ./tests/data/vsynth2/mpeg2i.mpg -ea5057b60146c06d40449cdfc686bf13 *./tests/data/mpeg2.vsynth2.out.yuv -stddev: 4.98 PSNR: 34.18 MAXDIFF: 65 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2_422 b/tests/ref/vsynth2/mpeg2_422 new file mode 100644 index 0000000000..c4e28dd0d4 --- /dev/null +++ b/tests/ref/vsynth2/mpeg2_422 @@ -0,0 +1,4 @@ +2c8e33c2d2efab86fc16a195f6877682 *./tests/data/vsynth2/mpeg2_422.mpg +356124 ./tests/data/vsynth2/mpeg2_422.mpg +de44597c6c470f3e7019b31245a3ff69 *./tests/data/mpeg2_422.vsynth2.out.yuv +stddev: 54.55 PSNR: 13.39 MAXDIFF: 201 bytes: 10137600/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2_idct_int b/tests/ref/vsynth2/mpeg2_idct_int new file mode 100644 index 0000000000..9900497868 --- /dev/null +++ b/tests/ref/vsynth2/mpeg2_idct_int @@ -0,0 +1,4 @@ +f979bcca866e6e4cad5dc6cb06e56cfb *./tests/data/vsynth2/mpeg2_idct_int.mpg +198041 ./tests/data/vsynth2/mpeg2_idct_int.mpg +f6d9bf24ff8676a7f6076c05cd2c81a3 *./tests/data/mpeg2_idct_int.vsynth2.out.yuv +stddev: 4.97 PSNR: 34.19 MAXDIFF: 58 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2_ilace b/tests/ref/vsynth2/mpeg2_ilace new file mode 100644 index 0000000000..99d80a4fef --- /dev/null +++ b/tests/ref/vsynth2/mpeg2_ilace @@ -0,0 +1,4 @@ +f90197a8b6e62ae25f82625337f27240 *./tests/data/vsynth2/mpeg2i.mpg +204579 ./tests/data/vsynth2/mpeg2i.mpg +ea5057b60146c06d40449cdfc686bf13 *./tests/data/mpeg2_ilace.vsynth2.out.yuv +stddev: 4.98 PSNR: 34.18 MAXDIFF: 65 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2_ivlc_qprd b/tests/ref/vsynth2/mpeg2_ivlc_qprd new file mode 100644 index 0000000000..d8aa1ab659 --- /dev/null +++ b/tests/ref/vsynth2/mpeg2_ivlc_qprd @@ -0,0 +1,4 @@ +1ba5efeb53fab7b4b71edc96d86f6c91 *./tests/data/vsynth2/mpeg2ivlc-qprd.mpg +244694 ./tests/data/vsynth2/mpeg2ivlc-qprd.mpg +b26e21599dee48a174bdbc40b2817e55 *./tests/data/mpeg2_ivlc_qprd.vsynth2.out.yuv +stddev: 4.15 PSNR: 35.76 MAXDIFF: 74 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg2thread b/tests/ref/vsynth2/mpeg2thread index 3c9c0d016d..75cfc7522f 100644 --- a/tests/ref/vsynth2/mpeg2thread +++ b/tests/ref/vsynth2/mpeg2thread @@ -1,12 +1,4 @@ 889c754a42d7689b228853e1ece6d345 *./tests/data/vsynth2/mpeg2thread.mpg 179650 ./tests/data/vsynth2/mpeg2thread.mpg 8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread.vsynth2.out.yuv -stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200 -10b900e32809758857c596d56746e00e *./tests/data/vsynth2/mpeg2threadivlc.mpg -178801 ./tests/data/vsynth2/mpeg2threadivlc.mpg -8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread.vsynth2.out.yuv -stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200 -864d6bf2982a61e510003a518be65a2d *./tests/data/vsynth2/mpeg2reuse.mpg -383419 ./tests/data/vsynth2/mpeg2reuse.mpg -bb20fa080cfd2b0a687ea7376ff4f902 *./tests/data/mpeg2thread.vsynth2.out.yuv -stddev: 4.73 PSNR: 34.63 MAXDIFF: 72 bytes: 7603200/ 7603200 +stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200
\ No newline at end of file diff --git a/tests/ref/vsynth2/mpeg2thread_ilace b/tests/ref/vsynth2/mpeg2thread_ilace new file mode 100644 index 0000000000..f074d44cc3 --- /dev/null +++ b/tests/ref/vsynth2/mpeg2thread_ilace @@ -0,0 +1,8 @@ +10b900e32809758857c596d56746e00e *./tests/data/vsynth2/mpeg2threadivlc.mpg +178801 ./tests/data/vsynth2/mpeg2threadivlc.mpg +8c6a7ed2eb73bd18fd2bb9829464100d *./tests/data/mpeg2thread_ilace.vsynth2.out.yuv +stddev: 4.72 PSNR: 34.65 MAXDIFF: 72 bytes: 7603200/ 7603200 +864d6bf2982a61e510003a518be65a2d *./tests/data/vsynth2/mpeg2reuse.mpg +383419 ./tests/data/vsynth2/mpeg2reuse.mpg +bb20fa080cfd2b0a687ea7376ff4f902 *./tests/data/mpeg2thread_ilace.vsynth2.out.yuv +stddev: 4.73 PSNR: 34.63 MAXDIFF: 72 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg4_adap b/tests/ref/vsynth2/mpeg4_adap new file mode 100644 index 0000000000..b7a07dea5d --- /dev/null +++ b/tests/ref/vsynth2/mpeg4_adap @@ -0,0 +1,4 @@ +547e1849dcf910935ff6383ca49e5706 *./tests/data/vsynth2/mpeg4-adap.avi +198510 ./tests/data/vsynth2/mpeg4-adap.avi +4affb83f6adc94f31024b4f9e0168945 *./tests/data/mpeg4_adap.vsynth2.out.yuv +stddev: 3.75 PSNR: 36.65 MAXDIFF: 71 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg4_qpel b/tests/ref/vsynth2/mpeg4_qpel new file mode 100644 index 0000000000..d1f45153ba --- /dev/null +++ b/tests/ref/vsynth2/mpeg4_qpel @@ -0,0 +1,4 @@ +7680d2e7d34399dfdfb8a49cf1e10239 *./tests/data/vsynth2/mpeg4-Q.avi +163688 ./tests/data/vsynth2/mpeg4-Q.avi +26dc7c78955fa678fbf150e236eb5627 *./tests/data/mpeg4_qpel.vsynth2.out.yuv +stddev: 3.97 PSNR: 36.14 MAXDIFF: 54 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg4_qprd b/tests/ref/vsynth2/mpeg4_qprd new file mode 100644 index 0000000000..17eec96eff --- /dev/null +++ b/tests/ref/vsynth2/mpeg4_qprd @@ -0,0 +1,4 @@ +fd5ab0f55dbc959316e32923e86290df *./tests/data/vsynth2/mpeg4-qprd.avi +231458 ./tests/data/vsynth2/mpeg4-qprd.avi +de8a883865e2dff7a51f66da6c48df48 *./tests/data/mpeg4_qprd.vsynth2.out.yuv +stddev: 3.71 PSNR: 36.72 MAXDIFF: 61 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth2/mpeg4adv b/tests/ref/vsynth2/mpeg4adv index f8568c7828..b47cbf19fe 100644 --- a/tests/ref/vsynth2/mpeg4adv +++ b/tests/ref/vsynth2/mpeg4adv @@ -2,15 +2,3 @@ dee7be19486a76d96c88d18eefba8f86 *./tests/data/vsynth2/mpeg4-adv.avi 141546 ./tests/data/vsynth2/mpeg4-adv.avi 3f3a21e9db85a9c0f7022f557a5374c1 *./tests/data/mpeg4adv.vsynth2.out.yuv stddev: 4.94 PSNR: 34.25 MAXDIFF: 69 bytes: 7603200/ 7603200 -fd5ab0f55dbc959316e32923e86290df *./tests/data/vsynth2/mpeg4-qprd.avi -231458 ./tests/data/vsynth2/mpeg4-qprd.avi -de8a883865e2dff7a51f66da6c48df48 *./tests/data/mpeg4adv.vsynth2.out.yuv -stddev: 3.71 PSNR: 36.72 MAXDIFF: 61 bytes: 7603200/ 7603200 -547e1849dcf910935ff6383ca49e5706 *./tests/data/vsynth2/mpeg4-adap.avi -198510 ./tests/data/vsynth2/mpeg4-adap.avi -4affb83f6adc94f31024b4f9e0168945 *./tests/data/mpeg4adv.vsynth2.out.yuv -stddev: 3.75 PSNR: 36.65 MAXDIFF: 71 bytes: 7603200/ 7603200 -7680d2e7d34399dfdfb8a49cf1e10239 *./tests/data/vsynth2/mpeg4-Q.avi -163688 ./tests/data/vsynth2/mpeg4-Q.avi -26dc7c78955fa678fbf150e236eb5627 *./tests/data/mpeg4adv.vsynth2.out.yuv -stddev: 3.97 PSNR: 36.14 MAXDIFF: 54 bytes: 7603200/ 7603200 |