diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/debian/changelog ffmpeg-2.2.1+git~trusty1.1/debian/changelog --- ffmpeg-2.2+gitca6dd53~trusty1/debian/changelog 2014-04-13 15:56:21.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/debian/changelog 2014-04-23 12:02:55.000000000 +0000 @@ -1,3 +1,15 @@ +ffmpeg (7:2.2.1+git~trusty1.1) trusty; urgency=medium + + * Add git head to RELEASE remove from package name + + -- Doug McMahon Wed, 23 Apr 2014 08:01:20 -0400 + +ffmpeg (7:2.2.1+git~trusty1) trusty; urgency=medium + + * git 1ba59b1 + + -- Doug McMahon Wed, 23 Apr 2014 06:31:30 -0400 + ffmpeg (7:2.2+gitca6dd53~trusty1) trusty; urgency=medium * Dep on ppa libx264 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/Changelog ffmpeg-2.2.1+git~trusty1.1/ffmpeg/Changelog --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/Changelog 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/Changelog 2014-04-23 09:55:21.000000000 +0000 @@ -17,6 +17,8 @@ - GDI screen grabbing for Windows - alternative rendition support for HTTP Live Streaming - AVFoundation input device +- Direct Stream Digital (DSD) decoder +- Magic Lantern Video (MLV) demuxer version 2.2: @@ -234,7 +236,7 @@ - JSON captions for TED talks decoding support - SOX Resampler support in libswresample - aselect filter -- SGI RLE 8-bit decoder +- SGI RLE 8-bit / Silicon Graphics RLE 8-bit video decoder - Silicon Graphics Motion Video Compressor 1 & 2 decoder - Silicon Graphics Movie demuxer - apad filter diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/configure ffmpeg-2.2.1+git~trusty1.1/ffmpeg/configure --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/configure 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/configure 2014-04-23 09:55:21.000000000 +0000 @@ -106,7 +106,6 @@ --disable-swscale-alpha disable alpha channel support in swscale --disable-all disable building components, libraries and programs --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no] - --enable-incompatible-fork-abi enable incompatible Libav fork ABI (deprecated) [no] --enable-raise-major increase major version numbers in sonames [no] Program options: @@ -1285,7 +1284,7 @@ EXAMPLE_LIST=" avio_reading_example - avcodec_example + decoding_encoding_example demuxing_decoding_example filter_audio_example filtering_audio_example @@ -1304,7 +1303,6 @@ bzlib crystalhd decklink - fontconfig frei0r gnutls iconv @@ -1319,6 +1317,7 @@ libfaac libfdk_aac libflite + libfontconfig libfreetype libgme libgsm @@ -1445,8 +1444,8 @@ $LIBRARY_LIST $PROGRAM_LIST $SUBSYSTEM_LIST + fontconfig incompatible_libav_abi - incompatible_fork_abi memalign_hack memory_poisoning neon_clobber_test @@ -1580,7 +1579,6 @@ bigendian fast_unaligned incompatible_libav_abi - incompatible_fork_abi " HEADERS_LIST=" @@ -1851,6 +1849,7 @@ cxx dep_cc extra_version + gas host_cc host_cflags host_ld @@ -2022,7 +2021,7 @@ ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" ffvhuff_encoder_select="huffyuv_encoder" -fic_decoder_select="dsputil golomb" +fic_decoder_select="golomb" flac_decoder_select="golomb" flac_encoder_select="dsputil golomb lpc" flashsv_decoder_select="zlib" @@ -2319,6 +2318,8 @@ flac_demuxer_select="flac_parser" hds_muxer_select="flv_muxer" hls_muxer_select="mpegts_muxer" +image2_alias_pix_demuxer_select="image2_demuxer" +image2_brender_pix_demuxer_select="image2_demuxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" libnut_demuxer_deps="libnut" @@ -2366,7 +2367,7 @@ # indevs / outdevs alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" alsa_outdev_deps="alsa_asoundlib_h" -avfoundation_indev_extralibs="-framework AVFoundation -framework CoreMedia" +avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia" avfoundation_indev_select="avfoundation" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" caca_outdev_deps="libcaca" @@ -3226,10 +3227,10 @@ _cflags_speed='-fast' _cflags_size='-O1' _flags_filter=ccc_flags - elif $_cc --vsn 2>/dev/null | grep -Eq "ARM C/C[+][+] Compiler|Component: ARM Compiler "; then + elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then test -d "$sysroot" || die "No valid sysroot specified." _type=armcc - _ident=$($_cc --vsn | head -n1) + _ident=$($_cc --vsn | head -n1 | sed 's/.*: //') armcc_conf="$PWD/armcc.conf" $_cc --arm_linux_configure \ --arm_linux_config_file="$armcc_conf" \ @@ -3853,7 +3854,7 @@ strip="strip -d" ;; darwin) - gas="gas-preprocessor.pl $cc" + test "${as#*gas-preprocessor.pl}" != "$as" || gas="${gas:=gas-preprocessor.pl} ${as:=$cc}" enabled ppc && add_asflags -force_cpusubtype_ALL SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)' enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress @@ -4137,10 +4138,6 @@ exit 1; fi -# backward compatibility layer for incompatible_libav/fork_abi -enabled incompatible_fork_abi && enable incompatible_libav_abi -enabled incompatible_libav_abi && enable incompatible_fork_abi - die_license_disabled() { enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } } @@ -4586,7 +4583,6 @@ { check_lib2 "dlfcn.h" dlopen -ldl; } || die "ERROR: LoadLibrary/dlopen not found for avisynth"; } enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } -enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; } enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; } @@ -4602,6 +4598,8 @@ enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs +enabled fontconfig && enable libfontconfig +enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit enabled libfreetype && require_libfreetype enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++ enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do @@ -4951,6 +4949,8 @@ add_cflags -Wno-missing-variable-declarations add_cflags -Wno-empty-statement elif enabled armcc; then + add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat + add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir # 2523: use of inline assembler is deprecated add_cflags -W${armcc_opt},--diag_suppress=2523 add_cflags -W${armcc_opt},--diag_suppress=1207 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/APIchanges ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/APIchanges --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/APIchanges 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/APIchanges 2014-04-23 09:55:21.000000000 +0000 @@ -15,6 +15,15 @@ API changes, most recent first: +2014-04-xx - xxxxxxx - lavu 53.13.0 / 52.78.100 - avutil.h + Add av_get_time_base_q(). + +2014-04-xx - xxxxxxx - lavu 53.12.0 / 52.77.100 - crc.h + Add AV_CRC_16_ANSI_LE crc variant. + +2014-04-XX - xxxxxxx - lavf xx.xx.1xx - avformat.h + Add av_format_inject_global_side_data() + 2014-04-12 - xxxxxxx - lavu 52.76.100 - log.h Add av_log_get_flags() diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/demuxers.texi ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/demuxers.texi --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/demuxers.texi 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/demuxers.texi 2014-04-23 09:55:21.000000000 +0000 @@ -266,7 +266,7 @@ that monotonity of timestamps is not provided: images go in the same order as without this option. Default value is 0. If set to 2, will set frame timestamp to the modification time of the image file in -nanosecond precission. +nanosecond precision. @item video_size Set the video size of the images to read. If not specified the video size is guessed from the first image file in the sequence. diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/avcodec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/avcodec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/avcodec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/avcodec.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,664 +0,0 @@ -/* - * Copyright (c) 2001 Fabrice Bellard - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -/** - * @file - * libavcodec API use example. - * - * @example avcodec.c - * Note that libavcodec only handles codecs (mpeg, mpeg4, etc...), - * not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the - * format handling - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -#define INBUF_SIZE 4096 -#define AUDIO_INBUF_SIZE 20480 -#define AUDIO_REFILL_THRESH 4096 - -/* check that a given sample format is supported by the encoder */ -static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) -{ - const enum AVSampleFormat *p = codec->sample_fmts; - - while (*p != AV_SAMPLE_FMT_NONE) { - if (*p == sample_fmt) - return 1; - p++; - } - return 0; -} - -/* just pick the highest supported samplerate */ -static int select_sample_rate(AVCodec *codec) -{ - const int *p; - int best_samplerate = 0; - - if (!codec->supported_samplerates) - return 44100; - - p = codec->supported_samplerates; - while (*p) { - best_samplerate = FFMAX(*p, best_samplerate); - p++; - } - return best_samplerate; -} - -/* select layout with the highest channel count */ -static int select_channel_layout(AVCodec *codec) -{ - const uint64_t *p; - uint64_t best_ch_layout = 0; - int best_nb_channels = 0; - - if (!codec->channel_layouts) - return AV_CH_LAYOUT_STEREO; - - p = codec->channel_layouts; - while (*p) { - int nb_channels = av_get_channel_layout_nb_channels(*p); - - if (nb_channels > best_nb_channels) { - best_ch_layout = *p; - best_nb_channels = nb_channels; - } - p++; - } - return best_ch_layout; -} - -/* - * Audio encoding example - */ -static void audio_encode_example(const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - AVFrame *frame; - AVPacket pkt; - int i, j, k, ret, got_output; - int buffer_size; - FILE *f; - uint16_t *samples; - float t, tincr; - - printf("Encode audio file %s\n", filename); - - /* find the MP2 encoder */ - codec = avcodec_find_encoder(AV_CODEC_ID_MP2); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate audio codec context\n"); - exit(1); - } - - /* put sample parameters */ - c->bit_rate = 64000; - - /* check that the encoder supports s16 pcm input */ - c->sample_fmt = AV_SAMPLE_FMT_S16; - if (!check_sample_fmt(codec, c->sample_fmt)) { - fprintf(stderr, "Encoder does not support sample format %s", - av_get_sample_fmt_name(c->sample_fmt)); - exit(1); - } - - /* select other audio parameters supported by the encoder */ - c->sample_rate = select_sample_rate(codec); - c->channel_layout = select_channel_layout(codec); - c->channels = av_get_channel_layout_nb_channels(c->channel_layout); - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "wb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - /* frame containing input raw audio */ - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate audio frame\n"); - exit(1); - } - - frame->nb_samples = c->frame_size; - frame->format = c->sample_fmt; - frame->channel_layout = c->channel_layout; - - /* the codec gives us the frame size, in samples, - * we calculate the size of the samples buffer in bytes */ - buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, - c->sample_fmt, 0); - if (buffer_size < 0) { - fprintf(stderr, "Could not get sample buffer size\n"); - exit(1); - } - samples = av_malloc(buffer_size); - if (!samples) { - fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", - buffer_size); - exit(1); - } - /* setup the data pointers in the AVFrame */ - ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, - (const uint8_t*)samples, buffer_size, 0); - if (ret < 0) { - fprintf(stderr, "Could not setup audio frame\n"); - exit(1); - } - - /* encode a single tone sound */ - t = 0; - tincr = 2 * M_PI * 440.0 / c->sample_rate; - for (i = 0; i < 200; i++) { - av_init_packet(&pkt); - pkt.data = NULL; // packet data will be allocated by the encoder - pkt.size = 0; - - for (j = 0; j < c->frame_size; j++) { - samples[2*j] = (int)(sin(t) * 10000); - - for (k = 1; k < c->channels; k++) - samples[2*j + k] = samples[2*j]; - t += tincr; - } - /* encode the samples */ - ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding audio frame\n"); - exit(1); - } - if (got_output) { - fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); - } - } - - /* get the delayed frames */ - for (got_output = 1; got_output; i++) { - ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); - } - } - fclose(f); - - av_freep(&samples); - av_frame_free(&frame); - avcodec_close(c); - av_free(c); -} - -/* - * Audio decoding. - */ -static void audio_decode_example(const char *outfilename, const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int len; - FILE *f, *outfile; - uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; - AVPacket avpkt; - AVFrame *decoded_frame = NULL; - - av_init_packet(&avpkt); - - printf("Decode audio file %s to %s\n", filename, outfilename); - - /* find the mpeg audio decoder */ - codec = avcodec_find_decoder(AV_CODEC_ID_MP2); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate audio codec context\n"); - exit(1); - } - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "rb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - outfile = fopen(outfilename, "wb"); - if (!outfile) { - av_free(c); - exit(1); - } - - /* decode until eof */ - avpkt.data = inbuf; - avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); - - while (avpkt.size > 0) { - int got_frame = 0; - - if (!decoded_frame) { - if (!(decoded_frame = av_frame_alloc())) { - fprintf(stderr, "Could not allocate audio frame\n"); - exit(1); - } - } - - len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); - if (len < 0) { - fprintf(stderr, "Error while decoding\n"); - exit(1); - } - if (got_frame) { - /* if a frame has been decoded, output it */ - int data_size = av_samples_get_buffer_size(NULL, c->channels, - decoded_frame->nb_samples, - c->sample_fmt, 1); - if (data_size < 0) { - /* This should not occur, checking just for paranoia */ - fprintf(stderr, "Failed to calculate data size\n"); - exit(1); - } - fwrite(decoded_frame->data[0], 1, data_size, outfile); - } - avpkt.size -= len; - avpkt.data += len; - avpkt.dts = - avpkt.pts = AV_NOPTS_VALUE; - if (avpkt.size < AUDIO_REFILL_THRESH) { - /* Refill the input buffer, to avoid trying to decode - * incomplete frames. Instead of this, one could also use - * a parser, or use a proper container format through - * libavformat. */ - memmove(inbuf, avpkt.data, avpkt.size); - avpkt.data = inbuf; - len = fread(avpkt.data + avpkt.size, 1, - AUDIO_INBUF_SIZE - avpkt.size, f); - if (len > 0) - avpkt.size += len; - } - } - - fclose(outfile); - fclose(f); - - avcodec_close(c); - av_free(c); - av_frame_free(&decoded_frame); -} - -/* - * Video encoding example - */ -static void video_encode_example(const char *filename, int codec_id) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int i, ret, x, y, got_output; - FILE *f; - AVFrame *frame; - AVPacket pkt; - uint8_t endcode[] = { 0, 0, 1, 0xb7 }; - - printf("Encode video file %s\n", filename); - - /* find the mpeg1 video encoder */ - codec = avcodec_find_encoder(codec_id); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate video codec context\n"); - exit(1); - } - - /* put sample parameters */ - c->bit_rate = 400000; - /* resolution must be a multiple of two */ - c->width = 352; - c->height = 288; - /* frames per second */ - c->time_base = (AVRational){1,25}; - /* emit one intra frame every ten frames - * check frame pict_type before passing frame - * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I - * then gop_size is ignored and the output of encoder - * will always be I frame irrespective to gop_size - */ - c->gop_size = 10; - c->max_b_frames = 1; - c->pix_fmt = AV_PIX_FMT_YUV420P; - - if (codec_id == AV_CODEC_ID_H264) - av_opt_set(c->priv_data, "preset", "slow", 0); - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "wb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate video frame\n"); - exit(1); - } - frame->format = c->pix_fmt; - frame->width = c->width; - frame->height = c->height; - - /* the image can be allocated by any means and av_image_alloc() is - * just the most convenient way if av_malloc() is to be used */ - ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, - c->pix_fmt, 32); - if (ret < 0) { - fprintf(stderr, "Could not allocate raw picture buffer\n"); - exit(1); - } - - /* encode 1 second of video */ - for (i = 0; i < 25; i++) { - av_init_packet(&pkt); - pkt.data = NULL; // packet data will be allocated by the encoder - pkt.size = 0; - - fflush(stdout); - /* prepare a dummy image */ - /* Y */ - for (y = 0; y < c->height; y++) { - for (x = 0; x < c->width; x++) { - frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; - } - } - - /* Cb and Cr */ - for (y = 0; y < c->height/2; y++) { - for (x = 0; x < c->width/2; x++) { - frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; - frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; - } - } - - frame->pts = i; - - /* encode the image */ - ret = avcodec_encode_video2(c, &pkt, frame, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - printf("Write frame %3d (size=%5d)\n", i, pkt.size); - fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); - } - } - - /* get the delayed frames */ - for (got_output = 1; got_output; i++) { - fflush(stdout); - - ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); - if (ret < 0) { - fprintf(stderr, "Error encoding frame\n"); - exit(1); - } - - if (got_output) { - printf("Write frame %3d (size=%5d)\n", i, pkt.size); - fwrite(pkt.data, 1, pkt.size, f); - av_free_packet(&pkt); - } - } - - /* add sequence end code to have a real mpeg file */ - fwrite(endcode, 1, sizeof(endcode), f); - fclose(f); - - avcodec_close(c); - av_free(c); - av_freep(&frame->data[0]); - av_frame_free(&frame); - printf("\n"); -} - -/* - * Video decoding example - */ - -static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, - char *filename) -{ - FILE *f; - int i; - - f = fopen(filename,"w"); - fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255); - for (i = 0; i < ysize; i++) - fwrite(buf + i * wrap, 1, xsize, f); - fclose(f); -} - -static int decode_write_frame(const char *outfilename, AVCodecContext *avctx, - AVFrame *frame, int *frame_count, AVPacket *pkt, int last) -{ - int len, got_frame; - char buf[1024]; - - len = avcodec_decode_video2(avctx, frame, &got_frame, pkt); - if (len < 0) { - fprintf(stderr, "Error while decoding frame %d\n", *frame_count); - return len; - } - if (got_frame) { - printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count); - fflush(stdout); - - /* the picture is allocated by the decoder, no need to free it */ - snprintf(buf, sizeof(buf), outfilename, *frame_count); - pgm_save(frame->data[0], frame->linesize[0], - avctx->width, avctx->height, buf); - (*frame_count)++; - } - if (pkt->data) { - pkt->size -= len; - pkt->data += len; - } - return 0; -} - -static void video_decode_example(const char *outfilename, const char *filename) -{ - AVCodec *codec; - AVCodecContext *c= NULL; - int frame_count; - FILE *f; - AVFrame *frame; - uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; - AVPacket avpkt; - - av_init_packet(&avpkt); - - /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ - memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - printf("Decode video file %s to %s\n", filename, outfilename); - - /* find the mpeg1 video decoder */ - codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); - if (!codec) { - fprintf(stderr, "Codec not found\n"); - exit(1); - } - - c = avcodec_alloc_context3(codec); - if (!c) { - fprintf(stderr, "Could not allocate video codec context\n"); - exit(1); - } - - if(codec->capabilities&CODEC_CAP_TRUNCATED) - c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */ - - /* For some codecs, such as msmpeg4 and mpeg4, width and height - MUST be initialized there because this information is not - available in the bitstream. */ - - /* open it */ - if (avcodec_open2(c, codec, NULL) < 0) { - fprintf(stderr, "Could not open codec\n"); - exit(1); - } - - f = fopen(filename, "rb"); - if (!f) { - fprintf(stderr, "Could not open %s\n", filename); - exit(1); - } - - frame = av_frame_alloc(); - if (!frame) { - fprintf(stderr, "Could not allocate video frame\n"); - exit(1); - } - - frame_count = 0; - for (;;) { - avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); - if (avpkt.size == 0) - break; - - /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) - and this is the only method to use them because you cannot - know the compressed data size before analysing it. - - BUT some other codecs (msmpeg4, mpeg4) are inherently frame - based, so you must call them with all the data for one - frame exactly. You must also initialize 'width' and - 'height' before initializing them. */ - - /* NOTE2: some codecs allow the raw parameters (frame size, - sample rate) to be changed at any frame. We handle this, so - you should also take care of it */ - - /* here, we use a stream based decoder (mpeg1video), so we - feed decoder and see if it could decode a frame */ - avpkt.data = inbuf; - while (avpkt.size > 0) - if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0) - exit(1); - } - - /* some codecs, such as MPEG, transmit the I and P frame with a - latency of one frame. You must do the following to have a - chance to get the last frame of the video */ - avpkt.data = NULL; - avpkt.size = 0; - decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1); - - fclose(f); - - avcodec_close(c); - av_free(c); - av_frame_free(&frame); - printf("\n"); -} - -int main(int argc, char **argv) -{ - const char *output_type; - - /* register all the codecs */ - avcodec_register_all(); - - if (argc < 2) { - printf("usage: %s output_type\n" - "API example program to decode/encode a media stream with libavcodec.\n" - "This program generates a synthetic stream and encodes it to a file\n" - "named test.h264, test.mp2 or test.mpg depending on output_type.\n" - "The encoded stream is then decoded and written to a raw data output.\n" - "output_type must be choosen between 'h264', 'mp2', 'mpg'.\n", - argv[0]); - return 1; - } - output_type = argv[1]; - - if (!strcmp(output_type, "h264")) { - video_encode_example("test.h264", AV_CODEC_ID_H264); - } else if (!strcmp(output_type, "mp2")) { - audio_encode_example("test.mp2"); - audio_decode_example("test.sw", "test.mp2"); - } else if (!strcmp(output_type, "mpg")) { - video_encode_example("test.mpg", AV_CODEC_ID_MPEG1VIDEO); - video_decode_example("test%02d.pgm", "test.mpg"); - } else { - fprintf(stderr, "Invalid output type '%s', choose between 'h264', 'mp2', or 'mpg'\n", - output_type); - return 1; - } - - return 0; -} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/decoding_encoding.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/decoding_encoding.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/decoding_encoding.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/decoding_encoding.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,664 @@ +/* + * Copyright (c) 2001 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/** + * @file + * libavcodec API use example. + * + * @example decoding_encoding.c + * Note that libavcodec only handles codecs (mpeg, mpeg4, etc...), + * not file formats (avi, vob, mp4, mov, mkv, mxf, flv, mpegts, mpegps, etc...). See library 'libavformat' for the + * format handling + */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#define INBUF_SIZE 4096 +#define AUDIO_INBUF_SIZE 20480 +#define AUDIO_REFILL_THRESH 4096 + +/* check that a given sample format is supported by the encoder */ +static int check_sample_fmt(AVCodec *codec, enum AVSampleFormat sample_fmt) +{ + const enum AVSampleFormat *p = codec->sample_fmts; + + while (*p != AV_SAMPLE_FMT_NONE) { + if (*p == sample_fmt) + return 1; + p++; + } + return 0; +} + +/* just pick the highest supported samplerate */ +static int select_sample_rate(AVCodec *codec) +{ + const int *p; + int best_samplerate = 0; + + if (!codec->supported_samplerates) + return 44100; + + p = codec->supported_samplerates; + while (*p) { + best_samplerate = FFMAX(*p, best_samplerate); + p++; + } + return best_samplerate; +} + +/* select layout with the highest channel count */ +static int select_channel_layout(AVCodec *codec) +{ + const uint64_t *p; + uint64_t best_ch_layout = 0; + int best_nb_channels = 0; + + if (!codec->channel_layouts) + return AV_CH_LAYOUT_STEREO; + + p = codec->channel_layouts; + while (*p) { + int nb_channels = av_get_channel_layout_nb_channels(*p); + + if (nb_channels > best_nb_channels) { + best_ch_layout = *p; + best_nb_channels = nb_channels; + } + p++; + } + return best_ch_layout; +} + +/* + * Audio encoding example + */ +static void audio_encode_example(const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + AVFrame *frame; + AVPacket pkt; + int i, j, k, ret, got_output; + int buffer_size; + FILE *f; + uint16_t *samples; + float t, tincr; + + printf("Encode audio file %s\n", filename); + + /* find the MP2 encoder */ + codec = avcodec_find_encoder(AV_CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate audio codec context\n"); + exit(1); + } + + /* put sample parameters */ + c->bit_rate = 64000; + + /* check that the encoder supports s16 pcm input */ + c->sample_fmt = AV_SAMPLE_FMT_S16; + if (!check_sample_fmt(codec, c->sample_fmt)) { + fprintf(stderr, "Encoder does not support sample format %s", + av_get_sample_fmt_name(c->sample_fmt)); + exit(1); + } + + /* select other audio parameters supported by the encoder */ + c->sample_rate = select_sample_rate(codec); + c->channel_layout = select_channel_layout(codec); + c->channels = av_get_channel_layout_nb_channels(c->channel_layout); + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + /* frame containing input raw audio */ + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate audio frame\n"); + exit(1); + } + + frame->nb_samples = c->frame_size; + frame->format = c->sample_fmt; + frame->channel_layout = c->channel_layout; + + /* the codec gives us the frame size, in samples, + * we calculate the size of the samples buffer in bytes */ + buffer_size = av_samples_get_buffer_size(NULL, c->channels, c->frame_size, + c->sample_fmt, 0); + if (buffer_size < 0) { + fprintf(stderr, "Could not get sample buffer size\n"); + exit(1); + } + samples = av_malloc(buffer_size); + if (!samples) { + fprintf(stderr, "Could not allocate %d bytes for samples buffer\n", + buffer_size); + exit(1); + } + /* setup the data pointers in the AVFrame */ + ret = avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt, + (const uint8_t*)samples, buffer_size, 0); + if (ret < 0) { + fprintf(stderr, "Could not setup audio frame\n"); + exit(1); + } + + /* encode a single tone sound */ + t = 0; + tincr = 2 * M_PI * 440.0 / c->sample_rate; + for (i = 0; i < 200; i++) { + av_init_packet(&pkt); + pkt.data = NULL; // packet data will be allocated by the encoder + pkt.size = 0; + + for (j = 0; j < c->frame_size; j++) { + samples[2*j] = (int)(sin(t) * 10000); + + for (k = 1; k < c->channels; k++) + samples[2*j + k] = samples[2*j]; + t += tincr; + } + /* encode the samples */ + ret = avcodec_encode_audio2(c, &pkt, frame, &got_output); + if (ret < 0) { + fprintf(stderr, "Error encoding audio frame\n"); + exit(1); + } + if (got_output) { + fwrite(pkt.data, 1, pkt.size, f); + av_free_packet(&pkt); + } + } + + /* get the delayed frames */ + for (got_output = 1; got_output; i++) { + ret = avcodec_encode_audio2(c, &pkt, NULL, &got_output); + if (ret < 0) { + fprintf(stderr, "Error encoding frame\n"); + exit(1); + } + + if (got_output) { + fwrite(pkt.data, 1, pkt.size, f); + av_free_packet(&pkt); + } + } + fclose(f); + + av_freep(&samples); + av_frame_free(&frame); + avcodec_close(c); + av_free(c); +} + +/* + * Audio decoding. + */ +static void audio_decode_example(const char *outfilename, const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int len; + FILE *f, *outfile; + uint8_t inbuf[AUDIO_INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + AVPacket avpkt; + AVFrame *decoded_frame = NULL; + + av_init_packet(&avpkt); + + printf("Decode audio file %s to %s\n", filename, outfilename); + + /* find the mpeg audio decoder */ + codec = avcodec_find_decoder(AV_CODEC_ID_MP2); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate audio codec context\n"); + exit(1); + } + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + outfile = fopen(outfilename, "wb"); + if (!outfile) { + av_free(c); + exit(1); + } + + /* decode until eof */ + avpkt.data = inbuf; + avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f); + + while (avpkt.size > 0) { + int got_frame = 0; + + if (!decoded_frame) { + if (!(decoded_frame = av_frame_alloc())) { + fprintf(stderr, "Could not allocate audio frame\n"); + exit(1); + } + } + + len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &avpkt); + if (len < 0) { + fprintf(stderr, "Error while decoding\n"); + exit(1); + } + if (got_frame) { + /* if a frame has been decoded, output it */ + int data_size = av_samples_get_buffer_size(NULL, c->channels, + decoded_frame->nb_samples, + c->sample_fmt, 1); + if (data_size < 0) { + /* This should not occur, checking just for paranoia */ + fprintf(stderr, "Failed to calculate data size\n"); + exit(1); + } + fwrite(decoded_frame->data[0], 1, data_size, outfile); + } + avpkt.size -= len; + avpkt.data += len; + avpkt.dts = + avpkt.pts = AV_NOPTS_VALUE; + if (avpkt.size < AUDIO_REFILL_THRESH) { + /* Refill the input buffer, to avoid trying to decode + * incomplete frames. Instead of this, one could also use + * a parser, or use a proper container format through + * libavformat. */ + memmove(inbuf, avpkt.data, avpkt.size); + avpkt.data = inbuf; + len = fread(avpkt.data + avpkt.size, 1, + AUDIO_INBUF_SIZE - avpkt.size, f); + if (len > 0) + avpkt.size += len; + } + } + + fclose(outfile); + fclose(f); + + avcodec_close(c); + av_free(c); + av_frame_free(&decoded_frame); +} + +/* + * Video encoding example + */ +static void video_encode_example(const char *filename, int codec_id) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int i, ret, x, y, got_output; + FILE *f; + AVFrame *frame; + AVPacket pkt; + uint8_t endcode[] = { 0, 0, 1, 0xb7 }; + + printf("Encode video file %s\n", filename); + + /* find the mpeg1 video encoder */ + codec = avcodec_find_encoder(codec_id); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate video codec context\n"); + exit(1); + } + + /* put sample parameters */ + c->bit_rate = 400000; + /* resolution must be a multiple of two */ + c->width = 352; + c->height = 288; + /* frames per second */ + c->time_base = (AVRational){1,25}; + /* emit one intra frame every ten frames + * check frame pict_type before passing frame + * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I + * then gop_size is ignored and the output of encoder + * will always be I frame irrespective to gop_size + */ + c->gop_size = 10; + c->max_b_frames = 1; + c->pix_fmt = AV_PIX_FMT_YUV420P; + + if (codec_id == AV_CODEC_ID_H264) + av_opt_set(c->priv_data, "preset", "slow", 0); + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "wb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate video frame\n"); + exit(1); + } + frame->format = c->pix_fmt; + frame->width = c->width; + frame->height = c->height; + + /* the image can be allocated by any means and av_image_alloc() is + * just the most convenient way if av_malloc() is to be used */ + ret = av_image_alloc(frame->data, frame->linesize, c->width, c->height, + c->pix_fmt, 32); + if (ret < 0) { + fprintf(stderr, "Could not allocate raw picture buffer\n"); + exit(1); + } + + /* encode 1 second of video */ + for (i = 0; i < 25; i++) { + av_init_packet(&pkt); + pkt.data = NULL; // packet data will be allocated by the encoder + pkt.size = 0; + + fflush(stdout); + /* prepare a dummy image */ + /* Y */ + for (y = 0; y < c->height; y++) { + for (x = 0; x < c->width; x++) { + frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3; + } + } + + /* Cb and Cr */ + for (y = 0; y < c->height/2; y++) { + for (x = 0; x < c->width/2; x++) { + frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2; + frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5; + } + } + + frame->pts = i; + + /* encode the image */ + ret = avcodec_encode_video2(c, &pkt, frame, &got_output); + if (ret < 0) { + fprintf(stderr, "Error encoding frame\n"); + exit(1); + } + + if (got_output) { + printf("Write frame %3d (size=%5d)\n", i, pkt.size); + fwrite(pkt.data, 1, pkt.size, f); + av_free_packet(&pkt); + } + } + + /* get the delayed frames */ + for (got_output = 1; got_output; i++) { + fflush(stdout); + + ret = avcodec_encode_video2(c, &pkt, NULL, &got_output); + if (ret < 0) { + fprintf(stderr, "Error encoding frame\n"); + exit(1); + } + + if (got_output) { + printf("Write frame %3d (size=%5d)\n", i, pkt.size); + fwrite(pkt.data, 1, pkt.size, f); + av_free_packet(&pkt); + } + } + + /* add sequence end code to have a real mpeg file */ + fwrite(endcode, 1, sizeof(endcode), f); + fclose(f); + + avcodec_close(c); + av_free(c); + av_freep(&frame->data[0]); + av_frame_free(&frame); + printf("\n"); +} + +/* + * Video decoding example + */ + +static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, + char *filename) +{ + FILE *f; + int i; + + f = fopen(filename,"w"); + fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255); + for (i = 0; i < ysize; i++) + fwrite(buf + i * wrap, 1, xsize, f); + fclose(f); +} + +static int decode_write_frame(const char *outfilename, AVCodecContext *avctx, + AVFrame *frame, int *frame_count, AVPacket *pkt, int last) +{ + int len, got_frame; + char buf[1024]; + + len = avcodec_decode_video2(avctx, frame, &got_frame, pkt); + if (len < 0) { + fprintf(stderr, "Error while decoding frame %d\n", *frame_count); + return len; + } + if (got_frame) { + printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count); + fflush(stdout); + + /* the picture is allocated by the decoder, no need to free it */ + snprintf(buf, sizeof(buf), outfilename, *frame_count); + pgm_save(frame->data[0], frame->linesize[0], + avctx->width, avctx->height, buf); + (*frame_count)++; + } + if (pkt->data) { + pkt->size -= len; + pkt->data += len; + } + return 0; +} + +static void video_decode_example(const char *outfilename, const char *filename) +{ + AVCodec *codec; + AVCodecContext *c= NULL; + int frame_count; + FILE *f; + AVFrame *frame; + uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; + AVPacket avpkt; + + av_init_packet(&avpkt); + + /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ + memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); + + printf("Decode video file %s to %s\n", filename, outfilename); + + /* find the mpeg1 video decoder */ + codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); + if (!codec) { + fprintf(stderr, "Codec not found\n"); + exit(1); + } + + c = avcodec_alloc_context3(codec); + if (!c) { + fprintf(stderr, "Could not allocate video codec context\n"); + exit(1); + } + + if(codec->capabilities&CODEC_CAP_TRUNCATED) + c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */ + + /* For some codecs, such as msmpeg4 and mpeg4, width and height + MUST be initialized there because this information is not + available in the bitstream. */ + + /* open it */ + if (avcodec_open2(c, codec, NULL) < 0) { + fprintf(stderr, "Could not open codec\n"); + exit(1); + } + + f = fopen(filename, "rb"); + if (!f) { + fprintf(stderr, "Could not open %s\n", filename); + exit(1); + } + + frame = av_frame_alloc(); + if (!frame) { + fprintf(stderr, "Could not allocate video frame\n"); + exit(1); + } + + frame_count = 0; + for (;;) { + avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); + if (avpkt.size == 0) + break; + + /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio) + and this is the only method to use them because you cannot + know the compressed data size before analysing it. + + BUT some other codecs (msmpeg4, mpeg4) are inherently frame + based, so you must call them with all the data for one + frame exactly. You must also initialize 'width' and + 'height' before initializing them. */ + + /* NOTE2: some codecs allow the raw parameters (frame size, + sample rate) to be changed at any frame. We handle this, so + you should also take care of it */ + + /* here, we use a stream based decoder (mpeg1video), so we + feed decoder and see if it could decode a frame */ + avpkt.data = inbuf; + while (avpkt.size > 0) + if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0) + exit(1); + } + + /* some codecs, such as MPEG, transmit the I and P frame with a + latency of one frame. You must do the following to have a + chance to get the last frame of the video */ + avpkt.data = NULL; + avpkt.size = 0; + decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1); + + fclose(f); + + avcodec_close(c); + av_free(c); + av_frame_free(&frame); + printf("\n"); +} + +int main(int argc, char **argv) +{ + const char *output_type; + + /* register all the codecs */ + avcodec_register_all(); + + if (argc < 2) { + printf("usage: %s output_type\n" + "API example program to decode/encode a media stream with libavcodec.\n" + "This program generates a synthetic stream and encodes it to a file\n" + "named test.h264, test.mp2 or test.mpg depending on output_type.\n" + "The encoded stream is then decoded and written to a raw data output.\n" + "output_type must be choosen between 'h264', 'mp2', 'mpg'.\n", + argv[0]); + return 1; + } + output_type = argv[1]; + + if (!strcmp(output_type, "h264")) { + video_encode_example("test.h264", AV_CODEC_ID_H264); + } else if (!strcmp(output_type, "mp2")) { + audio_encode_example("test.mp2"); + audio_decode_example("test.sw", "test.mp2"); + } else if (!strcmp(output_type, "mpg")) { + video_encode_example("test.mpg", AV_CODEC_ID_MPEG1VIDEO); + video_decode_example("test%02d.pgm", "test.mpg"); + } else { + fprintf(stderr, "Invalid output type '%s', choose between 'h264', 'mp2', or 'mpg'\n", + output_type); + return 1; + } + + return 0; +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/Makefile ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/Makefile --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/examples/Makefile 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/examples/Makefile 2014-04-23 09:55:21.000000000 +0000 @@ -12,7 +12,7 @@ LDLIBS := $(shell pkg-config --libs $(FFMPEG_LIBS)) $(LDLIBS) EXAMPLES= avio_reading \ - avcodec \ + decoding_encoding \ demuxing_decoding \ filtering_video \ filtering_audio \ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/filters.texi ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/filters.texi --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/filters.texi 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/filters.texi 2014-04-23 09:55:21.000000000 +0000 @@ -3580,6 +3580,8 @@ To enable compilation of this filter, you need to configure FFmpeg with @code{--enable-libfreetype}. +To enable default font fallback and the @var{font} option you need to +configure FFmpeg with @code{--enable-libfontconfig}. @subsection Syntax @@ -3623,9 +3625,12 @@ The default value of @var{fontcolor} is "black". +@item font +The font family to be used for drawing text. By default Sans. + @item fontfile The font file to be used for drawing text. The path must be included. -This parameter is mandatory. +This parameter is mandatory if the fontconfig support is disabled. @item fontsize The font size to be used for drawing text. @@ -3786,9 +3791,6 @@ each other, so you can for example specify @code{y=x/dar}. @end table -If libavfilter was built with @code{--enable-fontconfig}, then -@option{fontfile} can be a fontconfig pattern or omitted. - @anchor{drawtext_expansion} @subsection Text expansion diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/general.texi ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/general.texi --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/general.texi 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/general.texi 2014-04-23 09:55:21.000000000 +0000 @@ -259,6 +259,7 @@ @item Deluxe Paint Animation @tab @tab X @item DFA @tab @tab X @tab This format is used in Chronomaster game +@item DSD Stream File (DSF) @tab @tab X @item DV video @tab X @tab X @item DXA @tab @tab X @tab This format is used in the non-Windows version of the Feeble Files @@ -312,6 +313,7 @@ @item LVF @tab @tab X @item LXF @tab @tab X @tab VR native stream format, used by Leitch/Harris' video servers. +@item Magic Lantern Video (MLV) @tab @tab X @item Matroska @tab X @tab X @item Matroska audio @tab X @tab @item FFmpeg metadata @tab X @tab X @@ -750,11 +752,11 @@ @tab Texture dictionaries used by the Renderware Engine. @item RL2 video @tab @tab X @tab used in some games by Entertainment Software Partners -@item SGI RLE 8-bit @tab @tab X @item Sierra VMD video @tab @tab X @tab Used in Sierra VMD files. @item Silicon Graphics Motion Video Compressor 1 (MVC1) @tab @tab X @item Silicon Graphics Motion Video Compressor 2 (MVC2) @tab @tab X +@item Silicon Graphics RLE 8-bit video @tab @tab X @item Smacker video @tab @tab X @tab Video encoding used in Smacker. @item SMPTE VC-1 @tab @tab X @@ -898,6 +900,10 @@ @item DPCM Sol @tab @tab X @item DPCM Xan @tab @tab X @tab Used in Origin's Wing Commander IV AVI files. +@item DSD (Direct Stream Digitial), least significant bit first @tab @tab X +@item DSD (Direct Stream Digitial), most significant bit first @tab @tab X +@item DSD (Direct Stream Digitial), least significant bit first, planar @tab @tab X +@item DSD (Direct Stream Digitial), most significant bit first, planar @tab @tab X @item DSP Group TrueSpeech @tab @tab X @item DV audio @tab @tab X @item Enhanced AC-3 @tab X @tab X diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/outdevs.texi ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/outdevs.texi --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/doc/outdevs.texi 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/doc/outdevs.texi 2014-04-23 09:55:21.000000000 +0000 @@ -388,19 +388,26 @@ Check the X11 specification for more detailed information about the display name format. +@item window_id +When set to non-zero value then device doesn't create new window, +but uses existing one with provided @var{window_id}. By default +this options is set to zero and device creates its own window. + @item window_size Set the created window size, can be a string of the form @var{width}x@var{height} or a video size abbreviation. If not specified it defaults to the size of the input video. +Ignored when @var{window_id} is set. @item window_x @item window_y Set the X and Y window offsets for the created window. They are both set to 0 by default. The values may be ignored by the window manager. +Ignored when @var{window_id} is set. @item window_title Set the window title, if not specified default to the filename -specified for the output device. +specified for the output device. Ignored when @var{window_id} is set. @end table For more information about XVideo see @url{http://www.x.org/}. diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffmpeg.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffmpeg.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffmpeg.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffmpeg.c 2014-04-23 09:55:21.000000000 +0000 @@ -1791,16 +1791,15 @@ decoded_frame_tb = avctx->time_base; } else if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) { decoded_frame->pts = decoded_frame->pkt_pts; - pkt->pts = AV_NOPTS_VALUE; decoded_frame_tb = ist->st->time_base; } else if (pkt->pts != AV_NOPTS_VALUE) { decoded_frame->pts = pkt->pts; - pkt->pts = AV_NOPTS_VALUE; decoded_frame_tb = ist->st->time_base; }else { decoded_frame->pts = ist->dts; decoded_frame_tb = AV_TIME_BASE_Q; } + pkt->pts = AV_NOPTS_VALUE; if (decoded_frame->pts != AV_NOPTS_VALUE) decoded_frame->pts = av_rescale_delta(decoded_frame_tb, decoded_frame->pts, (AVRational){1, ist->st->codec->sample_rate}, decoded_frame->nb_samples, &ist->filter_in_rescale_delta_last, @@ -3323,6 +3322,8 @@ /* add the stream-global side data to the first packet */ if (ist->nb_packets == 1) + if (ist->st->nb_side_data) + av_packet_split_side_data(&pkt); for (i = 0; i < ist->st->nb_side_data; i++) { AVPacketSideData *src_sd = &ist->st->side_data[i]; uint8_t *dst_data; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffplay.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffplay.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffplay.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffplay.c 2014-04-23 09:55:21.000000000 +0000 @@ -2752,6 +2752,8 @@ if (genpts) ic->flags |= AVFMT_FLAG_GENPTS; + av_format_inject_global_side_data(ic); + opts = setup_find_stream_info_opts(ic, codec_opts); orig_nb_streams = ic->nb_streams; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffprobe.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffprobe.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/ffprobe.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/ffprobe.c 2014-04-23 09:55:21.000000000 +0000 @@ -246,6 +246,7 @@ vald /= pow(10, index * 3); prefix_string = decimal_unit_prefixes[index]; } + vali = vald; } if (show_float || (use_value_prefix && vald != (long long int)vald)) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/fft_init_aarch64.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/fft_init_aarch64.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/fft_init_aarch64.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/fft_init_aarch64.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" + +#include "libavutil/aarch64/cpu.h" +#include "libavcodec/fft.h" + +void ff_fft_permute_neon(FFTContext *s, FFTComplex *z); +void ff_fft_calc_neon(FFTContext *s, FFTComplex *z); + +void ff_imdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_imdct_half_neon(FFTContext *s, FFTSample *output, const FFTSample *input); +void ff_mdct_calc_neon(FFTContext *s, FFTSample *output, const FFTSample *input); + +av_cold void ff_fft_init_aarch64(FFTContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->fft_permute = ff_fft_permute_neon; + s->fft_calc = ff_fft_calc_neon; +#if CONFIG_MDCT + s->imdct_calc = ff_imdct_calc_neon; + s->imdct_half = ff_imdct_half_neon; + s->mdct_calc = ff_mdct_calc_neon; + s->mdct_permutation = FF_MDCT_PERM_INTERLEAVE; +#endif + } +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/fft_neon.S ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/fft_neon.S --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/fft_neon.S 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/fft_neon.S 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,442 @@ +/* + * ARM NEON optimised FFT + * + * Copyright (c) 2009 Mans Rullgard + * Copyright (c) 2009 Naotoshi Nojiri + * Copyright (c) 2014 Janne Grunau + * + * This algorithm (though not any of the implementation details) is + * based on libdjbfft by D. J. Bernstein. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +#define M_SQRT1_2 0.70710678118654752440 + +.macro transpose d0, d1, s0, s1 + trn1 \d0, \s0, \s1 + trn2 \d1, \s0, \s1 +.endm + + +function fft4_neon + ld1 {v0.2s,v1.2s,v2.2s,v3.2s}, [x0] + + fadd v4.2s, v0.2s, v1.2s // r0+r1,i0+i1 + fsub v6.2s, v0.2s, v1.2s // r0-r1,i0-i1 + + ext v16.8b, v2.8b, v3.8b, #4 + ext v17.8b, v3.8b, v2.8b, #4 + + fadd v5.2s, v2.2s, v3.2s // i2+i3,r2+r3 + fsub v7.2s, v16.2s, v17.2s // r3-r2,i2-i3 + + fadd v0.2s, v4.2s, v5.2s + fsub v2.2s, v4.2s, v5.2s + fadd v1.2s, v6.2s, v7.2s + fsub v3.2s, v6.2s, v7.2s + + st1 {v0.2s,v1.2s,v2.2s,v3.2s}, [x0] + + ret +endfunc + +function fft8_neon + mov x1, x0 + ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32 + ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0] + ext v22.8b, v2.8b, v3.8b, #4 + ext v23.8b, v3.8b, v2.8b, #4 + fadd v4.2s, v16.2s, v17.2s // r4+r5,i4+i5 + fadd v5.2s, v18.2s, v19.2s // r6+r7,i6+i7 + fsub v17.2s, v16.2s, v17.2s // r4-r5,i4-i5 + fsub v19.2s, v18.2s, v19.2s // r6-r7,i6-i7 + rev64 v27.2s, v28.2s // ??? + fadd v20.2s, v0.2s, v1.2s // r0+r1,i0+i1 + fadd v21.2s, v2.2s, v3.2s // r2+r3,i2+i3 + fmul v26.2s, v17.2s, v28.2s // -a2r*w,a2i*w + ext v6.8b, v4.8b, v5.8b, #4 + ext v7.8b, v5.8b, v4.8b, #4 + fmul v27.2s, v19.2s, v27.2s // a3r*w,-a3i*w + fsub v23.2s, v22.2s, v23.2s // i2-i3,r3-r2 + fsub v22.2s, v0.2s, v1.2s // r0-r1,i0-i1 + fmul v24.2s, v17.2s, v28.s[1] // a2r*w,a2i*w + fmul v25.2s, v19.2s, v28.s[1] // a3r*w,a3i*w + fadd v0.2s, v20.2s, v21.2s + fsub v2.2s, v20.2s, v21.2s + fadd v1.2s, v22.2s, v23.2s + rev64 v26.2s, v26.2s + rev64 v27.2s, v27.2s + fsub v3.2s, v22.2s, v23.2s + fsub v6.2s, v6.2s, v7.2s + fadd v24.2s, v24.2s, v26.2s // a2r+a2i,a2i-a2r t1,t2 + fadd v25.2s, v25.2s, v27.2s // a3r-a3i,a3i+a3r t5,t6 + fadd v7.2s, v4.2s, v5.2s + fsub v18.2s, v2.2s, v6.2s + ext v26.8b, v24.8b, v25.8b, #4 + ext v27.8b, v25.8b, v24.8b, #4 + fadd v2.2s, v2.2s, v6.2s + fsub v16.2s, v0.2s, v7.2s + fadd v5.2s, v25.2s, v24.2s + fsub v4.2s, v26.2s, v27.2s + fadd v0.2s, v0.2s, v7.2s + fsub v17.2s, v1.2s, v5.2s + fsub v19.2s, v3.2s, v4.2s + fadd v3.2s, v3.2s, v4.2s + fadd v1.2s, v1.2s, v5.2s + + st1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0] + st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x1] + + ret +endfunc + +function fft16_neon + mov x1, x0 + ld1 {v0.2s, v1.2s, v2.2s, v3.2s}, [x0], #32 + ld1 {v16.2s,v17.2s,v18.2s,v19.2s}, [x0], #32 + ext v22.8b, v2.8b, v3.8b, #4 + ext v23.8b, v3.8b, v2.8b, #4 + fadd v4.2s, v16.2s, v17.2s // r4+r5,i4+i5 + fadd v5.2s, v18.2s, v19.2s // r6+r7,i6+i7 + fsub v17.2s, v16.2s, v17.2s // r4-r5,i4-i5 + fsub v19.2s, v18.2s, v19.2s // r6-r7,i6-i7 + rev64 v27.2s, v28.2s // ??? + fadd v20.2s, v0.2s, v1.2s // r0+r1,i0+i1 + fadd v21.2s, v2.2s, v3.2s // r2+r3,i2+i3 + fmul v26.2s, v17.2s, v28.2s // -a2r*w,a2i*w + ext v6.8b, v4.8b, v5.8b, #4 + ext v7.8b, v5.8b, v4.8b, #4 + fmul v27.2s, v19.2s, v27.2s // a3r*w,-a3i*w + fsub v23.2s, v22.2s, v23.2s // i2-i3,r3-r2 + fsub v22.2s, v0.2s, v1.2s // r0-r1,i0-i1 + fmul v24.2s, v17.2s, v28.s[1] // a2r*w,a2i*w + fmul v25.2s, v19.2s, v28.s[1] // a3r*w,a3i*w + fadd v0.2s, v20.2s, v21.2s + fsub v2.2s, v20.2s, v21.2s + fadd v1.2s, v22.2s, v23.2s + rev64 v26.2s, v26.2s + rev64 v27.2s, v27.2s + fsub v3.2s, v22.2s, v23.2s + fsub v6.2s, v6.2s, v7.2s + fadd v24.2s, v24.2s, v26.2s // a2r+a2i,a2i-a2r t1,t2 + fadd v25.2s, v25.2s, v27.2s // a3r-a3i,a3i+a3r t5,t6 + fadd v7.2s, v4.2s, v5.2s + fsub v18.2s, v2.2s, v6.2s + ld1 {v20.4s,v21.4s}, [x0], #32 + ld1 {v22.4s,v23.4s}, [x0], #32 + ext v26.8b, v24.8b, v25.8b, #4 + ext v27.8b, v25.8b, v24.8b, #4 + fadd v2.2s, v2.2s, v6.2s + fsub v16.2s, v0.2s, v7.2s + fadd v5.2s, v25.2s, v24.2s + fsub v4.2s, v26.2s, v27.2s + transpose v24.2d, v25.2d, v20.2d, v22.2d + transpose v26.2d, v27.2d, v21.2d, v23.2d + fadd v0.2s, v0.2s, v7.2s + fsub v17.2s, v1.2s, v5.2s + fsub v19.2s, v3.2s, v4.2s + fadd v3.2s, v3.2s, v4.2s + fadd v1.2s, v1.2s, v5.2s + ext v20.16b, v21.16b, v21.16b, #4 + ext v21.16b, v23.16b, v23.16b, #4 + + zip1 v0.2d, v0.2d, v1.2d // {z[0], z[1]} + zip1 v1.2d, v2.2d, v3.2d // {z[2], z[3]} + zip1 v2.2d, v16.2d, v17.2d // {z[o1], z[o1+1]} + zip1 v3.2d, v18.2d, v19.2d // {z[o1+2],z[o1+3]} + + // 2 x fft4 + transpose v22.2d, v23.2d, v20.2d, v21.2d + + fadd v4.4s, v24.4s, v25.4s + fadd v5.4s, v26.4s, v27.4s + fsub v6.4s, v24.4s, v25.4s + fsub v7.4s, v22.4s, v23.4s + + ld1 {v23.4s}, [x14] + + fadd v24.4s, v4.4s, v5.4s // {z[o2+0],z[o2+1]} + fsub v26.4s, v4.4s, v5.4s // {z[o2+2],z[o2+3]} + fadd v25.4s, v6.4s, v7.4s // {z[o3+0],z[o3+1]} + fsub v27.4s, v6.4s, v7.4s // {z[o3+2],z[o3+3]} + + //fft_pass_neon_16 + rev64 v7.4s, v25.4s + fmul v25.4s, v25.4s, v23.s[1] + fmul v7.4s, v7.4s, v29.4s + fmla v25.4s, v7.4s, v23.s[3] // {t1a,t2a,t5a,t6a} + + zip1 v20.4s, v24.4s, v25.4s + zip2 v21.4s, v24.4s, v25.4s + fneg v22.4s, v20.4s + fadd v4.4s, v21.4s, v20.4s + fsub v6.4s, v20.4s, v21.4s // just the second half + fadd v5.4s, v21.4s, v22.4s // just the first half + + tbl v4.16b, {v4.16b}, v30.16b // trans4_float + tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float + + fsub v20.4s, v0.4s, v4.4s // {z[o2],z[o2+1]} + fadd v16.4s, v0.4s, v4.4s // {z[0], z[1]} + fsub v22.4s, v2.4s, v5.4s // {z[o3],z[o3+1]} + fadd v18.4s, v2.4s, v5.4s // {z[o1],z[o1+1]} + +//second half + rev64 v6.4s, v26.4s + fmul v26.4s, v26.4s, v23.s[2] + rev64 v7.4s, v27.4s + fmul v27.4s, v27.4s, v23.s[3] + fmul v6.4s, v6.4s, v29.4s + fmul v7.4s, v7.4s, v29.4s + fmla v26.4s, v6.4s, v23.s[2] // {t1,t2,t5,t6} + fmla v27.4s, v7.4s, v23.s[1] // {t1a,t2a,t5a,t6a} + + zip1 v24.4s, v26.4s, v27.4s + zip2 v25.4s, v26.4s, v27.4s + fneg v26.4s, v24.4s + fadd v4.4s, v25.4s, v24.4s + fsub v6.4s, v24.4s, v25.4s // just the second half + fadd v5.4s, v25.4s, v26.4s // just the first half + + tbl v4.16b, {v4.16b}, v30.16b // trans4_float + tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float + + fadd v17.4s, v1.4s, v4.4s // {z[2], z[3]} + fsub v21.4s, v1.4s, v4.4s // {z[o2+2],z[o2+3]} + fadd v19.4s, v3.4s, v5.4s // {z[o1+2],z[o1+3]} + fsub v23.4s, v3.4s, v5.4s // {z[o3+2],z[o3+3]} + + st1 {v16.4s,v17.4s}, [x1], #32 + st1 {v18.4s,v19.4s}, [x1], #32 + st1 {v20.4s,v21.4s}, [x1], #32 + st1 {v22.4s,v23.4s}, [x1], #32 + + ret +endfunc + + +const trans4_float, align=4 + .byte 0, 1, 2, 3 + .byte 8, 9, 10, 11 + .byte 4, 5, 6, 7 + .byte 12, 13, 14, 15 +endconst + +const trans8_float, align=4 + .byte 24, 25, 26, 27 + .byte 0, 1, 2, 3 + .byte 28, 29, 30, 31 + .byte 4, 5, 6, 7 +endconst + +function fft_pass_neon + sub x6, x2, #1 // n - 1, loop counter + lsl x5, x2, #3 // 2 * n * sizeof FFTSample + lsl x1, x2, #4 // 2 * n * sizeof FFTComplex + add x5, x4, x5 // wim + add x3, x1, x2, lsl #5 // 4 * n * sizeof FFTComplex + add x2, x0, x2, lsl #5 // &z[o2] + add x3, x0, x3 // &z[o3] + add x1, x0, x1 // &z[o1] + ld1 {v20.4s},[x2] // {z[o2],z[o2+1]} + ld1 {v22.4s},[x3] // {z[o3],z[o3+1]} + ld1 {v4.2s}, [x4], #8 // {wre[0],wre[1]} + trn2 v25.2d, v20.2d, v22.2d + sub x5, x5, #4 // wim-- + trn1 v24.2d, v20.2d, v22.2d + ld1 {v5.s}[0], [x5], x7 // d5[0] = wim[-1] + rev64 v7.4s, v25.4s + fmul v25.4s, v25.4s, v4.s[1] + ld1 {v16.4s}, [x0] // {z[0],z[1]} + fmul v7.4s, v7.4s, v29.4s + ld1 {v17.4s}, [x1] // {z[o1],z[o1+1]} + prfm pldl1keep, [x2, #16] + prfm pldl1keep, [x3, #16] + fmla v25.4s, v7.4s, v5.s[0] // {t1a,t2a,t5a,t6a} + prfm pldl1keep, [x0, #16] + prfm pldl1keep, [x1, #16] + + zip1 v20.4s, v24.4s, v25.4s + zip2 v21.4s, v24.4s, v25.4s + fneg v22.4s, v20.4s + fadd v4.4s, v21.4s, v20.4s + fsub v6.4s, v20.4s, v21.4s // just the second half + fadd v5.4s, v21.4s, v22.4s // just the first half + + tbl v4.16b, {v4.16b}, v30.16b // trans4_float + tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float + + fadd v20.4s, v16.4s, v4.4s + fsub v22.4s, v16.4s, v4.4s + fadd v21.4s, v17.4s, v5.4s + st1 {v20.4s}, [x0], #16 // {z[0], z[1]} + fsub v23.4s, v17.4s, v5.4s + + st1 {v21.4s}, [x1], #16 // {z[o1],z[o1+1]} + st1 {v22.4s}, [x2], #16 // {z[o2],z[o2+1]} + st1 {v23.4s}, [x3], #16 // {z[o3],z[o3+1]} +1: + ld1 {v20.4s},[x2] // {z[o2],z[o2+1]} + ld1 {v22.4s},[x3] // {z[o3],z[o3+1]} + ld1 {v4.2s}, [x4], #8 // {wre[0],wre[1]} + transpose v26.2d, v27.2d, v20.2d, v22.2d + ld1 {v5.2s}, [x5], x7 // {wim[-1],wim[0]} + rev64 v6.4s, v26.4s + fmul v26.4s, v26.4s, v4.s[0] + rev64 v7.4s, v27.4s + fmul v27.4s, v27.4s, v4.s[1] + fmul v6.4s, v6.4s, v29.4s + fmul v7.4s, v7.4s, v29.4s + ld1 {v16.4s},[x0] // {z[0],z[1]} + fmla v26.4s, v6.4s, v5.s[1] // {t1,t2,t5,t6} + fmla v27.4s, v7.4s, v5.s[0] // {t1a,t2a,t5a,t6a} + ld1 {v17.4s},[x1] // {z[o1],z[o1+1]} + + subs x6, x6, #1 // n-- + + zip1 v20.4s, v26.4s, v27.4s + zip2 v21.4s, v26.4s, v27.4s + fneg v22.4s, v20.4s + fadd v4.4s, v21.4s, v20.4s + fsub v6.4s, v20.4s, v21.4s // just the second half + fadd v5.4s, v21.4s, v22.4s // just the first half + + tbl v4.16b, {v4.16b}, v30.16b // trans4_float + tbl v5.16b, {v5.16b,v6.16b}, v31.16b // trans8_float + + fadd v20.4s, v16.4s, v4.4s + fsub v22.4s, v16.4s, v4.4s + fadd v21.4s, v17.4s, v5.4s + st1 {v20.4s}, [x0], #16 // {z[0], z[1]} + fsub v23.4s, v17.4s, v5.4s + + st1 {v21.4s}, [x1], #16 // {z[o1],z[o1+1]} + st1 {v22.4s}, [x2], #16 // {z[o2],z[o2+1]} + st1 {v23.4s}, [x3], #16 // {z[o3],z[o3+1]} + b.ne 1b + + ret +endfunc + +.macro def_fft n, n2, n4 +function fft\n\()_neon align=6 + sub sp, sp, #16 + stp x28, x30, [sp] + add x28, x0, #\n4*2*8 + bl fft\n2\()_neon + mov x0, x28 + bl fft\n4\()_neon + add x0, x28, #\n4*1*8 + bl fft\n4\()_neon + sub x0, x28, #\n4*2*8 + ldp x28, x30, [sp], #16 + movrel x4, X(ff_cos_\n) + mov x2, #\n4/2 + b fft_pass_neon +endfunc +.endm + + def_fft 32, 16, 8 + def_fft 64, 32, 16 + def_fft 128, 64, 32 + def_fft 256, 128, 64 + def_fft 512, 256, 128 + def_fft 1024, 512, 256 + def_fft 2048, 1024, 512 + def_fft 4096, 2048, 1024 + def_fft 8192, 4096, 2048 + def_fft 16384, 8192, 4096 + def_fft 32768, 16384, 8192 + def_fft 65536, 32768, 16384 + +function ff_fft_calc_neon, export=1 + prfm pldl1keep, [x1] + movrel x10, trans4_float + ldr w2, [x0] + movrel x11, trans8_float + sub w2, w2, #2 + movrel x3, fft_tab_neon + ld1 {v30.16b}, [x10] + mov x7, #-8 + movrel x12, pmmp + ldr x3, [x3, x2, lsl #3] + movrel x13, mppm + movrel x14, X(ff_cos_16) + ld1 {v31.16b}, [x11] + mov x0, x1 + ld1 {v29.4s}, [x12] // pmmp + ld1 {v28.4s}, [x13] + br x3 +endfunc + +function ff_fft_permute_neon, export=1 + mov x6, #1 + ldr w2, [x0] // nbits + ldr x3, [x0, #16] // tmp_buf + ldr x0, [x0, #8] // revtab + lsl x6, x6, x2 + mov x2, x6 +1: + ld1 {v0.2s,v1.2s}, [x1], #16 + ldr w4, [x0], #4 + uxth w5, w4 + lsr w4, w4, #16 + add x5, x3, x5, lsl #3 + add x4, x3, x4, lsl #3 + st1 {v0.2s}, [x5] + st1 {v1.2s}, [x4] + subs x6, x6, #2 + b.gt 1b + + sub x1, x1, x2, lsl #3 +1: + ld1 {v0.4s,v1.4s}, [x3], #32 + st1 {v0.4s,v1.4s}, [x1], #32 + subs x2, x2, #4 + b.gt 1b + + ret +endfunc + +const fft_tab_neon + .quad fft4_neon + .quad fft8_neon + .quad fft16_neon + .quad fft32_neon + .quad fft64_neon + .quad fft128_neon + .quad fft256_neon + .quad fft512_neon + .quad fft1024_neon + .quad fft2048_neon + .quad fft4096_neon + .quad fft8192_neon + .quad fft16384_neon + .quad fft32768_neon + .quad fft65536_neon +endconst + +const pmmp, align=4 + .float +1.0, -1.0, -1.0, +1.0 +endconst + +const mppm, align=4 + .float -M_SQRT1_2, M_SQRT1_2, M_SQRT1_2, -M_SQRT1_2 +endconst diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/Makefile ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/Makefile --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/Makefile 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/Makefile 2014-04-23 09:55:21.000000000 +0000 @@ -1,18 +1,26 @@ +OBJS-$(CONFIG_FFT) += aarch64/fft_init_aarch64.o OBJS-$(CONFIG_H264CHROMA) += aarch64/h264chroma_init_aarch64.o OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_init_aarch64.o OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_init_aarch64.o OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_init_aarch64.o +OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_init.o OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp_init.o OBJS-$(CONFIG_RV40_DECODER) += aarch64/rv40dsp_init_aarch64.o OBJS-$(CONFIG_VC1_DECODER) += aarch64/vc1dsp_init_aarch64.o +OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_init.o ARMV8-OBJS-$(CONFIG_VIDEODSP) += aarch64/videodsp.o +NEON-OBJS-$(CONFIG_FFT) += aarch64/fft_neon.o NEON-OBJS-$(CONFIG_H264CHROMA) += aarch64/h264cmc_neon.o NEON-OBJS-$(CONFIG_H264DSP) += aarch64/h264dsp_neon.o \ aarch64/h264idct_neon.o NEON-OBJS-$(CONFIG_H264QPEL) += aarch64/h264qpel_neon.o \ aarch64/hpeldsp_neon.o NEON-OBJS-$(CONFIG_HPELDSP) += aarch64/hpeldsp_neon.o +NEON-OBJS-$(CONFIG_MPEGAUDIODSP) += aarch64/mpegaudiodsp_neon.o +NEON-OBJS-$(CONFIG_MDCT) += aarch64/mdct_neon.o + +NEON-OBJS-$(CONFIG_VORBIS_DECODER) += aarch64/vorbisdsp_neon.o diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mdct_neon.S ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mdct_neon.S --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mdct_neon.S 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mdct_neon.S 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,323 @@ +/* + * AArch64 NEON optimised MDCT + * Copyright (c) 2009 Mans Rullgard + * Copyright (c) 2014 Janne Grunau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +function ff_imdct_half_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] + str x30, [sp, #16] + mov x12, #1 + ldr w14, [x0, #28] // mdct_bits + ldr x4, [x0, #32] // tcos + ldr x3, [x0, #8] // revtab + lsl x12, x12, x14 // n = 1 << nbits + lsr x14, x12, #2 // n4 = n >> 2 + add x7, x2, x12, lsl #1 + mov x12, #-16 + sub x7, x7, #16 + + ld2 {v16.2s,v17.2s}, [x7], x12 // d16=x,n1 d17=x,n0 + ld2 {v0.2s,v1.2s}, [x2], #16 // d0 =m0,x d1 =m1,x + rev64 v17.2s, v17.2s + ld2 {v2.2s,v3.2s}, [x4], #16 // d2=c0,c1 d3=s0,s2 + fmul v6.2s, v17.2s, v2.2s + fmul v7.2s, v0.2s, v2.2s +1: + subs x14, x14, #2 + ldr w6, [x3], #4 + fmul v4.2s, v0.2s, v3.2s + fmul v5.2s, v17.2s, v3.2s + fsub v4.2s, v6.2s, v4.2s + fadd v5.2s, v5.2s, v7.2s + ubfm x8, x6, #16, #31 + ubfm x6, x6, #0, #15 + add x8, x1, x8, lsl #3 + add x6, x1, x6, lsl #3 + b.eq 2f + ld2 {v16.2s,v17.2s}, [x7], x12 + ld2 {v0.2s,v1.2s}, [x2], #16 + rev64 v17.2s, v17.2s + ld2 {v2.2s,v3.2s}, [x4], #16 // d2=c0,c1 d3=s0,s2 + fmul v6.2s, v17.2s, v2.2s + fmul v7.2s, v0.2s, v2.2s + st2 {v4.s,v5.s}[0], [x6] + st2 {v4.s,v5.s}[1], [x8] + b 1b +2: + st2 {v4.s,v5.s}[0], [x6] + st2 {v4.s,v5.s}[1], [x8] + + mov x19, x0 + mov x20, x1 + bl X(ff_fft_calc_neon) + + mov x12, #1 + ldr w14, [x19, #28] // mdct_bits + ldr x4, [x19, #32] // tcos + lsl x12, x12, x14 // n = 1 << nbits + lsr x14, x12, #3 // n8 = n >> 3 + + add x4, x4, x14, lsl #3 + add x6, x20, x14, lsl #3 + sub x1, x4, #16 + sub x3, x6, #16 + + mov x7, #-16 + mov x8, x6 + mov x0, x3 + + ld2 {v0.2s,v1.2s}, [x3], x7 // d0 =i1,r1 d1 =i0,r0 + ld2 {v20.2s,v21.2s},[x6], #16 // d20=i2,r2 d21=i3,r3 + ld2 {v16.2s,v17.2s},[x1], x7 // d16=c1,c0 d18=s1,s0 +3: + subs x14, x14, #2 + fmul v7.2s, v0.2s, v17.2s + ld2 {v18.2s,v19.2s},[x4], #16 // d17=c2,c3 d19=s2,s3 + fmul v4.2s, v1.2s, v17.2s + fmul v6.2s, v21.2s, v19.2s + fmul v5.2s, v20.2s, v19.2s + fmul v22.2s, v1.2s, v16.2s + fmul v23.2s, v21.2s, v18.2s + fmul v24.2s, v0.2s, v16.2s + fmul v25.2s, v20.2s, v18.2s + fadd v7.2s, v7.2s, v22.2s + fadd v5.2s, v5.2s, v23.2s + fsub v4.2s, v4.2s, v24.2s + fsub v6.2s, v6.2s, v25.2s + b.eq 4f + ld2 {v0.2s,v1.2s}, [x3], x7 + ld2 {v20.2s,v21.2s},[x6], #16 + ld2 {v16.2s,v17.2s},[x1], x7 // d16=c1,c0 d18=s1,s0 + rev64 v5.2s, v5.2s + rev64 v7.2s, v7.2s + st2 {v4.2s,v5.2s}, [x0], x7 + st2 {v6.2s,v7.2s}, [x8], #16 + b 3b +4: + rev64 v5.2s, v5.2s + rev64 v7.2s, v7.2s + st2 {v4.2s,v5.2s}, [x0] + st2 {v6.2s,v7.2s}, [x8] + + ldp x19, x20, [sp] + ldr x30, [sp, #16] + add sp, sp, #32 + + ret +endfunc + +function ff_imdct_calc_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] + str x30, [sp, #16] + ldr w3, [x0, #28] // mdct_bits + mov x19, #1 + mov x20, x1 + lsl x19, x19, x3 + add x1, x1, x19 + + bl X(ff_imdct_half_neon) + + add x0, x20, x19, lsl #2 + add x1, x20, x19, lsl #1 + sub x0, x0, #8 + sub x2, x1, #16 + mov x3, #-16 + mov x6, #-8 +1: + ld1 {v0.4s}, [x2], x3 + prfum pldl1keep, [x0, #-16] + rev64 v0.4s, v0.4s + ld1 {v2.2s,v3.2s}, [x1], #16 + fneg v4.4s, v0.4s + prfum pldl1keep, [x2, #-16] + rev64 v2.2s, v2.2s + rev64 v3.2s, v3.2s + ext v4.16b, v4.16b, v4.16b, #8 + st1 {v2.2s}, [x0], x6 + st1 {v3.2s}, [x0], x6 + st1 {v4.4s}, [x20], #16 + subs x19, x19, #16 + b.gt 1b + + ldp x19, x20, [sp], #16 + ldr x30, [sp], #16 + + ret +endfunc + + +function ff_mdct_calc_neon, export=1 + sub sp, sp, #32 + stp x19, x20, [sp] + str x30, [sp, #16] + + mov x12, #1 + ldr w14, [x0, #28] // mdct_bits + ldr x4, [x0, #32] // tcos + ldr x3, [x0, #8] // revtab + lsl x14, x12, x14 // n = 1 << nbits + add x7, x2, x14 // in4u + sub x9, x7, #16 // in4d + add x2, x7, x14, lsl #1 // in3u + add x8, x9, x14, lsl #1 // in3d + add x5, x4, x14, lsl #1 + sub x5, x5, #16 + sub x3, x3, #4 + mov x12, #-16 + lsr x13, x14, #1 + + ld2 {v16.2s,v17.2s}, [x9], x12 // in0u0,in0u1 in4d1,in4d0 + ld2 {v18.2s,v19.2s}, [x8], x12 // in2u0,in2u1 in3d1,in3d0 + ld2 {v0.2s, v1.2s}, [x7], #16 // in4u0,in4u1 in2d1,in2d0 + rev64 v17.2s, v17.2s // in4d0,in4d1 in3d0,in3d1 + rev64 v19.2s, v19.2s // in4d0,in4d1 in3d0,in3d1 + ld2 {v2.2s, v3.2s}, [x2], #16 // in3u0,in3u1 in1d1,in1d0 + fsub v0.2s, v17.2s, v0.2s // in4d-in4u I + ld2 {v20.2s,v21.2s}, [x4], #16 // c0,c1 s0,s1 + rev64 v1.2s, v1.2s // in2d0,in2d1 in1d0,in1d1 + rev64 v3.2s, v3.2s // in2d0,in2d1 in1d0,in1d1 + ld2 {v30.2s,v31.2s}, [x5], x12 // c2,c3 s2,s3 + fadd v2.2s, v2.2s, v19.2s // in3u+in3d -R + fsub v16.2s, v16.2s, v1.2s // in0u-in2d R + fadd v18.2s, v18.2s, v3.2s // in2u+in1d -I +1: + fmul v7.2s, v0.2s, v21.2s // I*s + ldr w10, [x3, x13] + fmul v6.2s, v2.2s, v20.2s // -R*c + ldr w6, [x3, #4]! + fmul v4.2s, v2.2s, v21.2s // -R*s + fmul v5.2s, v0.2s, v20.2s // I*c + fmul v24.2s, v16.2s, v30.2s // R*c + fmul v25.2s, v18.2s, v31.2s // -I*s + fmul v22.2s, v16.2s, v31.2s // R*s + fmul v23.2s, v18.2s, v30.2s // I*c + subs x14, x14, #16 + subs x13, x13, #8 + fsub v6.2s, v6.2s, v7.2s // -R*c-I*s + fadd v7.2s, v4.2s, v5.2s // -R*s+I*c + fsub v24.2s, v25.2s, v24.2s // I*s-R*c + fadd v25.2s, v22.2s, v23.2s // R*s-I*c + b.eq 1f + mov x12, #-16 + ld2 {v16.2s,v17.2s}, [x9], x12 // in0u0,in0u1 in4d1,in4d0 + ld2 {v18.2s,v19.2s}, [x8], x12 // in2u0,in2u1 in3d1,in3d0 + fneg v7.2s, v7.2s // R*s-I*c + ld2 {v0.2s, v1.2s}, [x7], #16 // in4u0,in4u1 in2d1,in2d0 + rev64 v17.2s, v17.2s // in4d0,in4d1 in3d0,in3d1 + rev64 v19.2s, v19.2s // in4d0,in4d1 in3d0,in3d1 + ld2 {v2.2s, v3.2s}, [x2], #16 // in3u0,in3u1 in1d1,in1d0 + fsub v0.2s, v17.2s, v0.2s // in4d-in4u I + ld2 {v20.2s,v21.2s}, [x4], #16 // c0,c1 s0,s1 + rev64 v1.2s, v1.2s // in2d0,in2d1 in1d0,in1d1 + rev64 v3.2s, v3.2s // in2d0,in2d1 in1d0,in1d1 + ld2 {v30.2s,v31.2s}, [x5], x12 // c2,c3 s2,s3 + fadd v2.2s, v2.2s, v19.2s // in3u+in3d -R + fsub v16.2s, v16.2s, v1.2s // in0u-in2d R + fadd v18.2s, v18.2s, v3.2s // in2u+in1d -I + ubfm x12, x6, #16, #31 + ubfm x6, x6, #0, #15 + add x12, x1, x12, lsl #3 + add x6, x1, x6, lsl #3 + st2 {v6.s,v7.s}[0], [x6] + st2 {v6.s,v7.s}[1], [x12] + ubfm x6, x10, #16, #31 + ubfm x10, x10, #0, #15 + add x6 , x1, x6, lsl #3 + add x10, x1, x10, lsl #3 + st2 {v24.s,v25.s}[0], [x10] + st2 {v24.s,v25.s}[1], [x6] + b 1b +1: + fneg v7.2s, v7.2s // R*s-I*c + ubfm x12, x6, #16, #31 + ubfm x6, x6, #0, #15 + add x12, x1, x12, lsl #3 + add x6, x1, x6, lsl #3 + st2 {v6.s,v7.s}[0], [x6] + st2 {v6.s,v7.s}[1], [x12] + ubfm x6, x10, #16, #31 + ubfm x10, x10, #0, #15 + add x6 , x1, x6, lsl #3 + add x10, x1, x10, lsl #3 + st2 {v24.s,v25.s}[0], [x10] + st2 {v24.s,v25.s}[1], [x6] + + mov x19, x0 + mov x20, x1 + bl X(ff_fft_calc_neon) + + mov x12, #1 + ldr w14, [x19, #28] // mdct_bits + ldr x4, [x19, #32] // tcos + lsl x12, x12, x14 // n = 1 << nbits + lsr x14, x12, #3 // n8 = n >> 3 + + add x4, x4, x14, lsl #3 + add x6, x20, x14, lsl #3 + sub x1, x4, #16 + sub x3, x6, #16 + + mov x7, #-16 + mov x8, x6 + mov x0, x3 + + ld2 {v0.2s,v1.2s}, [x3], x7 // d0 =r1,i1 d1 =r0,i0 + ld2 {v20.2s,v21.2s}, [x6], #16 // d20=r2,i2 d21=r3,i3 + ld2 {v16.2s,v17.2s}, [x1], x7 // c1,c0 s1,s0 +1: + subs x14, x14, #2 + fmul v7.2s, v0.2s, v17.2s // r1*s1,r0*s0 + ld2 {v18.2s,v19.2s}, [x4], #16 // c2,c3 s2,s3 + fmul v4.2s, v1.2s, v17.2s // i1*s1,i0*s0 + fmul v6.2s, v21.2s, v19.2s // i2*s2,i3*s3 + fmul v5.2s, v20.2s, v19.2s // r2*s2,r3*s3 + fmul v24.2s, v0.2s, v16.2s // r1*c1,r0*c0 + fmul v25.2s, v20.2s, v18.2s // r2*c2,r3*c3 + fmul v22.2s, v21.2s, v18.2s // i2*c2,i3*c3 + fmul v23.2s, v1.2s, v16.2s // i1*c1,i0*c0 + fadd v4.2s, v4.2s, v24.2s // i1*s1+r1*c1,i0*s0+r0*c0 + fadd v6.2s, v6.2s, v25.2s // i2*s2+r2*c2,i3*s3+r3*c3 + fsub v5.2s, v22.2s, v5.2s // i2*c2-r2*s2,i3*c3-r3*s3 + fsub v7.2s, v23.2s, v7.2s // i1*c1-r1*s1,i0*c0-r0*s0 + fneg v4.2s, v4.2s + fneg v6.2s, v6.2s + b.eq 1f + ld2 {v0.2s, v1.2s}, [x3], x7 + ld2 {v20.2s,v21.2s}, [x6], #16 + ld2 {v16.2s,v17.2s}, [x1], x7 // c1,c0 s1,s0 + rev64 v5.2s, v5.2s + rev64 v7.2s, v7.2s + st2 {v4.2s,v5.2s}, [x0], x7 + st2 {v6.2s,v7.2s}, [x8], #16 + b 1b +1: + rev64 v5.2s, v5.2s + rev64 v7.2s, v7.2s + st2 {v4.2s,v5.2s}, [x0] + st2 {v6.2s,v7.2s}, [x8] + + ldp x19, x20, [sp], #16 + ldr x30, [sp], #16 + ret +endfunc diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_init.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_init.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_init.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_init.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,39 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "libavutil/attributes.h" +#include "libavutil/aarch64/cpu.h" +#include "libavcodec/mpegaudiodsp.h" +#include "config.h" + +void ff_mpadsp_apply_window_fixed_neon(int32_t *synth_buf, int32_t *window, + int *dither, int16_t *samples, int incr); +void ff_mpadsp_apply_window_float_neon(float *synth_buf, float *window, + int *dither, float *samples, int incr); + +av_cold void ff_mpadsp_init_aarch64(MPADSPContext *s) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + s->apply_window_fixed = ff_mpadsp_apply_window_fixed_neon; + s->apply_window_float = ff_mpadsp_apply_window_float_neon; + } +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/mpegaudiodsp_neon.S 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2014 Janne Grunau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +#define FRAC_BITS 23 // fractional bits for sb_samples and dct +#define WFRAC_BITS 16 // fractional bits for window +#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15) + +const tbl_rev128.s align=4 + .byte 12, 13, 14, 15 + .byte 8, 9, 10, 11 + .byte 4, 5, 6, 7 + .byte 0, 1, 2, 3 +endconst + +.macro apply_window type, st +function ff_mpadsp_apply_window_\type\()_neon, export=1 + mov x7, x0 + sxtw x4, w4 // incr + add x8, x0, #512<<2 + ld1 {v0.4s,v1.4s,v2.4s,v3.4s}, [x7], #64 + ld1 {v4.4s,v5.4s,v6.4s,v7.4s}, [x7], #64 + st1 {v0.4s,v1.4s,v2.4s,v3.4s}, [x8], #64 + st1 {v4.4s,v5.4s,v6.4s,v7.4s}, [x8], #64 + movrel x15, tbl_rev128.s + ld1 {v27.4s}, [x15] +.ifc \type, fixed + lsl x4, x4, #1 +.else + lsl x4, x4, #2 +.endif + add x10, x0, #45<<2 + add x0, x0, #16<<2 + add x1, x1, #16<<2 + add x5, x3, x4, lsl #5 + sub x5, x5, x4 // samples2 + neg x13, x4 // -incr + mov x9, #64<<2 +.ifc \type, fixed + ld1r {v16.2s}, [x2] // dither_state + sxtl v16.2d, v16.2s + movi v29.2d, #0 + movi v30.2d, #(1<vorbis_inverse_coupling = ff_vorbis_inverse_coupling_neon; + } +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/vorbisdsp_neon.S ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/vorbisdsp_neon.S --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/aarch64/vorbisdsp_neon.S 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/aarch64/vorbisdsp_neon.S 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2008 Mans Rullgard + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/aarch64/asm.S" + +function ff_vorbis_inverse_coupling_neon, export=1 + movi v20.4s, #1<<7, lsl #24 + subs x2, x2, #4 + mov x3, x0 + mov x4, x1 + b.eq 3f + + ld1 {v7.4s}, [x1], #16 + ld1 {v6.4s}, [x0], #16 + cmle v4.4s, v7.4s, #0 + and v5.16b, v6.16b, v20.16b + eor v7.16b, v7.16b, v5.16b + and v2.16b, v7.16b, v4.16b + bic v3.16b, v7.16b, v4.16b + fadd v7.4s, v6.4s, v2.4s + fsub v6.4s, v6.4s, v3.4s +1: ld1 {v1.4s}, [x1], #16 + ld1 {v0.4s}, [x0], #16 + cmle v4.4s, v1.4s, #0 + and v5.16b, v0.16b, v20.16b + eor v1.16b, v1.16b, v5.16b + st1 {v7.4s}, [x3], #16 + st1 {v6.4s}, [x4], #16 + and v2.16b, v1.16b, v4.16b + bic v3.16b, v1.16b, v4.16b + fadd v1.4s, v0.4s, v2.4s + fsub v0.4s, v0.4s, v3.4s + subs x2, x2, #8 + b.le 2f + ld1 {v7.4s}, [x1], #16 + ld1 {v6.4s}, [x0], #16 + cmle v4.4s, v7.4s, #0 + and v5.16b, v6.16b, v20.16b + eor v7.16b, v7.16b, v5.16b + st1 {v1.4s}, [x3], #16 + st1 {v0.4s}, [x4], #16 + and v2.16b, v7.16b, v4.16b + bic v3.16b, v7.16b, v4.16b + fadd v7.4s, v6.4s, v2.4s + fsub v6.4s, v6.4s, v3.4s + b 1b + +2: st1 {v1.4s}, [x3], #16 + st1 {v0.4s}, [x4], #16 + b.lt ret + +3: ld1 {v1.4s}, [x1] + ld1 {v0.4s}, [x0] + cmle v4.4s, v1.4s, #0 + and v5.16b, v0.16b, v20.16b + eor v1.16b, v1.16b, v5.16b + and v2.16b, v1.16b, v4.16b + bic v3.16b, v1.16b, v4.16b + fadd v1.4s, v0.4s, v2.4s + fsub v0.4s, v0.4s, v3.4s + st1 {v1.4s}, [x0], #16 + st1 {v0.4s}, [x1], #16 +ret: + ret +endfunc diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/allcodecs.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/allcodecs.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/allcodecs.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/allcodecs.c 2014-04-23 09:55:21.000000000 +0000 @@ -337,6 +337,10 @@ REGISTER_DECODER(BMV_AUDIO, bmv_audio); REGISTER_DECODER(COOK, cook); REGISTER_ENCDEC (DCA, dca); + REGISTER_DECODER(DSD_LSBF, dsd_lsbf); + REGISTER_DECODER(DSD_MSBF, dsd_msbf); + REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar); + REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar); REGISTER_DECODER(DSICINAUDIO, dsicinaudio); REGISTER_ENCDEC (EAC3, eac3); REGISTER_DECODER(EVRC, evrc); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/arm/vc1dsp_init_neon.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/arm/vc1dsp_init_neon.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/arm/vc1dsp_init_neon.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/arm/vc1dsp_init_neon.c 2014-04-23 09:55:21.000000000 +0000 @@ -35,40 +35,38 @@ void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd); -void ff_put_vc1_mspel_mc10_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc20_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc30_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); - -void ff_put_vc1_mspel_mc01_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc02_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc03_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); - -void ff_put_vc1_mspel_mc11_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc12_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc13_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); - -void ff_put_vc1_mspel_mc21_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc22_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc23_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); - -void ff_put_vc1_mspel_mc31_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc32_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); -void ff_put_vc1_mspel_mc33_neon(uint8_t *dst, const uint8_t *src, - ptrdiff_t stride, int rnd); +#define DECL_PUT(X, Y) \ +void ff_put_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd); \ +static void ff_put_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t *src, \ + ptrdiff_t stride, int rnd) \ +{ \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ + dst += 8*stride; src += 8*stride; \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \ + ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \ +} + +DECL_PUT(1, 0) +DECL_PUT(2, 0) +DECL_PUT(3, 0) + +DECL_PUT(0, 1) +DECL_PUT(0, 2) +DECL_PUT(0, 3) + +DECL_PUT(1, 1) +DECL_PUT(1, 2) +DECL_PUT(1, 3) + +DECL_PUT(2, 1) +DECL_PUT(2, 2) +DECL_PUT(2, 3) + +DECL_PUT(3, 1) +DECL_PUT(3, 2) +DECL_PUT(3, 3) void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); @@ -79,6 +77,10 @@ void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y); +#define FN_ASSIGN(X, Y) \ + dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_16_neon; \ + dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon + av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp) { dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon; @@ -90,22 +92,25 @@ dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon; dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon; - dsp->put_vc1_mspel_pixels_tab[ 0] = ff_put_pixels8x8_neon; - dsp->put_vc1_mspel_pixels_tab[ 1] = ff_put_vc1_mspel_mc10_neon; - dsp->put_vc1_mspel_pixels_tab[ 2] = ff_put_vc1_mspel_mc20_neon; - dsp->put_vc1_mspel_pixels_tab[ 3] = ff_put_vc1_mspel_mc30_neon; - dsp->put_vc1_mspel_pixels_tab[ 4] = ff_put_vc1_mspel_mc01_neon; - dsp->put_vc1_mspel_pixels_tab[ 5] = ff_put_vc1_mspel_mc11_neon; - dsp->put_vc1_mspel_pixels_tab[ 6] = ff_put_vc1_mspel_mc21_neon; - dsp->put_vc1_mspel_pixels_tab[ 7] = ff_put_vc1_mspel_mc31_neon; - dsp->put_vc1_mspel_pixels_tab[ 8] = ff_put_vc1_mspel_mc02_neon; - dsp->put_vc1_mspel_pixels_tab[ 9] = ff_put_vc1_mspel_mc12_neon; - dsp->put_vc1_mspel_pixels_tab[10] = ff_put_vc1_mspel_mc22_neon; - dsp->put_vc1_mspel_pixels_tab[11] = ff_put_vc1_mspel_mc32_neon; - dsp->put_vc1_mspel_pixels_tab[12] = ff_put_vc1_mspel_mc03_neon; - dsp->put_vc1_mspel_pixels_tab[13] = ff_put_vc1_mspel_mc13_neon; - dsp->put_vc1_mspel_pixels_tab[14] = ff_put_vc1_mspel_mc23_neon; - dsp->put_vc1_mspel_pixels_tab[15] = ff_put_vc1_mspel_mc33_neon; + dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon; + FN_ASSIGN(1, 0); + FN_ASSIGN(2, 0); + FN_ASSIGN(3, 0); + + FN_ASSIGN(0, 1); + FN_ASSIGN(1, 1); + FN_ASSIGN(2, 1); + FN_ASSIGN(3, 1); + + FN_ASSIGN(0, 2); + FN_ASSIGN(1, 2); + FN_ASSIGN(2, 2); + FN_ASSIGN(3, 2); + + FN_ASSIGN(0, 3); + FN_ASSIGN(1, 3); + FN_ASSIGN(2, 3); + FN_ASSIGN(3, 3); dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/atrac1data.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/atrac1data.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/atrac1data.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/atrac1data.h 2014-04-23 09:55:21.000000000 +0000 @@ -43,7 +43,7 @@ */ static const uint8_t specs_per_bfu[52] = { 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 6, 6, 6, 6, 6, 6, 6, 6, // low band - 6, 6, 6, 6, 7, 7, 7, 7, 9, 9, 9, 9, 10, 10, 10, 10, // midle band + 6, 6, 6, 6, 7, 7, 7, 7, 9, 9, 9, 9, 10, 10, 10, 10, // middle band 12, 12, 12, 12, 12, 12, 12, 12, 20, 20, 20, 20, 20, 20, 20, 20 // high band }; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/avcodec.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/avcodec.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/avcodec.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/avcodec.h 2014-04-23 09:55:21.000000000 +0000 @@ -292,6 +292,9 @@ AV_CODEC_ID_EXR_DEPRECATED, AV_CODEC_ID_VP7_DEPRECATED, AV_CODEC_ID_SANM_DEPRECATED, + AV_CODEC_ID_SGIRLE_DEPRECATED, + AV_CODEC_ID_MVC1_DEPRECATED, + AV_CODEC_ID_MVC2_DEPRECATED, AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'), AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), @@ -489,6 +492,10 @@ AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'), AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'), AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'), + AV_CODEC_ID_DSD_LSBF = MKBETAG('D','S','D','L'), + AV_CODEC_ID_DSD_MSBF = MKBETAG('D','S','D','M'), + AV_CODEC_ID_DSD_LSBF_PLANAR = MKBETAG('D','S','D','1'), + AV_CODEC_ID_DSD_MSBF_PLANAR = MKBETAG('D','S','D','8'), /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -1356,12 +1363,17 @@ * encoded input. * * Audio: - * For encoding, this is the number of "priming" samples added to the - * beginning of the stream. The decoded output will be delayed by this - * many samples relative to the input to the encoder. Note that this - * field is purely informational and does not directly affect the pts - * output by the encoder, which should always be based on the actual - * presentation time, including any delay. + * For encoding, this is the number of "priming" samples added by the + * encoder to the beginning of the stream. The decoded output will be + * delayed by this many samples relative to the input to the encoder (or + * more, if the decoder adds its own padding). + * The timestamps on the output packets are adjusted by the encoder so + * that they always refer to the first sample of the data actually + * contained in the packet, including any added padding. + * E.g. if the timebase is 1/samplerate and the timestamp of the first + * input sample is 0, the timestamp of the first output packet will be + * -delay. + * * For decoding, this is the number of samples the decoder needs to * output before the decoder's output is valid. When seeking, you should * start decoding this many samples prior to your desired seek point. @@ -2248,7 +2260,7 @@ /** * ratecontrol qmin qmax limiting method - * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. + * 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax. * - encoding: Set by user. * - decoding: unused */ @@ -2343,14 +2355,14 @@ int context_model; /** - * minimum Lagrange multipler + * minimum Lagrange multiplier * - encoding: Set by user. * - decoding: unused */ int lmin; /** - * maximum Lagrange multipler + * maximum Lagrange multiplier * - encoding: Set by user. * - decoding: unused */ @@ -2575,7 +2587,7 @@ #define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection #define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors -#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliancies as errors +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors #define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error @@ -2765,7 +2777,7 @@ #endif /** - * noise vs. sse weight for the nsse comparsion function + * noise vs. sse weight for the nsse comparison function * - encoding: Set by user. * - decoding: unused */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/cngenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/cngenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/cngenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/cngenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -56,8 +56,8 @@ p->order = 10; if ((ret = ff_lpc_init(&p->lpc, avctx->frame_size, p->order, FF_LPC_TYPE_LEVINSON)) < 0) return ret; - p->samples32 = av_malloc(avctx->frame_size * sizeof(*p->samples32)); - p->ref_coef = av_malloc(p->order * sizeof(*p->ref_coef)); + p->samples32 = av_malloc_array(avctx->frame_size, sizeof(*p->samples32)); + p->ref_coef = av_malloc_array(p->order, sizeof(*p->ref_coef)); if (!p->samples32 || !p->ref_coef) { cng_encode_close(avctx); return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/codec_desc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/codec_desc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/codec_desc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/codec_desc.c 2014-04-23 09:55:21.000000000 +0000 @@ -662,13 +662,6 @@ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, { - .id = AV_CODEC_ID_SGIRLE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sgirle", - .long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { .id = AV_CODEC_ID_C93, .type = AVMEDIA_TYPE_VIDEO, .name = "c93", @@ -1233,6 +1226,13 @@ .long_name = NULL_IF_CONFIG_SMALL("LucasArts SANM/SMUSH video"), .props = AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_SGIRLE, + .type = AVMEDIA_TYPE_VIDEO, + .name = "sgirle", + .long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, + }, /* image codecs */ { @@ -2460,6 +2460,34 @@ .long_name = NULL_IF_CONFIG_SMALL("SMV (Selectable Mode Vocoder)"), .props = AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_DSD_LSBF, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dsd_lsbf", + .long_name = NULL_IF_CONFIG_SMALL("DSD (Direct Stream Digital), least significant bit first"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_DSD_MSBF, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dsd_msbf", + .long_name = NULL_IF_CONFIG_SMALL("DSD (Direct Stream Digital), most significant bit first"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_DSD_LSBF_PLANAR, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dsd_lsbf_planar", + .long_name = NULL_IF_CONFIG_SMALL("DSD (Direct Stream Digital), least significant bit first, planar"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_DSD_MSBF_PLANAR, + .type = AVMEDIA_TYPE_AUDIO, + .name = "dsd_msbf_planar", + .long_name = NULL_IF_CONFIG_SMALL("DSD (Direct Stream Digital), most significant bit first, planar"), + .props = AV_CODEC_PROP_LOSSY, + }, /* subtitle codecs */ { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/cook.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/cook.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/cook.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/cook.c 2014-04-23 09:55:21.000000000 +0000 @@ -219,7 +219,7 @@ int j, ret; int mlt_size = q->samples_per_channel; - if ((q->mlt_window = av_malloc(mlt_size * sizeof(*q->mlt_window))) == 0) + if ((q->mlt_window = av_malloc_array(mlt_size, sizeof(*q->mlt_window))) == 0) return AVERROR(ENOMEM); /* Initialize the MLT window: simple sine window. */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dcadec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dcadec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dcadec.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dcadec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1370,7 +1370,7 @@ * Decode VQ encoded high frequencies */ if (s->subband_activity[k] > s->vq_start_subband[k]) { - if (!s->debug_flag & 0x01) { + if (!(s->debug_flag & 0x01)) { av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n"); s->debug_flag |= 0x01; @@ -2142,7 +2142,6 @@ return AVERROR_INVALIDDATA; } - init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); if ((ret = dca_parse_frame_header(s)) < 0) { //seems like the frame is corrupt, try with the next one return ret; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/diracdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/diracdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/diracdec.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/diracdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1355,8 +1355,8 @@ motion_y >>= s->chroma_y_shift; } - mx = motion_x & ~(-1 << s->mv_precision); - my = motion_y & ~(-1 << s->mv_precision); + mx = motion_x & ~(-1U << s->mv_precision); + my = motion_y & ~(-1U << s->mv_precision); motion_x >>= s->mv_precision; motion_y >>= s->mv_precision; /* normalize subpel coordinates to epel */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dirac_dwt.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dirac_dwt.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dirac_dwt.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dirac_dwt.h 2014-04-23 09:55:21.000000000 +0000 @@ -82,7 +82,7 @@ void ff_spatial_idwt_slice2(DWTContext *d, int y); -// shared stuff for simd optimiztions +// shared stuff for simd optimizations #define COMPOSE_53iL0(b0, b1, b2)\ (b1 - ((b0 + b2 + 2) >> 2)) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dnxhddata.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dnxhddata.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dnxhddata.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dnxhddata.h 2014-04-23 09:55:21.000000000 +0000 @@ -42,7 +42,7 @@ const uint8_t *ac_flags; const uint16_t *run_codes; const uint8_t *run_bits, *run; - int bit_rates[5]; ///< Helpher to choose variants, rounded to nearest 5Mb/s + int bit_rates[5]; ///< Helper to choose variants, rounded to nearest 5Mb/s AVRational frame_rates[5]; } CIDEntry; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsddec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsddec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsddec.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsddec.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,167 @@ +/* + * Direct Stream Digital (DSD) decoder + * based on BSD licensed dsd2pcm by Sebastian Gesemann + * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved. + * Copyright (c) 2014 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Direct Stream Digital (DSD) decoder + */ + +#include "libavcodec/internal.h" +#include "libavcodec/mathops.h" +#include "avcodec.h" +#include "dsd_tablegen.h" + +#define FIFOSIZE 16 /** must be a power of two */ +#define FIFOMASK (FIFOSIZE - 1) /** bit mask for FIFO offsets */ + +#if FIFOSIZE * 8 < HTAPS * 2 +#error "FIFOSIZE too small" +#endif + +/** + * Per-channel buffer + */ +typedef struct { + unsigned char buf[FIFOSIZE]; + unsigned pos; +} DSDContext; + +static void dsd2pcm_translate(DSDContext* s, size_t samples, int lsbf, + const unsigned char *src, ptrdiff_t src_stride, + float *dst, ptrdiff_t dst_stride) +{ + unsigned pos, i; + unsigned char* p; + double sum; + + pos = s->pos; + + while (samples-- > 0) { + s->buf[pos] = lsbf ? ff_reverse[*src] : *src; + src += src_stride; + + p = s->buf + ((pos - CTABLES) & FIFOMASK); + *p = ff_reverse[*p]; + + sum = 0.0; + for (i = 0; i < CTABLES; i++) { + unsigned char a = s->buf[(pos - i) & FIFOMASK]; + unsigned char b = s->buf[(pos - (CTABLES*2 - 1) + i) & FIFOMASK]; + sum += ctables[i][a] + ctables[i][b]; + } + + *dst = (float)sum; + dst += dst_stride; + + pos = (pos + 1) & FIFOMASK; + } + + s->pos = pos; +} + +static av_cold void init_static_data(void) +{ + static int done = 0; + if (done) + return; + dsd_ctables_tableinit(); + done = 1; +} + +static av_cold int decode_init(AVCodecContext *avctx) +{ + DSDContext * s; + int i; + + init_static_data(); + + s = av_malloc_array(sizeof(DSDContext), avctx->channels); + if (!s) + return AVERROR(ENOMEM); + + for (i = 0; i < avctx->channels; i++) { + s[i].pos = 0; + memset(s[i].buf, 0x69, sizeof(s[i].buf)); + + /* 0x69 = 01101001 + * This pattern "on repeat" makes a low energy 352.8 kHz tone + * and a high energy 1.0584 MHz tone which should be filtered + * out completely by any playback system --> silence + */ + } + + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; + avctx->priv_data = s; + return 0; +} + +static int decode_frame(AVCodecContext *avctx, void *data, + int *got_frame_ptr, AVPacket *avpkt) +{ + DSDContext * s = avctx->priv_data; + AVFrame *frame = data; + int ret, i; + int lsbf = avctx->codec_id == AV_CODEC_ID_DSD_LSBF || avctx->codec_id == AV_CODEC_ID_DSD_LSBF_PLANAR; + int src_next; + int src_stride; + + frame->nb_samples = avpkt->size / avctx->channels; + + if (avctx->codec_id == AV_CODEC_ID_DSD_LSBF_PLANAR || avctx->codec_id == AV_CODEC_ID_DSD_MSBF_PLANAR) { + src_next = frame->nb_samples; + src_stride = 1; + } else { + src_next = 1; + src_stride = avctx->channels; + } + + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; + + for (i = 0; i < avctx->channels; i++) { + float * dst = ((float **)frame->extended_data)[i]; + dsd2pcm_translate(&s[i], frame->nb_samples, lsbf, + avpkt->data + i * src_next, src_stride, + dst, 1); + } + + *got_frame_ptr = 1; + return frame->nb_samples * avctx->channels; +} + +#define DSD_DECODER(id_, name_, long_name_) \ +AVCodec ff_##name_##_decoder = { \ + .name = #name_, \ + .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ + .type = AVMEDIA_TYPE_AUDIO, \ + .id = AV_CODEC_ID_##id_, \ + .init = decode_init, \ + .decode = decode_frame, \ + .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLTP, \ + AV_SAMPLE_FMT_NONE }, \ +}; + +DSD_DECODER(DSD_LSBF, dsd_lsbf, "DSD (Direct Stream Digital), least significant bit first") +DSD_DECODER(DSD_MSBF, dsd_msbf, "DSD (Direct Stream Digital), most significant bit first") +DSD_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar, "DSD (Direct Stream Digital), most significant bit first, planar") +DSD_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar, "DSD (Direct Stream Digital), least significant bit first, planar") diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsd_tablegen.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsd_tablegen.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsd_tablegen.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsd_tablegen.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * Generate a header file for hardcoded DSD tables + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#define CONFIG_HARDCODED_TABLES 0 +#include "dsd_tablegen.h" +#include "tableprint.h" +#include + +int main(void) +{ + dsd_ctables_tableinit(); + + write_fileheader(); + + printf("static const double ctables[CTABLES][256] = {\n"); + write_float_2d_array(ctables, CTABLES, 256); + printf("};\n"); + + return 0; +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsd_tablegen.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsd_tablegen.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dsd_tablegen.h 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dsd_tablegen.h 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,95 @@ +/* + * Header file for hardcoded DSD tables + * based on BSD licensed dsd2pcm by Sebastian Gesemann + * Copyright (c) 2009, 2011 Sebastian Gesemann. All rights reserved. + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DSD_TABLEGEN_H +#define AVCODEC_DSD_TABLEGEN_H + +#include +#include "libavutil/attributes.h" + +#define HTAPS 48 /** number of FIR constants */ +#define CTABLES ((HTAPS + 7) / 8) /** number of "8 MACs" lookup tables */ + +#if CONFIG_HARDCODED_TABLES +#define dsd_ctables_tableinit() +#include "libavcodec/dsd_tables.h" +#else +#include "libavutil/common.h" + +/* + * Properties of this 96-tap lowpass filter when applied on a signal + * with sampling rate of 44100*64 Hz: + * + * () has a delay of 17 microseconds. + * + * () flat response up to 48 kHz + * + * () if you downsample afterwards by a factor of 8, the + * spectrum below 70 kHz is practically alias-free. + * + * () stopband rejection is about 160 dB + * + * The coefficient tables ("ctables") take only 6 Kibi Bytes and + * should fit into a modern processor's fast cache. + */ + +/** + * The 2nd half (48 coeffs) of a 96-tap symmetric lowpass filter + */ +static const double htaps[HTAPS] = { + 0.09950731974056658, 0.09562845727714668, 0.08819647126516944, + 0.07782552527068175, 0.06534876523171299, 0.05172629311427257, + 0.0379429484910187, 0.02490921351762261, 0.0133774746265897, + 0.003883043418804416, -0.003284703416210726, -0.008080250212687497, + -0.01067241812471033, -0.01139427235000863, -0.0106813877974587, + -0.009007905078766049, -0.006828859761015335, -0.004535184322001496, + -0.002425035959059578, -0.0006922187080790708, 0.0005700762133516592, + 0.001353838005269448, 0.001713709169690937, 0.001742046839472948, + 0.001545601648013235, 0.001226696225277855, 0.0008704322683580222, + 0.0005381636200535649, 0.000266446345425276, 7.002968738383528e-05, + -5.279407053811266e-05, -0.0001140625650874684, -0.0001304796361231895, + -0.0001189970287491285, -9.396247155265073e-05, -6.577634378272832e-05, + -4.07492895872535e-05, -2.17407957554587e-05, -9.163058931391722e-06, + -2.017460145032201e-06, 1.249721855219005e-06, 2.166655190537392e-06, + 1.930520892991082e-06, 1.319400334374195e-06, 7.410039764949091e-07, + 3.423230509967409e-07, 1.244182214744588e-07, 3.130441005359396e-08 +}; + +static float ctables[CTABLES][256]; + +static av_cold void dsd_ctables_tableinit(void) +{ + int t, e, m, k; + double acc; + for (t = 0; t < CTABLES; ++t) { + k = FFMIN(HTAPS - t * 8, 8); + for (e = 0; e < 256; ++e) { + acc = 0.0; + for (m = 0; m < k; ++m) + acc += (((e >> (7 - m)) & 1) * 2 - 1) * htaps[t * 8 + m]; + ctables[CTABLES - 1 - t][e] = (float)acc; + } + } +} +#endif /* CONFIG_HARDCODED_TABLES */ + +#endif /* AVCODEC_DSD_TABLEGEN_H */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dvbsubdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dvbsubdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/dvbsubdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/dvbsubdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1394,7 +1394,7 @@ } if (sub->num_rects > 0){ - sub->rects = av_mallocz(sizeof(*sub->rects) * sub->num_rects); + sub->rects = av_mallocz_array(sizeof(*sub->rects), sub->num_rects); for(i=0; inum_rects; i++) sub->rects[i] = av_mallocz(sizeof(*sub->rects[i])); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/error_resilience.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/error_resilience.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/error_resilience.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/error_resilience.h 2014-04-23 09:55:21.000000000 +0000 @@ -42,7 +42,7 @@ AVFrame *f; ThreadFrame *tf; - // it's the caller responsability to allocate these buffers + // it's the caller's responsibility to allocate these buffers int16_t (*motion_val[2])[2]; int8_t *ref_index[2]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/exif.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/exif.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/exif.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/exif.c 2014-04-23 09:55:21.000000000 +0000 @@ -48,9 +48,11 @@ { switch(type) { case TIFF_DOUBLE : return ff_tadd_doubles_metadata(count, name, sep, gb, le, metadata); - case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, metadata); + case TIFF_SSHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 1, metadata); + case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, gb, le, 0, metadata); + case TIFF_SBYTE : return ff_tadd_bytes_metadata(count, name, sep, gb, le, 1, metadata); case TIFF_BYTE : - case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, metadata); + case TIFF_UNDEFINED: return ff_tadd_bytes_metadata(count, name, sep, gb, le, 0, metadata); case TIFF_STRING : return ff_tadd_string_metadata(count, name, gb, le, metadata); case TIFF_SRATIONAL: case TIFF_RATIONAL : return ff_tadd_rational_metadata(count, name, sep, gb, le, metadata); @@ -76,6 +78,11 @@ ff_tread_tag(gbytes, le, &id, &type, &count, &cur_pos); + if (!bytestream2_tell(gbytes)) { + bytestream2_seek(gbytes, cur_pos, SEEK_SET); + return 0; + } + // read count values and add it metadata // store metadata or proceed with next IFD ret = ff_tis_ifd(id); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft.h 2014-04-23 09:55:21.000000000 +0000 @@ -148,6 +148,7 @@ */ int ff_fft_init(FFTContext *s, int nbits, int inverse); +void ff_fft_init_aarch64(FFTContext *s); void ff_fft_init_x86(FFTContext *s); void ff_fft_init_arm(FFTContext *s); void ff_fft_init_mips(FFTContext *s); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft_table.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft_table.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft_table.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft_table.h 2014-04-23 09:55:21.000000000 +0000 @@ -56,7 +56,7 @@ #include "libavcodec/fft.h" -#define MAX_LOG2_NFFT 16 //!< Specifies maxiumum allowed fft size +#define MAX_LOG2_NFFT 16 //!< Specifies maximum allowed fft size #define MAX_FFT_SIZE (1 << MAX_LOG2_NFFT) extern int32_t w_tab_sr[]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft_template.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft_template.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft_template.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft_template.c 2014-04-23 09:55:21.000000000 +0000 @@ -170,6 +170,7 @@ } #else /* FFT_FIXED_32 */ #if FFT_FLOAT + if (ARCH_AARCH64) ff_fft_init_aarch64(s); if (ARCH_ARM) ff_fft_init_arm(s); if (ARCH_PPC) ff_fft_init_ppc(s); if (ARCH_X86) ff_fft_init_x86(s); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft-test.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft-test.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fft-test.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fft-test.c 2014-04-23 09:55:21.000000000 +0000 @@ -75,7 +75,7 @@ double c1, s1, alpha; n = 1 << nbits; - exptab = av_malloc((n / 2) * sizeof(*exptab)); + exptab = av_malloc_array((n / 2), sizeof(*exptab)); for (i = 0; i < (n/2); i++) { alpha = 2 * M_PI * (float)i / (float)n; @@ -304,10 +304,10 @@ } fft_size = 1 << fft_nbits; - tab = av_malloc(fft_size * sizeof(FFTComplex)); - tab1 = av_malloc(fft_size * sizeof(FFTComplex)); - tab_ref = av_malloc(fft_size * sizeof(FFTComplex)); - tab2 = av_malloc(fft_size * sizeof(FFTSample)); + tab = av_malloc_array(fft_size, sizeof(FFTComplex)); + tab1 = av_malloc_array(fft_size, sizeof(FFTComplex)); + tab_ref = av_malloc_array(fft_size, sizeof(FFTComplex)); + tab2 = av_malloc_array(fft_size, sizeof(FFTSample)); switch (transform) { case TRANSFORM_MDCT: diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fic.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fic.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/fic.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/fic.c 2014-04-23 09:55:21.000000000 +0000 @@ -24,7 +24,6 @@ #include "libavutil/common.h" #include "avcodec.h" #include "internal.h" -#include "dsputil.h" #include "get_bits.h" #include "golomb.h" @@ -40,9 +39,6 @@ AVCodecContext *avctx; AVFrame *frame; - DSPContext dsp; - ScanTable scantable; - FICThreadContext *slice_data; int slice_data_size; @@ -80,6 +76,55 @@ #define FIC_HEADER_SIZE 27 +static av_always_inline void fic_idct(int16_t *blk, int step, int shift) +{ + const int t0 = 27246 * blk[3 * step] + 18405 * blk[5 * step]; + const int t1 = 27246 * blk[5 * step] - 18405 * blk[3 * step]; + const int t2 = 6393 * blk[7 * step] + 32139 * blk[1 * step]; + const int t3 = 6393 * blk[1 * step] - 32139 * blk[7 * step]; + const int t4 = 5793 * (t2 + t0 + 0x800 >> 12); + const int t5 = 5793 * (t3 + t1 + 0x800 >> 12); + const int t6 = t2 - t0; + const int t7 = t3 - t1; + const int t8 = 17734 * blk[2 * step] - 42813 * blk[6 * step]; + const int t9 = 17734 * blk[6 * step] + 42814 * blk[2 * step]; + const int tA = (blk[0 * step] - blk[4 * step] << 15) + (1 << shift - 1); + const int tB = (blk[0 * step] + blk[4 * step] << 15) + (1 << shift - 1); + blk[0 * step] = ( t4 + t9 + tB) >> shift; + blk[1 * step] = ( t6 + t7 + t8 + tA) >> shift; + blk[2 * step] = ( t6 - t7 - t8 + tA) >> shift; + blk[3 * step] = ( t5 - t9 + tB) >> shift; + blk[4 * step] = ( -t5 - t9 + tB) >> shift; + blk[5 * step] = (-(t6 - t7) - t8 + tA) >> shift; + blk[6 * step] = (-(t6 + t7) + t8 + tA) >> shift; + blk[7 * step] = ( -t4 + t9 + tB) >> shift; +} + +static void fic_idct_put(uint8_t *dst, int stride, int16_t *block) +{ + int i, j; + int16_t *ptr; + + ptr = block; + for (i = 0; i < 8; i++) { + fic_idct(ptr, 8, 13); + ptr++; + } + + ptr = block; + for (i = 0; i < 8; i++) { + fic_idct(ptr, 1, 20); + ptr += 8; + } + + ptr = block; + for (j = 0; j < 8; j++) { + for (i = 0; i < 8; i++) + dst[i] = av_clip_uint8(ptr[i]); + dst += stride; + ptr += 8; + } +} static int fic_decode_block(FICContext *ctx, GetBitContext *gb, uint8_t *dst, int stride, int16_t *block) { @@ -94,16 +139,17 @@ return 0; } - ctx->dsp.clear_block(block); + memset(block, 0, sizeof(*block) * 64); num_coeff = get_bits(gb, 7); if (num_coeff > 64) return AVERROR_INVALIDDATA; for (i = 0; i < num_coeff; i++) - block[ctx->scantable.permutated[i]] = get_se_golomb(gb) * ctx->qmat[i]; + block[ff_zigzag_direct[i]] = get_se_golomb(gb) * + ctx->qmat[ff_zigzag_direct[i]]; - ctx->dsp.idct_put(dst, stride, block); + fic_idct_put(dst, stride, block); return 0; } @@ -246,8 +292,8 @@ ctx->slice_data[slice].y_off = y_off; } - if (ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data, - NULL, nslices, sizeof(ctx->slice_data[0])) < 0) + if ((ret = avctx->execute(avctx, fic_decode_slice, ctx->slice_data, + NULL, nslices, sizeof(ctx->slice_data[0]))) < 0) return ret; skip: @@ -284,10 +330,6 @@ if (!ctx->frame) return AVERROR(ENOMEM); - ff_dsputil_init(&ctx->dsp, avctx); - - ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, ff_zigzag_direct); - return 0; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/flac_parser.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/flac_parser.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/flac_parser.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/flac_parser.c 2014-04-23 09:55:21.000000000 +0000 @@ -489,6 +489,14 @@ &fpc->wrap_buf, &fpc->wrap_buf_allocated_size); + + if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ + if (header->fi.is_var_size) + fpc->pc->pts = header->fi.frame_or_sample_num; + else if (header->best_child) + fpc->pc->pts = header->fi.frame_or_sample_num * header->fi.blocksize; + } + fpc->best_header_valid = 0; fpc->last_fi_valid = 1; fpc->last_fi = header->fi; @@ -516,6 +524,11 @@ s->duration = fi.blocksize; if (!avctx->sample_rate) avctx->sample_rate = fi.samplerate; + if (fpc->pc->flags & PARSER_FLAG_USE_CODEC_TS){ + fpc->pc->pts = fi.frame_or_sample_num; + if (!fi.is_var_size) + fpc->pc->pts *= fi.blocksize; + } } *poutbuf = buf; *poutbuf_size = buf_size; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/g723_1.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/g723_1.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/g723_1.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/g723_1.c 2014-04-23 09:55:21.000000000 +0000 @@ -2285,7 +2285,8 @@ if (p->cur_rate == RATE_6300) { info_bits = 0; put_bits(&pb, 2, info_bits); - } + }else + av_assert0(0); put_bits(&pb, 8, p->lsp_index[2]); put_bits(&pb, 8, p->lsp_index[1]); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/get_bits.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/get_bits.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/get_bits.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/get_bits.h 2014-04-23 09:55:21.000000000 +0000 @@ -219,7 +219,7 @@ } /** - * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). + * read mpeg1 dc style vlc (sign bit + mantissa with no MSB). * if MSB not set it is negative * @param n length in bits */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/h264_slice.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/h264_slice.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/h264_slice.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/h264_slice.c 2014-04-23 09:55:21.000000000 +0000 @@ -1420,10 +1420,7 @@ } if (h->context_initialized && - (h->width != h->avctx->coded_width || - h->height != h->avctx->coded_height || - must_reinit || - needs_reinit)) { + (must_reinit || needs_reinit)) { if (h != h0) { av_log(h->avctx, AV_LOG_ERROR, "changing width %d -> %d / height %d -> %d on " diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/hevc.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/hevc.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/hevc.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/hevc.h 2014-04-23 09:55:21.000000000 +0000 @@ -843,7 +843,7 @@ int **skipped_bytes_pos_nal; int *skipped_bytes_pos_size_nal; - uint8_t *data; + const uint8_t *data; HEVCNAL *nals; int nb_nals; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/huffman.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/huffman.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/huffman.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/huffman.c 2014-04-23 09:55:21.000000000 +0000 @@ -54,9 +54,9 @@ int ff_huff_gen_len_table(uint8_t *dst, const uint64_t *stats, int size) { - HeapElem *h = av_malloc(sizeof(*h) * size); - int *up = av_malloc(sizeof(*up) * 2 * size); - uint8_t *len = av_malloc(sizeof(*len) * 2 * size); + HeapElem *h = av_malloc_array(sizeof(*h), size); + int *up = av_malloc_array(sizeof(*up) * 2, size); + uint8_t *len = av_malloc_array(sizeof(*len) * 2, size); int offset, i, next; int ret = 0; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/libspeexdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/libspeexdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/libspeexdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/libspeexdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -43,7 +43,7 @@ SpeexHeader *header = NULL; int spx_mode; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; + avctx->sample_fmt = AV_SAMPLE_FMT_NONE; if (avctx->extradata && avctx->extradata_size >= 80) { header = speex_packet_to_header(avctx->extradata, avctx->extradata_size); @@ -125,6 +125,7 @@ AVFrame *frame = data; int16_t *output; int ret, consumed = 0; + avctx->sample_fmt = AV_SAMPLE_FMT_S16; /* get output buffer */ frame->nb_samples = s->frame_size; @@ -159,6 +160,8 @@ *got_frame_ptr = 1; + if (!avctx->bit_rate) + speex_decoder_ctl(s->dec_state, SPEEX_GET_BITRATE, &avctx->bit_rate); return consumed; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/libxavs.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/libxavs.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/libxavs.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/libxavs.c 2014-04-23 09:55:21.000000000 +0000 @@ -353,7 +353,7 @@ if (!x4->enc) return -1; - if (!(x4->pts_buffer = av_mallocz((avctx->max_b_frames+1) * sizeof(*x4->pts_buffer)))) + if (!(x4->pts_buffer = av_mallocz_array((avctx->max_b_frames+1), sizeof(*x4->pts_buffer)))) return AVERROR(ENOMEM); avctx->coded_frame = av_frame_alloc(); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/Makefile ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/Makefile --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/Makefile 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/Makefile 2014-04-23 09:55:21.000000000 +0000 @@ -179,6 +179,8 @@ OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o OBJS-$(CONFIG_DPX_DECODER) += dpx.o OBJS-$(CONFIG_DPX_ENCODER) += dpxenc.o +OBJS-$(CONFIG_DSD_LSBF_DECODER) += dsddec.o +OBJS-$(CONFIG_DSD_MSBF_DECODER) += dsddec.o OBJS-$(CONFIG_DSICINAUDIO_DECODER) += dsicinav.o OBJS-$(CONFIG_DSICINVIDEO_DECODER) += dsicinav.o OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o @@ -847,6 +849,7 @@ aacps_tablegen \ cbrt_tablegen \ cos_tablegen \ + dsd_tablegen \ dv_tablegen \ motionpixels_tablegen \ mpegaudio_tablegen \ @@ -871,7 +874,7 @@ $(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0 endif -GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h \ +GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dsd_tables.h dv_tables.h \ sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \ pcm_tables.h qdm2_tables.h GEN_HEADERS := $(addprefix $(SUBDIR), $(GEN_HEADERS)) @@ -883,6 +886,7 @@ $(SUBDIR)aacdec.o: $(SUBDIR)cbrt_tables.h $(SUBDIR)aacps.o: $(SUBDIR)aacps_tables.h $(SUBDIR)aactab.o: $(SUBDIR)aac_tables.h +$(SUBDIR)dsddec.o: $(SUBDIR)dsd_tables.h $(SUBDIR)dvenc.o: $(SUBDIR)dv_tables.h $(SUBDIR)sinewin.o: $(SUBDIR)sinewin_tables.h $(SUBDIR)mpegaudiodec_fixed.o: $(SUBDIR)mpegaudio_tables.h diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1665,17 +1665,15 @@ ret = ff_tdecode_header(&gbytes, &le, &ifd_offset); if (ret) { av_log(s->avctx, AV_LOG_ERROR, "mjpeg: invalid TIFF header in EXIF data\n"); - return ret; - } - - bytestream2_seek(&gbytes, ifd_offset, SEEK_SET); + } else { + bytestream2_seek(&gbytes, ifd_offset, SEEK_SET); - // read 0th IFD and store the metadata - // (return values > 0 indicate the presence of subimage metadata) - ret = avpriv_exif_decode_ifd(s->avctx, &gbytes, le, 0, &s->exif_metadata); - if (ret < 0) { - av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error decoding EXIF data\n"); - return ret; + // read 0th IFD and store the metadata + // (return values > 0 indicate the presence of subimage metadata) + ret = avpriv_exif_decode_ifd(s->avctx, &gbytes, le, 0, &s->exif_metadata); + if (ret < 0) { + av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error decoding EXIF data\n"); + } } bytes_read = bytestream2_tell(&gbytes); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -487,7 +487,7 @@ put_bits(&s->pb, huff_size_ac[0], huff_code_ac[0]); } -void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]) +void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64]) { int i; if (s->chroma_format == CHROMA_444) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegenc.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegenc.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mjpegenc.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mjpegenc.h 2014-04-23 09:55:21.000000000 +0000 @@ -61,6 +61,6 @@ void ff_mjpeg_init_hvsample(AVCodecContext *avctx, int hsample[3], int vsample[3]); void ff_mjpeg_encode_dc(PutBitContext *pb, int val, uint8_t *huff_size, uint16_t *huff_code); -void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[6][64]); +void ff_mjpeg_encode_mb(MpegEncContext *s, int16_t block[12][64]); #endif /* AVCODEC_MJPEGENC_H */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudiodsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudiodsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudiodsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudiodsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -41,6 +41,7 @@ s->imdct36_blocks_float = ff_imdct36_blocks_float; s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; + if (ARCH_AARCH64) ff_mpadsp_init_aarch64(s); if (ARCH_ARM) ff_mpadsp_init_arm(s); if (ARCH_PPC) ff_mpadsp_init_ppc(s); if (ARCH_X86) ff_mpadsp_init_x86(s); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudiodsp.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudiodsp.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudiodsp.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudiodsp.h 2014-04-23 09:55:21.000000000 +0000 @@ -55,6 +55,7 @@ float *samples, int incr, float *sb_samples); +void ff_mpadsp_init_aarch64(MPADSPContext *s); void ff_mpadsp_init_arm(MPADSPContext *s); void ff_mpadsp_init_ppc(MPADSPContext *s); void ff_mpadsp_init_x86(MPADSPContext *s); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudioenc_template.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudioenc_template.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegaudioenc_template.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegaudioenc_template.c 2014-04-23 09:55:21.000000000 +0000 @@ -708,7 +708,7 @@ q1 += 1 << P; if (q1 < 0) q1 = 0; - q[m] = (unsigned)(q1 * steps) >> (P + 1); + q[m] = (q1 * (unsigned)steps) >> (P + 1); } #endif if (q[m] >= steps) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegvideo.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegvideo.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mpegvideo.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mpegvideo.c 2014-04-23 09:55:21.000000000 +0000 @@ -1789,7 +1789,7 @@ return -1; } - if (!avctx->hwaccel) { + if (!avctx->hwaccel && !(avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)) { for(i=0; iheight; i++) memset(s->last_picture_ptr->f->data[0] + s->last_picture_ptr->f->linesize[0]*i, 0x80, avctx->width); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mvcdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mvcdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/mvcdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/mvcdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -25,6 +25,7 @@ */ #include "libavutil/intreadwrite.h" + #include "avcodec.h" #include "bytestream.h" #include "internal.h" @@ -37,8 +38,8 @@ static av_cold int mvc_decode_init(AVCodecContext *avctx) { MvcContext *s = avctx->priv_data; - int width = avctx->width; - int height = avctx->height; + int width = avctx->width; + int height = avctx->height; int ret; if (avctx->codec_id == AV_CODEC_ID_MVC1) { @@ -50,62 +51,60 @@ if ((ret = ff_set_dimensions(avctx, width, height)) < 0) return ret; - avctx->pix_fmt = (avctx->codec_id == AV_CODEC_ID_MVC1) ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_BGRA; - s->frame = av_frame_alloc(); + avctx->pix_fmt = (avctx->codec_id == AV_CODEC_ID_MVC1) ? AV_PIX_FMT_RGB555 + : AV_PIX_FMT_RGB32; + s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); - s->vflip = avctx->extradata_size >= 9 && !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9); + s->vflip = avctx->extradata_size >= 9 && + !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9); return 0; } -static int decode_mvc1(AVCodecContext *avctx, GetByteContext *gb, uint8_t *dst_start, int width, int height, int linesize) +static int decode_mvc1(AVCodecContext *avctx, GetByteContext *gb, + uint8_t *dst_start, int width, int height, int linesize) { uint8_t *dst; uint16_t v[8]; int mask, x, y, i; - x = y= 0; - while (bytestream2_get_bytes_left(gb) >= 6) { - mask = bytestream2_get_be16u(gb); - v[0] = bytestream2_get_be16u(gb); - v[1] = bytestream2_get_be16u(gb); - if ((v[0] & 0x8000)) { - if (bytestream2_get_bytes_left(gb) < 12) { - av_log(avctx, AV_LOG_WARNING, "buffer overflow\n"); - return AVERROR_INVALIDDATA; + for (y = 0; y < height; y += 4) { + for (x = 0; x < width; x += 4) { + if (bytestream2_get_bytes_left(gb) < 6) + return 0; + + mask = bytestream2_get_be16u(gb); + v[0] = bytestream2_get_be16u(gb); + v[1] = bytestream2_get_be16u(gb); + if ((v[0] & 0x8000)) { + if (bytestream2_get_bytes_left(gb) < 12) { + av_log(avctx, AV_LOG_WARNING, "buffer overflow\n"); + return AVERROR_INVALIDDATA; + } + for (i = 2; i < 8; i++) + v[i] = bytestream2_get_be16u(gb); + } else { + v[2] = v[4] = v[6] = v[0]; + v[3] = v[5] = v[7] = v[1]; } - for (i = 2; i < 8; i++) - v[i] = bytestream2_get_be16u(gb); - } else { - v[2] = v[4] = v[6] = v[0]; - v[3] = v[5] = v[7] = v[1]; - } -#define PIX16(target, true, false) \ - i = (mask & target) ? true : false; \ - AV_WN16A(dst, (v[i] & 0x7C00) | (v[i] & 0x3E0) | (v[i] & 0x1F)); \ - dst += 2; - -#define ROW16(row, a1, a0, b1, b0) \ - dst = dst_start + (y + row) * linesize + x * 2; \ - PIX16(1 << (row * 4), a1, a0) \ - PIX16(1 << (row * 4 + 1), a1, a0) \ - PIX16(1 << (row * 4 + 2), b1, b0) \ - PIX16(1 << (row * 4 + 3), b1, b0) - - ROW16(0, 0, 1, 2, 3); - ROW16(1, 0, 1, 2, 3); - ROW16(2, 4, 5, 6, 7); - ROW16(3, 4, 5, 6, 7); - - x += 4; - if (x >= width) { - y += 4; - if (y >= height) { - break; - } - x = 0; +#define PIX16(target, true, false) \ + i = (mask & target) ? true : false; \ + AV_WN16A(dst, v[i] & 0x7FFF); \ + dst += 2; + +#define ROW16(row, a1, a0, b1, b0) \ + dst = dst_start + (y + row) * linesize + x * 2; \ + PIX16(1 << (row * 4), a1, a0) \ + PIX16(1 << (row * 4 + 1), a1, a0) \ + PIX16(1 << (row * 4 + 2), b1, b0) \ + PIX16(1 << (row * 4 + 3), b1, b0) + + ROW16(0, 0, 1, 2, 3); + ROW16(1, 0, 1, 2, 3); + ROW16(2, 4, 5, 6, 7); + ROW16(3, 4, 5, 6, 7); } } return 0; @@ -119,24 +118,26 @@ AV_WN32A(dst + j * linesize + i * 4, pixel); } -#define PIX32(target, true, false) \ - AV_WN32A(dst, (mask & target) ? v[true] : v[false]); \ +#define PIX32(target, true, false) \ + AV_WN32A(dst, (mask & target) ? v[true] : v[false]); \ dst += 4; -#define ROW32(row, a1, a0, b1, b0) \ - dst = dst_start + (y + row) * linesize + x * 4; \ - PIX32(1 << (row * 4), a1, a0) \ - PIX32(1 << (row * 4 + 1), a1, a0) \ - PIX32(1 << (row * 4 + 2), b1, b0) \ +#define ROW32(row, a1, a0, b1, b0) \ + dst = dst_start + (y + row) * linesize + x * 4; \ + PIX32(1 << (row * 4), a1, a0) \ + PIX32(1 << (row * 4 + 1), a1, a0) \ + PIX32(1 << (row * 4 + 2), b1, b0) \ PIX32(1 << (row * 4 + 3), b1, b0) -#define MVC2_BLOCK \ - ROW32(0, 1, 0, 3, 2); \ - ROW32(1, 1, 0, 3, 2); \ - ROW32(2, 5, 4, 7, 6); \ +#define MVC2_BLOCK \ + ROW32(0, 1, 0, 3, 2); \ + ROW32(1, 1, 0, 3, 2); \ + ROW32(2, 5, 4, 7, 6); \ ROW32(3, 5, 4, 7, 6); -static int decode_mvc2(AVCodecContext *avctx, GetByteContext *gb, uint8_t *dst_start, int width, int height, int linesize, int vflip) +static int decode_mvc2(AVCodecContext *avctx, GetByteContext *gb, + uint8_t *dst_start, int width, int height, + int linesize, int vflip) { uint8_t *dst; uint32_t color[128], v[8]; @@ -165,7 +166,7 @@ if (vflip) { dst_start += (height - 1) * linesize; - linesize = -linesize; + linesize = -linesize; } x = y = 0; while (bytestream2_get_bytes_left(gb) >= 1) { @@ -173,17 +174,19 @@ if ((p0 & 0x80)) { if ((p0 & 0x40)) { p0 &= 0x3F; - p0 = (p0 << 2) | (p0 >> 4); - set_4x4_block(dst_start + y * linesize + x * 4, linesize, 0xFF000000 | (p0 << 16) | (p0 << 8) | p0); + p0 = (p0 << 2) | (p0 >> 4); + set_4x4_block(dst_start + y * linesize + x * 4, linesize, + 0xFF000000 | (p0 << 16) | (p0 << 8) | p0); } else { int g, r; p0 &= 0x3F; - p0 = (p0 << 2) | (p0 >> 4); + p0 = (p0 << 2) | (p0 >> 4); if (bytestream2_get_bytes_left(gb) < 2) return AVERROR_INVALIDDATA; g = bytestream2_get_byteu(gb); r = bytestream2_get_byteu(gb); - set_4x4_block(dst_start + y * linesize + x * 4, linesize, 0xFF000000 | (r << 16) | (g << 8) | p0); + set_4x4_block(dst_start + y * linesize + x * 4, linesize, + 0xFF000000 | (r << 16) | (g << 8) | p0); } } else { if (bytestream2_get_bytes_left(gb) < 1) @@ -191,7 +194,8 @@ p1 = bytestream2_get_byteu(gb); if ((p1 & 0x80)) { if ((p0 & 0x7F) == (p1 & 0x7F)) { - set_4x4_block(dst_start + y * linesize + x * 4, linesize, color[p0 & 0x7F]); + set_4x4_block(dst_start + y * linesize + x * 4, linesize, + color[p0 & 0x7F]); } else { if (bytestream2_get_bytes_left(gb) < 2) return AVERROR_INVALIDDATA; @@ -223,8 +227,7 @@ return 0; } -static int mvc_decode_frame(AVCodecContext *avctx, - void *data, int *got_frame, +static int mvc_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { MvcContext *s = avctx->priv_data; @@ -236,9 +239,12 @@ bytestream2_init(&gb, avpkt->data, avpkt->size); if (avctx->codec_id == AV_CODEC_ID_MVC1) - ret = decode_mvc1(avctx, &gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0]); + ret = decode_mvc1(avctx, &gb, s->frame->data[0], + avctx->width, avctx->height, s->frame->linesize[0]); else - ret = decode_mvc2(avctx, &gb, s->frame->data[0], avctx->width, avctx->height, s->frame->linesize[0], s->vflip); + ret = decode_mvc2(avctx, &gb, s->frame->data[0], + avctx->width, avctx->height, s->frame->linesize[0], + s->vflip); if (ret < 0) return ret; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/psymodel.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/psymodel.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/psymodel.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/psymodel.c 2014-04-23 09:55:21.000000000 +0000 @@ -35,10 +35,10 @@ int i, j, k = 0; ctx->avctx = avctx; - ctx->ch = av_mallocz(sizeof(ctx->ch[0]) * avctx->channels * 2); - ctx->group = av_mallocz(sizeof(ctx->group[0]) * num_groups); - ctx->bands = av_malloc (sizeof(ctx->bands[0]) * num_lens); - ctx->num_bands = av_malloc (sizeof(ctx->num_bands[0]) * num_lens); + ctx->ch = av_mallocz_array(sizeof(ctx->ch[0]), avctx->channels * 2); + ctx->group = av_mallocz_array(sizeof(ctx->group[0]), num_groups); + ctx->bands = av_malloc_array (sizeof(ctx->bands[0]), num_lens); + ctx->num_bands = av_malloc_array (sizeof(ctx->num_bands[0]), num_lens); memcpy(ctx->bands, bands, sizeof(ctx->bands[0]) * num_lens); memcpy(ctx->num_bands, num_bands, sizeof(ctx->num_bands[0]) * num_lens); @@ -112,7 +112,7 @@ FF_FILTER_MODE_LOWPASS, FILT_ORDER, cutoff_coeff, 0.0, 0.0); if (ctx->fcoeffs) { - ctx->fstate = av_mallocz(sizeof(ctx->fstate[0]) * avctx->channels); + ctx->fstate = av_mallocz_array(sizeof(ctx->fstate[0]), avctx->channels); for (i = 0; i < avctx->channels; i++) ctx->fstate[i] = ff_iir_filter_init_state(FILT_ORDER); } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/qtrleenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/qtrleenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/qtrleenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/qtrleenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -106,7 +106,7 @@ s->rlecode_table = av_mallocz(s->logical_width); s->skip_table = av_mallocz(s->logical_width); - s->length_table = av_mallocz((s->logical_width + 1)*sizeof(int)); + s->length_table = av_mallocz_array(s->logical_width + 1, sizeof(int)); if (!s->skip_table || !s->length_table || !s->rlecode_table) { av_log(avctx, AV_LOG_ERROR, "Error allocating memory.\n"); return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/ratecontrol.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/ratecontrol.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/ratecontrol.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/ratecontrol.c 2014-04-23 09:55:21.000000000 +0000 @@ -952,8 +952,8 @@ return -1; } - qscale = av_malloc(sizeof(double) * rcc->num_entries); - blurred_qscale = av_malloc(sizeof(double) * rcc->num_entries); + qscale = av_malloc_array(rcc->num_entries, sizeof(double)); + blurred_qscale = av_malloc_array(rcc->num_entries, sizeof(double)); toobig = 0; for (step = 256 * 256; step > 0.0000001; step *= 0.5) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/roqvideoenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/roqvideoenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/roqvideoenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/roqvideoenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -249,7 +249,7 @@ { int n=0, x, y, i; - tempData->cel_evals = av_malloc(enc->width*enc->height/64 * sizeof(CelEvaluation)); + tempData->cel_evals = av_malloc_array(enc->width*enc->height/64, sizeof(CelEvaluation)); /* Map to the ROQ quadtree order */ for (y=0; yheight; y+=16) @@ -799,11 +799,11 @@ int i, j, k; int c_size = size*size/4; int *buf; - int *codebook = av_malloc(6*c_size*cbsize*sizeof(int)); + int *codebook = av_malloc_array(6*c_size, cbsize*sizeof(int)); int *closest_cb; if (size == 4) - closest_cb = av_malloc(6*c_size*inputCount*sizeof(int)); + closest_cb = av_malloc_array(6*c_size, inputCount*sizeof(int)); else closest_cb = tempdata->closest_cb2; @@ -834,8 +834,8 @@ int max = enc->width*enc->height/16; uint8_t mb2[3*4]; roq_cell *results4 = av_malloc(sizeof(roq_cell)*MAX_CBS_4x4*4); - uint8_t *yuvClusters=av_malloc(sizeof(int)*max*6*4); - int *points = av_malloc(max*6*4*sizeof(int)); + uint8_t *yuvClusters=av_malloc_array(max, sizeof(int)*6*4); + int *points = av_malloc_array(max, 6*4*sizeof(int)); int bias; /* Subsample YUV data */ @@ -852,7 +852,7 @@ codebooks->numCB4 = (enc->quake3_compat ? MAX_CBS_4x4-1 : MAX_CBS_4x4); - tempData->closest_cb2 = av_malloc(max*4*sizeof(int)); + tempData->closest_cb2 = av_malloc_array(max, 4*sizeof(int)); /* Create 2x2 codebooks */ generate_codebook(enc, tempData, points, max*4, enc->cb2x2, 2, MAX_CBS_2x2); @@ -985,16 +985,16 @@ enc->tmpData = av_malloc(sizeof(RoqTempdata)); enc->this_motion4 = - av_mallocz((enc->width*enc->height/16)*sizeof(motion_vect)); + av_mallocz_array((enc->width*enc->height/16), sizeof(motion_vect)); enc->last_motion4 = - av_malloc ((enc->width*enc->height/16)*sizeof(motion_vect)); + av_malloc_array ((enc->width*enc->height/16), sizeof(motion_vect)); enc->this_motion8 = - av_mallocz((enc->width*enc->height/64)*sizeof(motion_vect)); + av_mallocz_array((enc->width*enc->height/64), sizeof(motion_vect)); enc->last_motion8 = - av_malloc ((enc->width*enc->height/64)*sizeof(motion_vect)); + av_malloc_array ((enc->width*enc->height/64), sizeof(motion_vect)); return 0; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/rv30data.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/rv30data.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/rv30data.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/rv30data.h 2014-04-23 09:55:21.000000000 +0000 @@ -58,7 +58,7 @@ * * This is really a three-dimensional matrix with dimensions * [-1..9][-1..9][0..9]. The first and second coordinates are - * detemined by the top and left neighbors (-1 if unavailable). + * determined by the top and left neighbors (-1 if unavailable). */ static const uint8_t rv30_itype_from_context[900] = { 0, 9, 9, 9, 9, 9, 9, 9, 9, diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/sgirledec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/sgirledec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/sgirledec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/sgirledec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1,5 +1,5 @@ /* - * SGI RLE 8-bit decoder + * Silicon Graphics RLE 8-bit video decoder * Copyright (c) 2012 Peter Ross * * This file is part of FFmpeg. @@ -21,9 +21,13 @@ /** * @file - * SGI RLE 8-bit decoder + * Silicon Graphics RLE 8-bit video decoder + * @note Data is packed in rbg323 with rle, contained in mv or mov. + * The algorithm and pixfmt are subtly different from SGI images. */ +#include "libavutil/common.h" + #include "avcodec.h" #include "internal.h" @@ -42,39 +46,44 @@ } /** - * Convert SGI RGB332 pixel into AV_PIX_FMT_BGR8 - * SGI RGB332 is packed RGB 3:3:2, 8bpp, (msb)3R 2B 3G(lsb) + * Convert SGI RBG323 pixel into AV_PIX_FMT_BGR8 + * SGI RGB data is packed as 8bpp, (msb)3R 2B 3G(lsb) */ -#define RGB332_TO_BGR8(x) (((x << 3) & 0xC0) | ((x << 3) & 0x38) | ((x >> 5) & 7)) - -static av_always_inline void memcpy_rgb332_to_bgr8(uint8_t *dst, const uint8_t *src, int size) +#define RBG323_TO_BGR8(x) (((x << 3) & 0xC0) | \ + ((x << 3) & 0x38) | \ + ((x >> 5) & 7)) +static av_always_inline +void rbg323_to_bgr8(uint8_t *dst, const uint8_t *src, int size) { int i; for (i = 0; i < size; i++) - dst[i] = RGB332_TO_BGR8(src[i]); + dst[i] = RBG323_TO_BGR8(src[i]); } /** * @param[out] dst Destination buffer - * @param[in] src Source buffer + * @param[in] src Source buffer * @param src_size Source buffer size (bytes) - * @param width Width of destination buffer (pixels) - * @param height Height of destination buffer (pixels) + * @param width Width of destination buffer (pixels) + * @param height Height of destination buffer (pixels) * @param linesize Line size of destination buffer (bytes) + * * @return <0 on error */ -static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, const uint8_t *src, int src_size, int width, int height, int linesize) +static int decode_sgirle8(AVCodecContext *avctx, uint8_t *dst, + const uint8_t *src, int src_size, + int width, int height, ptrdiff_t linesize) { const uint8_t *src_end = src + src_size; int x = 0, y = 0; -#define INC_XY(n) \ - x += n; \ - if (x >= width) { \ - y++; \ - if (y >= height) \ - return 0; \ - x = 0; \ +#define INC_XY(n) \ + x += n; \ + if (x >= width) { \ + y++; \ + if (y >= height) \ + return 0; \ + x = 0; \ } while (src_end - src >= 2) { @@ -84,9 +93,9 @@ int length = FFMIN(v, width - x); if (length <= 0) break; - memset(dst + y*linesize + x, RGB332_TO_BGR8(*src), length); + memset(dst + y * linesize + x, RBG323_TO_BGR8(*src), length); INC_XY(length); - v -= length; + v -= length; } while (v > 0); src++; } else if (v >= 0xC1) { @@ -95,7 +104,7 @@ int length = FFMIN3(v, width - x, src_end - src); if (src_end - src < length || length <= 0) break; - memcpy_rgb332_to_bgr8(dst + y*linesize + x, src, length); + rbg323_to_bgr8(dst + y * linesize + x, src, length); INC_XY(length); src += length; v -= length; @@ -108,9 +117,8 @@ return 0; } -static int sgirle_decode_frame(AVCodecContext *avctx, - void *data, int *got_frame, - AVPacket *avpkt) +static int sgirle_decode_frame(AVCodecContext *avctx, void *data, + int *got_frame, AVPacket *avpkt) { SGIRLEContext *s = avctx->priv_data; int ret; @@ -118,11 +126,12 @@ if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - ret = decode_sgirle8(avctx, s->frame->data[0], avpkt->data, avpkt->size, avctx->width, avctx->height, s->frame->linesize[0]); + ret = decode_sgirle8(avctx, s->frame->data[0], avpkt->data, avpkt->size, + avctx->width, avctx->height, s->frame->linesize[0]); if (ret < 0) return ret; - *got_frame = 1; + *got_frame = 1; if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; @@ -140,7 +149,7 @@ AVCodec ff_sgirle_decoder = { .name = "sgirle", - .long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"), + .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics RLE 8-bit video"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_SGIRLE, .priv_data_size = sizeof(SGIRLEContext), diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/smacker.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/smacker.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/smacker.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/smacker.c 2014-04-23 09:55:21.000000000 +0000 @@ -271,7 +271,7 @@ huff.length = ((size + 3) >> 2) + 4; huff.maxlength = 0; huff.current = 0; - huff.values = av_mallocz(huff.length * sizeof(int)); + huff.values = av_mallocz_array(huff.length, sizeof(int)); if (!huff.values) { err = AVERROR(ENOMEM); goto error; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/snow.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/snow.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/snow.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/snow.c 2014-04-23 09:55:21.000000000 +0000 @@ -88,7 +88,7 @@ s->b_height= h; av_free(s->block); - s->block= av_mallocz(w * h * sizeof(BlockNode) << (s->block_max_depth*2)); + s->block= av_mallocz_array(w * h, sizeof(BlockNode) << (s->block_max_depth*2)); if (!s->block) return AVERROR(ENOMEM); @@ -455,11 +455,11 @@ width= s->avctx->width; height= s->avctx->height; - FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail); - FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer, width * height * sizeof(DWTELEM), fail); //FIXME this does not belong here - FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer, width * sizeof(DWTELEM), fail); - FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer, width * sizeof(IDWTELEM), fail); - FF_ALLOC_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->spatial_idwt_buffer, width, height * sizeof(IDWTELEM), fail); + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->spatial_dwt_buffer, width, height * sizeof(DWTELEM), fail); //FIXME this does not belong here + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_dwt_buffer, width, sizeof(DWTELEM), fail); + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_idwt_buffer, width, sizeof(IDWTELEM), fail); + FF_ALLOC_ARRAY_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1), ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); for(i=0; iavctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256)*7*MB_SIZE, fail); + FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256), 7*MB_SIZE, fail); emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); } @@ -537,7 +537,7 @@ b->parent= &s->plane[plane_index].band[level-1][orientation]; //FIXME avoid this realloc av_freep(&b->x_coeff); - b->x_coeff=av_mallocz(((b->width+1) * b->height+1)*sizeof(x_and_coeff)); + b->x_coeff=av_mallocz_array(((b->width+1) * b->height+1), sizeof(x_and_coeff)); if (!b->x_coeff) goto fail; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff.c 2014-04-23 09:55:21.000000000 +0000 @@ -221,7 +221,7 @@ { switch(type) { case TIFF_DOUBLE: return ff_tadd_doubles_metadata(count, name, sep, &s->gb, s->le, avpriv_frame_get_metadatap(frame)); - case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, &s->gb, s->le, avpriv_frame_get_metadatap(frame)); + case TIFF_SHORT : return ff_tadd_shorts_metadata(count, name, sep, &s->gb, s->le, 0, avpriv_frame_get_metadatap(frame)); case TIFF_STRING: return ff_tadd_string_metadata(count, name, &s->gb, s->le, avpriv_frame_get_metadatap(frame)); default : return AVERROR_INVALIDDATA; }; @@ -838,7 +838,7 @@ s->geotag_count = 0; return -1; } - s->geotags = av_mallocz(sizeof(TiffGeoTag) * s->geotag_count); + s->geotags = av_mallocz_array(s->geotag_count, sizeof(TiffGeoTag)); if (!s->geotags) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); s->geotag_count = 0; @@ -860,7 +860,7 @@ return AVERROR_INVALIDDATA; if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t)) return AVERROR_INVALIDDATA; - dp = av_malloc(count * sizeof(double)); + dp = av_malloc_array(count, sizeof(double)); if (!dp) { av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n"); goto end; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff_common.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff_common.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff_common.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff_common.c 2014-04-23 09:55:21.000000000 +0000 @@ -176,7 +176,7 @@ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, - GetByteContext *gb, int le, AVDictionary **metadata) + GetByteContext *gb, int le, int is_signed, AVDictionary **metadata) { AVBPrint bp; char *ap; @@ -190,7 +190,8 @@ av_bprint_init(&bp, 10 * count, AV_BPRINT_SIZE_UNLIMITED); for (i = 0; i < count; i++) { - av_bprintf(&bp, "%s%5i", auto_sep(count, sep, i, 8), ff_tget_short(gb, le)); + int v = is_signed ? (int16_t)ff_tget_short(gb, le) : ff_tget_short(gb, le); + av_bprintf(&bp, "%s%5i", auto_sep(count, sep, i, 8), v); } if ((i = av_bprint_finalize(&bp, &ap))) { @@ -207,7 +208,7 @@ int ff_tadd_bytes_metadata(int count, const char *name, const char *sep, - GetByteContext *gb, int le, AVDictionary **metadata) + GetByteContext *gb, int le, int is_signed, AVDictionary **metadata) { AVBPrint bp; char *ap; @@ -221,7 +222,8 @@ av_bprint_init(&bp, 10 * count, AV_BPRINT_SIZE_UNLIMITED); for (i = 0; i < count; i++) { - av_bprintf(&bp, "%s%3i", auto_sep(count, sep, i, 16), bytestream2_get_byte(gb)); + int v = is_signed ? (int8_t)bytestream2_get_byte(gb) : bytestream2_get_byte(gb); + av_bprintf(&bp, "%s%3i", auto_sep(count, sep, i, 16), v); } if ((i = av_bprint_finalize(&bp, &ap))) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff_common.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff_common.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tiff_common.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tiff_common.h 2014-04-23 09:55:21.000000000 +0000 @@ -121,13 +121,13 @@ * into the metadata dictionary. */ int ff_tadd_shorts_metadata(int count, const char *name, const char *sep, - GetByteContext *gb, int le, AVDictionary **metadata); + GetByteContext *gb, int le, int is_signed, AVDictionary **metadata); /** Adds count bytes converted to a string * into the metadata dictionary. */ int ff_tadd_bytes_metadata(int count, const char *name, const char *sep, - GetByteContext *gb, int le, AVDictionary **metadata); + GetByteContext *gb, int le, int is_signed, AVDictionary **metadata); /** Adds a string of count characters * into the metadata dictionary. diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tta.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tta.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/tta.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/tta.c 2014-04-23 09:55:21.000000000 +0000 @@ -104,12 +104,12 @@ TTAContext *s = avctx->priv_data; if (s->bps < 3) { - s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); + s->decode_buffer = av_mallocz_array(sizeof(int32_t)*s->frame_length, s->channels); if (!s->decode_buffer) return AVERROR(ENOMEM); } else s->decode_buffer = NULL; - s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx)); + s->ch_ctx = av_malloc_array(avctx->channels, sizeof(*s->ch_ctx)); if (!s->ch_ctx) { av_freep(&s->decode_buffer); return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/utils.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/utils.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/utils.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/utils.c 2014-04-23 09:55:21.000000000 +0000 @@ -285,6 +285,7 @@ switch (s->pix_fmt) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUYV422: + case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_UYVY422: case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV440P: @@ -2675,22 +2676,25 @@ //This is for future deprecatec codec ids, its empty since //last major bump but will fill up again over time, please don't remove it // case AV_CODEC_ID_UTVIDEO_DEPRECATED: return AV_CODEC_ID_UTVIDEO; - case AV_CODEC_ID_BRENDER_PIX_DEPRECATED: return AV_CODEC_ID_BRENDER_PIX; - case AV_CODEC_ID_OPUS_DEPRECATED: return AV_CODEC_ID_OPUS; - case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK; - case AV_CODEC_ID_PAF_AUDIO_DEPRECATED : return AV_CODEC_ID_PAF_AUDIO; - case AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S24LE_PLANAR; - case AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S32LE_PLANAR; - case AV_CODEC_ID_ADPCM_VIMA_DEPRECATED : return AV_CODEC_ID_ADPCM_VIMA; - case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130; - case AV_CODEC_ID_EXR_DEPRECATED : return AV_CODEC_ID_EXR; - case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M; - case AV_CODEC_ID_PAF_VIDEO_DEPRECATED : return AV_CODEC_ID_PAF_VIDEO; - case AV_CODEC_ID_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP; - case AV_CODEC_ID_HEVC_DEPRECATED: return AV_CODEC_ID_HEVC; - case AV_CODEC_ID_SANM_DEPRECATED: return AV_CODEC_ID_SANM; - case AV_CODEC_ID_VP7_DEPRECATED : return AV_CODEC_ID_VP7; - default : return id; + case AV_CODEC_ID_BRENDER_PIX_DEPRECATED : return AV_CODEC_ID_BRENDER_PIX; + case AV_CODEC_ID_OPUS_DEPRECATED : return AV_CODEC_ID_OPUS; + case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK; + case AV_CODEC_ID_PAF_AUDIO_DEPRECATED : return AV_CODEC_ID_PAF_AUDIO; + case AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S24LE_PLANAR; + case AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S32LE_PLANAR; + case AV_CODEC_ID_ADPCM_VIMA_DEPRECATED : return AV_CODEC_ID_ADPCM_VIMA; + case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130; + case AV_CODEC_ID_EXR_DEPRECATED : return AV_CODEC_ID_EXR; + case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M; + case AV_CODEC_ID_PAF_VIDEO_DEPRECATED : return AV_CODEC_ID_PAF_VIDEO; + case AV_CODEC_ID_WEBP_DEPRECATED : return AV_CODEC_ID_WEBP; + case AV_CODEC_ID_HEVC_DEPRECATED : return AV_CODEC_ID_HEVC; + case AV_CODEC_ID_MVC1_DEPRECATED : return AV_CODEC_ID_MVC1; + case AV_CODEC_ID_MVC2_DEPRECATED : return AV_CODEC_ID_MVC2; + case AV_CODEC_ID_SANM_DEPRECATED : return AV_CODEC_ID_SANM; + case AV_CODEC_ID_SGIRLE_DEPRECATED : return AV_CODEC_ID_SGIRLE; + case AV_CODEC_ID_VP7_DEPRECATED : return AV_CODEC_ID_VP7; + default : return id; } } @@ -2994,6 +2998,10 @@ case AV_CODEC_ID_ADPCM_G722: case AV_CODEC_ID_ADPCM_YAMAHA: return 4; + case AV_CODEC_ID_DSD_LSBF: + case AV_CODEC_ID_DSD_MSBF: + case AV_CODEC_ID_DSD_LSBF_PLANAR: + case AV_CODEC_ID_DSD_MSBF_PLANAR: case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: case AV_CODEC_ID_PCM_S8: diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vble.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vble.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vble.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vble.c 2014-04-23 09:55:21.000000000 +0000 @@ -189,7 +189,7 @@ ctx->size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); - ctx->val = av_malloc(ctx->size * sizeof(*ctx->val)); + ctx->val = av_malloc_array(ctx->size, sizeof(*ctx->val)); if (!ctx->val) { av_log(avctx, AV_LOG_ERROR, "Could not allocate values buffer.\n"); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dec.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dec.c 2014-04-23 09:55:21.000000000 +0000 @@ -510,11 +510,7 @@ if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] , srcY , s->linesize, v->rnd); - v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8, srcY + 8, s->linesize, v->rnd); - srcY += s->linesize * 8; - v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize , srcY , s->linesize, v->rnd); - v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[0][dxy](s->dest[0] , srcY , s->linesize, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) @@ -728,9 +724,9 @@ if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); if (avg) - v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); else - v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); + v->vc1dsp.put_vc1_mspel_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) @@ -1913,9 +1909,10 @@ uvmx = (mx + ((mx & 3) == 3)) >> 1; uvmy = (my + ((my & 3) == 3)) >> 1; if (v->field_mode) { - if (v->cur_field_type != v->ref_field_type[1]) + if (v->cur_field_type != v->ref_field_type[1]) { my = my - 2 + 4 * v->cur_field_type; uvmy = uvmy - 2 + 4 * v->cur_field_type; + } } if (v->fastuvmc) { uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1)); @@ -2038,11 +2035,7 @@ if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); - v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); - v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd); - srcY += s->linesize * 8; - v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize , srcY , s->linesize, v->rnd); - v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd); + v->vc1dsp.avg_vc1_mspel_pixels_tab[0][dxy](s->dest[0] + off , srcY , s->linesize, v->rnd); } else { // hpel mc dxy = (my & 2) | ((mx & 2) >> 1); @@ -5853,7 +5846,7 @@ if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start_second_field = start; - tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); + tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1)); if (!tmp) goto err; slices = tmp; @@ -5878,7 +5871,7 @@ break; case VC1_CODE_SLICE: { int buf_size3; - tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); + tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1)); if (!tmp) goto err; slices = tmp; @@ -5907,7 +5900,7 @@ if (avctx->hwaccel || s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) buf_start_second_field = divider; - tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); + tmp = av_realloc_array(slices, sizeof(*slices), (n_slices+1)); if (!tmp) goto err; slices = tmp; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -643,6 +643,64 @@ src += stride; \ } \ }\ +static av_always_inline void OPNAME ## vc1_mspel_mc_16(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride, \ + int hmode, \ + int vmode, \ + int rnd) \ +{ \ + int i, j; \ + \ + if (vmode) { /* Horizontal filter to apply */ \ + int r; \ + \ + if (hmode) { /* Vertical filter to apply, output to tmp */ \ + static const int shift_value[] = { 0, 5, 1, 5 }; \ + int shift = (shift_value[hmode] + shift_value[vmode]) >> 1; \ + int16_t tmp[19 * 16], *tptr = tmp; \ + \ + r = (1 << (shift - 1)) + rnd - 1; \ + \ + src -= 1; \ + for (j = 0; j < 16; j++) { \ + for (i = 0; i < 19; i++) \ + tptr[i] = (vc1_mspel_ver_filter_16bits(src + i, stride, vmode) + r) >> shift; \ + src += stride; \ + tptr += 19; \ + } \ + \ + r = 64 - rnd; \ + tptr = tmp + 1; \ + for (j = 0; j < 16; j++) { \ + for (i = 0; i < 16; i++) \ + OP(dst[i], (vc1_mspel_hor_filter_16bits(tptr + i, 1, hmode) + r) >> 7); \ + dst += stride; \ + tptr += 19; \ + } \ + \ + return; \ + } else { /* No horizontal filter, output 8 lines to dst */ \ + r = 1 - rnd; \ + \ + for (j = 0; j < 16; j++) { \ + for (i = 0; i < 16; i++) \ + OP(dst[i], vc1_mspel_filter(src + i, stride, vmode, r)); \ + src += stride; \ + dst += stride; \ + } \ + return; \ + } \ + } \ + \ + /* Horizontal mode with no vertical mode */ \ + for (j = 0; j < 16; j++) { \ + for (i = 0; i < 16; i++) \ + OP(dst[i], vc1_mspel_filter(src + i, 1, hmode, rnd)); \ + dst += stride; \ + src += stride; \ + } \ +}\ static void OPNAME ## pixels8x8_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\ int i;\ for(i=0; i<8; i++){\ @@ -651,6 +709,17 @@ pixels+=line_size;\ block +=line_size;\ }\ +}\ +static void OPNAME ## pixels16x16_c(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int rnd){\ + int i;\ + for(i=0; i<16; i++){\ + OP4(*(uint32_t*)(block ), AV_RN32(pixels ));\ + OP4(*(uint32_t*)(block+ 4), AV_RN32(pixels+ 4));\ + OP4(*(uint32_t*)(block+ 8), AV_RN32(pixels+ 8));\ + OP4(*(uint32_t*)(block+12), AV_RN32(pixels+12));\ + pixels+=line_size;\ + block +=line_size;\ + }\ } #define op_put(a, b) a = av_clip_uint8(b) @@ -675,6 +744,18 @@ ptrdiff_t stride, int rnd) \ { \ avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \ +} \ +static void put_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride, int rnd) \ +{ \ + put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ +} \ +static void avg_vc1_mspel_mc ## a ## b ## _16_c(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride, int rnd) \ +{ \ + avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ } PUT_VC1_MSPEL(1, 0) @@ -878,6 +959,11 @@ } #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */ +#define FN_ASSIGN(X, Y) \ + dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = put_vc1_mspel_mc##X##Y##_c; \ + dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = put_vc1_mspel_mc##X##Y##_16_c; \ + dsp->avg_vc1_mspel_pixels_tab[1][X+4*Y] = avg_vc1_mspel_mc##X##Y##_c; \ + dsp->avg_vc1_mspel_pixels_tab[0][X+4*Y] = avg_vc1_mspel_mc##X##Y##_16_c av_cold void ff_vc1dsp_init(VC1DSPContext *dsp) { @@ -902,39 +988,28 @@ dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_c; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_c; - dsp->put_vc1_mspel_pixels_tab[0] = put_pixels8x8_c; - dsp->put_vc1_mspel_pixels_tab[1] = put_vc1_mspel_mc10_c; - dsp->put_vc1_mspel_pixels_tab[2] = put_vc1_mspel_mc20_c; - dsp->put_vc1_mspel_pixels_tab[3] = put_vc1_mspel_mc30_c; - dsp->put_vc1_mspel_pixels_tab[4] = put_vc1_mspel_mc01_c; - dsp->put_vc1_mspel_pixels_tab[5] = put_vc1_mspel_mc11_c; - dsp->put_vc1_mspel_pixels_tab[6] = put_vc1_mspel_mc21_c; - dsp->put_vc1_mspel_pixels_tab[7] = put_vc1_mspel_mc31_c; - dsp->put_vc1_mspel_pixels_tab[8] = put_vc1_mspel_mc02_c; - dsp->put_vc1_mspel_pixels_tab[9] = put_vc1_mspel_mc12_c; - dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_c; - dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_c; - dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_c; - dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_c; - dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_c; - dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_c; - - dsp->avg_vc1_mspel_pixels_tab[0] = avg_pixels8x8_c; - dsp->avg_vc1_mspel_pixels_tab[1] = avg_vc1_mspel_mc10_c; - dsp->avg_vc1_mspel_pixels_tab[2] = avg_vc1_mspel_mc20_c; - dsp->avg_vc1_mspel_pixels_tab[3] = avg_vc1_mspel_mc30_c; - dsp->avg_vc1_mspel_pixels_tab[4] = avg_vc1_mspel_mc01_c; - dsp->avg_vc1_mspel_pixels_tab[5] = avg_vc1_mspel_mc11_c; - dsp->avg_vc1_mspel_pixels_tab[6] = avg_vc1_mspel_mc21_c; - dsp->avg_vc1_mspel_pixels_tab[7] = avg_vc1_mspel_mc31_c; - dsp->avg_vc1_mspel_pixels_tab[8] = avg_vc1_mspel_mc02_c; - dsp->avg_vc1_mspel_pixels_tab[9] = avg_vc1_mspel_mc12_c; - dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_c; - dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_c; - dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_c; - dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_c; - dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_c; - dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_c; + dsp->put_vc1_mspel_pixels_tab[0][0] = put_pixels16x16_c; + dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_pixels16x16_c; + dsp->put_vc1_mspel_pixels_tab[1][0] = put_pixels8x8_c; + dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_pixels8x8_c; + FN_ASSIGN(0, 1); + FN_ASSIGN(0, 2); + FN_ASSIGN(0, 3); + + FN_ASSIGN(1, 0); + FN_ASSIGN(1, 1); + FN_ASSIGN(1, 2); + FN_ASSIGN(1, 3); + + FN_ASSIGN(2, 0); + FN_ASSIGN(2, 1); + FN_ASSIGN(2, 2); + FN_ASSIGN(2, 3); + + FN_ASSIGN(3, 0); + FN_ASSIGN(3, 1); + FN_ASSIGN(3, 2); + FN_ASSIGN(3, 3); dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = put_no_rnd_vc1_chroma_mc8_c; dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = avg_no_rnd_vc1_chroma_mc8_c; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dsp.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dsp.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vc1dsp.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vc1dsp.h 2014-04-23 09:55:21.000000000 +0000 @@ -57,8 +57,8 @@ /* put 8x8 block with bicubic interpolation and quarterpel precision * last argument is actually round value instead of height */ - vc1op_pixels_func put_vc1_mspel_pixels_tab[16]; - vc1op_pixels_func avg_vc1_mspel_pixels_tab[16]; + vc1op_pixels_func put_vc1_mspel_pixels_tab[2][16]; + vc1op_pixels_func avg_vc1_mspel_pixels_tab[2][16]; /* This is really one func used in VC-1 decoding */ h264_chroma_mc_func put_no_rnd_vc1_chroma_pixels_tab[3]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/version.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/version.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/version.h 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/version.h 2014-04-23 09:55:21.000000000 +0000 @@ -30,7 +30,7 @@ #define LIBAVCODEC_VERSION_MAJOR 55 #define LIBAVCODEC_VERSION_MINOR 58 -#define LIBAVCODEC_VERSION_MICRO 103 +#define LIBAVCODEC_VERSION_MICRO 105 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vorbisdsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vorbisdsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vorbisdsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vorbisdsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -25,6 +25,8 @@ { dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling; + if (ARCH_AARCH64) + ff_vorbisdsp_init_aarch64(dsp); if (ARCH_ARM) ff_vorbisdsp_init_arm(dsp); if (ARCH_PPC) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vorbisdsp.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vorbisdsp.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vorbisdsp.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vorbisdsp.h 2014-04-23 09:55:21.000000000 +0000 @@ -30,6 +30,7 @@ void ff_vorbisdsp_init(VorbisDSPContext *dsp); /* for internal use only */ +void ff_vorbisdsp_init_aarch64(VorbisDSPContext *dsp); void ff_vorbisdsp_init_x86(VorbisDSPContext *dsp); void ff_vorbisdsp_init_arm(VorbisDSPContext *dsp); void ff_vorbisdsp_init_ppc(VorbisDSPContext *dsp); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vp8.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vp8.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/vp8.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/vp8.h 2014-04-23 09:55:21.000000000 +0000 @@ -93,7 +93,7 @@ uint8_t chroma_pred_mode; uint8_t segment; uint8_t intra4x4_pred_mode_mb[16]; - uint8_t intra4x4_pred_mode_top[4]; + DECLARE_ALIGNED(4, uint8_t, intra4x4_pred_mode_top)[4]; VP56mv mv; VP56mv bmv[16]; } VP8Macroblock; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/webp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/webp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/webp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/webp.c 2014-04-23 09:55:21.000000000 +0000 @@ -309,7 +309,7 @@ if (max_code_length == 0 || max_code_length > MAX_HUFFMAN_CODE_LENGTH) return AVERROR(EINVAL); - codes = av_malloc(alphabet_size * sizeof(*codes)); + codes = av_malloc_array(alphabet_size, sizeof(*codes)); if (!codes) return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/wma.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/wma.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/wma.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/wma.c 2014-04-23 09:55:21.000000000 +0000 @@ -45,10 +45,10 @@ init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0); - run_table = av_malloc(n * sizeof(uint16_t)); - level_table = av_malloc(n * sizeof(uint16_t)); - flevel_table= av_malloc(n * sizeof(*flevel_table)); - int_table = av_malloc(n * sizeof(uint16_t)); + run_table = av_malloc_array(n, sizeof(uint16_t)); + level_table = av_malloc_array(n, sizeof(uint16_t)); + flevel_table= av_malloc_array(n, sizeof(*flevel_table)); + int_table = av_malloc_array(n, sizeof(uint16_t)); i = 2; level = 1; k = 0; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/cavsdsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/cavsdsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/cavsdsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/cavsdsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -211,10 +211,10 @@ ****************************************************************************/ /* vertical filter [-1 -2 96 42 -7 0] */ -#define QPEL_CAVSV1(A,B,C,D,E,F,OP,MUL2) \ +#define QPEL_CAVSV1(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \ "movd (%0), "#F" \n\t"\ "movq "#C", %%mm6 \n\t"\ - "pmullw %5, %%mm6 \n\t"\ + "pmullw "MANGLE(MUL1)", %%mm6\n\t"\ "movq "#D", %%mm7 \n\t"\ "pmullw "MANGLE(MUL2)", %%mm7\n\t"\ "psllw $3, "#E" \n\t"\ @@ -229,35 +229,35 @@ "psubw "#B", %%mm6 \n\t"\ "psraw $1, "#B" \n\t"\ "psubw "#A", %%mm6 \n\t"\ - "paddw %4, %%mm6 \n\t"\ + "paddw "MANGLE(ADD)", %%mm6 \n\t"\ "psraw $7, %%mm6 \n\t"\ "packuswb %%mm6, %%mm6 \n\t"\ OP(%%mm6, (%1), A, d) \ "add %3, %1 \n\t" /* vertical filter [ 0 -1 5 5 -1 0] */ -#define QPEL_CAVSV2(A,B,C,D,E,F,OP,MUL2) \ +#define QPEL_CAVSV2(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \ "movd (%0), "#F" \n\t"\ "movq "#C", %%mm6 \n\t"\ "paddw "#D", %%mm6 \n\t"\ - "pmullw %5, %%mm6 \n\t"\ + "pmullw "MANGLE(MUL1)", %%mm6\n\t"\ "add %2, %0 \n\t"\ "punpcklbw %%mm7, "#F" \n\t"\ "psubw "#B", %%mm6 \n\t"\ "psubw "#E", %%mm6 \n\t"\ - "paddw %4, %%mm6 \n\t"\ + "paddw "MANGLE(ADD)", %%mm6 \n\t"\ "psraw $3, %%mm6 \n\t"\ "packuswb %%mm6, %%mm6 \n\t"\ OP(%%mm6, (%1), A, d) \ "add %3, %1 \n\t" /* vertical filter [ 0 -7 42 96 -2 -1] */ -#define QPEL_CAVSV3(A,B,C,D,E,F,OP,MUL2) \ +#define QPEL_CAVSV3(A,B,C,D,E,F,OP,ADD, MUL1, MUL2) \ "movd (%0), "#F" \n\t"\ "movq "#C", %%mm6 \n\t"\ "pmullw "MANGLE(MUL2)", %%mm6\n\t"\ "movq "#D", %%mm7 \n\t"\ - "pmullw %5, %%mm7 \n\t"\ + "pmullw "MANGLE(MUL1)", %%mm7\n\t"\ "psllw $3, "#B" \n\t"\ "psubw "#B", %%mm6 \n\t"\ "psraw $3, "#B" \n\t"\ @@ -270,7 +270,7 @@ "psubw "#E", %%mm6 \n\t"\ "psraw $1, "#E" \n\t"\ "psubw "#F", %%mm6 \n\t"\ - "paddw %4, %%mm6 \n\t"\ + "paddw "MANGLE(ADD)", %%mm6 \n\t"\ "psraw $7, %%mm6 \n\t"\ "packuswb %%mm6, %%mm6 \n\t"\ OP(%%mm6, (%1), A, d) \ @@ -299,34 +299,34 @@ "punpcklbw %%mm7, %%mm2 \n\t"\ "punpcklbw %%mm7, %%mm3 \n\t"\ "punpcklbw %%mm7, %%mm4 \n\t"\ - VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\ - VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\ - VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\ - VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\ - VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\ - VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\ - VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\ - VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\ + VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\ + VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\ + VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\ + VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\ + VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, ADD, MUL1, MUL2)\ + VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, ADD, MUL1, MUL2)\ + VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\ + VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\ \ : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\ - NAMED_CONSTRAINTS_ADD(MUL2)\ + : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\ + NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\ : "memory"\ );\ if(h==16){\ __asm__ volatile(\ - VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\ - VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\ - VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, MUL2)\ - VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, MUL2)\ - VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, MUL2)\ - VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, MUL2)\ - VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, MUL2)\ - VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, MUL2)\ + VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\ + VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\ + VOP(%%mm4, %%mm5, %%mm0, %%mm1, %%mm2, %%mm3, OP, ADD, MUL1, MUL2)\ + VOP(%%mm5, %%mm0, %%mm1, %%mm2, %%mm3, %%mm4, OP, ADD, MUL1, MUL2)\ + VOP(%%mm0, %%mm1, %%mm2, %%mm3, %%mm4, %%mm5, OP, ADD, MUL1, MUL2)\ + VOP(%%mm1, %%mm2, %%mm3, %%mm4, %%mm5, %%mm0, OP, ADD, MUL1, MUL2)\ + VOP(%%mm2, %%mm3, %%mm4, %%mm5, %%mm0, %%mm1, OP, ADD, MUL1, MUL2)\ + VOP(%%mm3, %%mm4, %%mm5, %%mm0, %%mm1, %%mm2, OP, ADD, MUL1, MUL2)\ \ : "+a"(src), "+c"(dst)\ - : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride), "m"(ADD), "m"(MUL1)\ - NAMED_CONSTRAINTS_ADD(MUL2)\ + : "S"((x86_reg)srcStride), "r"((x86_reg)dstStride)\ + NAMED_CONSTRAINTS_ADD(ADD,MUL1,MUL2)\ : "memory"\ );\ }\ @@ -339,7 +339,7 @@ int h=8;\ __asm__ volatile(\ "pxor %%mm7, %%mm7 \n\t"\ - "movq %5, %%mm6 \n\t"\ + "movq "MANGLE(ff_pw_5)", %%mm6\n\t"\ "1: \n\t"\ "movq (%0), %%mm0 \n\t"\ "movq 1(%0), %%mm2 \n\t"\ @@ -365,7 +365,7 @@ "paddw %%mm3, %%mm5 \n\t"\ "psubw %%mm2, %%mm0 \n\t"\ "psubw %%mm5, %%mm1 \n\t"\ - "movq %6, %%mm5 \n\t"\ + "movq "MANGLE(ff_pw_4)", %%mm5\n\t"\ "paddw %%mm5, %%mm0 \n\t"\ "paddw %%mm5, %%mm1 \n\t"\ "psraw $3, %%mm0 \n\t"\ @@ -377,7 +377,8 @@ "decl %2 \n\t"\ " jnz 1b \n\t"\ : "+a"(src), "+c"(dst), "+m"(h)\ - : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride), "m"(ff_pw_5), "m"(ff_pw_4)\ + : "d"((x86_reg)srcStride), "S"((x86_reg)dstStride)\ + NAMED_CONSTRAINTS_ADD(ff_pw_4,ff_pw_5)\ : "memory"\ );\ }\ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/dsputil.asm ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/dsputil.asm --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/dsputil.asm 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/dsputil.asm 2014-04-23 09:55:21.000000000 +0000 @@ -50,14 +50,7 @@ paddd m2, m1 add orderq, mmsize*2 jl .loop -%if mmsize == 16 - movhlps m0, m2 - paddd m2, m0 - pshuflw m0, m2, 0x4e -%else - pshufw m0, m2, 0x4e -%endif - paddd m2, m0 + HADDD m2, m0 movd eax, m2 %if mmsize == 8 emms @@ -99,14 +92,7 @@ mova [v1q + orderq + mmsize], m3 add orderq, mmsize*2 jl .loop -%if mmsize == 16 - movhlps m0, m6 - paddd m6, m0 - pshuflw m0, m6, 0x4e -%else - pshufw m0, m6, 0x4e -%endif - paddd m6, m0 + HADDD m6, m0 movd eax, m6 RET %endmacro @@ -200,10 +186,7 @@ SCALARPRODUCT_LOOP 2 SCALARPRODUCT_LOOP 0 .end: - movhlps m0, m6 - paddd m6, m0 - pshuflw m0, m6, 0x4e - paddd m6, m0 + HADDD m6, m0 movd eax, m6 RET diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/h264_intrapred_10bit.asm ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/h264_intrapred_10bit.asm --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/h264_intrapred_10bit.asm 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/h264_intrapred_10bit.asm 2014-04-23 09:55:21.000000000 +0000 @@ -171,22 +171,6 @@ ;----------------------------------------------------------------------------- ; void ff_pred4x4_dc(pixel *src, const pixel *topright, int stride) ;----------------------------------------------------------------------------- -%macro HADDD 2 ; sum junk -%if mmsize == 16 - movhlps %2, %1 - paddd %1, %2 - pshuflw %2, %1, 0xE - paddd %1, %2 -%else - pshufw %2, %1, 0xE - paddd %1, %2 -%endif -%endmacro - -%macro HADDW 2 - pmaddwd %1, [pw_1] - HADDD %1, %2 -%endmacro INIT_MMX mmxext cglobal pred4x4_dc_10, 3, 3 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/idct_sse2_xvid.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/idct_sse2_xvid.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/idct_sse2_xvid.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/idct_sse2_xvid.c 2014-04-23 09:55:21.000000000 +0000 @@ -343,7 +343,7 @@ "movdqa %%xmm6, 4*16("dct") \n\t" \ "movdqa "SREG2", 7*16("dct") \n\t" -inline void ff_idct_xvid_sse2(short *block) +av_extern_inline void ff_idct_xvid_sse2(short *block) { __asm__ volatile( "movq "MANGLE(m127)", %%mm0 \n\t" diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mathops.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mathops.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mathops.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mathops.h 2014-04-23 09:55:21.000000000 +0000 @@ -24,6 +24,7 @@ #include "config.h" #include "libavutil/common.h" +#include "libavutil/x86/asm.h" #if HAVE_INLINE_ASM @@ -88,6 +89,7 @@ return i; } +#if HAVE_6REGS #define COPY3_IF_LT(x, y, a, b, c, d)\ __asm__ volatile(\ "cmpl %0, %3 \n\t"\ @@ -97,6 +99,7 @@ : "+&r" (x), "+&r" (a), "+r" (c)\ : "r" (y), "r" (b), "r" (d)\ ); +#endif /* HAVE_6REGS */ #endif /* HAVE_I686 */ #define MASK_ABS(mask, level) \ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mpegaudiodsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mpegaudiodsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mpegaudiodsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mpegaudiodsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -45,7 +45,7 @@ DECLARE_ALIGNED(16, static float, mdct_win_sse)[2][4][4*40]; -#if HAVE_SSE2_INLINE +#if HAVE_6REGS && HAVE_SSE2_INLINE #define MACS(rt, ra, rb) rt+=(ra)*(rb) #define MLSS(rt, ra, rb) rt-=(ra)*(rb) @@ -189,7 +189,7 @@ *out = sum; } -#endif /* HAVE_SSE2_INLINE */ +#endif /* HAVE_6REGS && HAVE_SSE2_INLINE */ #if HAVE_YASM #define DECL_IMDCT_BLOCKS(CPU1, CPU2) \ @@ -255,7 +255,7 @@ } } -#if HAVE_SSE2_INLINE +#if HAVE_6REGS && HAVE_SSE2_INLINE if (INLINE_SSE2(cpu_flags)) { s->apply_window_float = apply_window_mp3; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mpegvideoenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mpegvideoenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/mpegvideoenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/mpegvideoenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -30,6 +30,8 @@ /* not permutated inverse zigzag_direct + 1 for MMX quantizer */ DECLARE_ALIGNED(16, static uint16_t, inv_zigzag_direct16)[64]; +#if HAVE_6REGS + #if HAVE_MMX_INLINE #define COMPILE_TEMPLATE_MMXEXT 0 #define COMPILE_TEMPLATE_SSE2 0 @@ -81,6 +83,8 @@ #include "mpegvideoenc_template.c" #endif /* HAVE_SSSE3_INLINE */ +#endif /* HAVE_6REGS */ + #if HAVE_INLINE_ASM static void denoise_dct_mmx(MpegEncContext *s, int16_t *block){ const int intra= s->mb_intra; @@ -205,21 +209,25 @@ #if HAVE_MMX_INLINE int cpu_flags = av_get_cpu_flags(); if (INLINE_MMX(cpu_flags)) { +#if HAVE_6REGS s->dct_quantize = dct_quantize_MMX; +#endif s->denoise_dct = denoise_dct_mmx; } #endif -#if HAVE_MMXEXT_INLINE +#if HAVE_6REGS && HAVE_MMXEXT_INLINE if (INLINE_MMXEXT(cpu_flags)) s->dct_quantize = dct_quantize_MMXEXT; #endif #if HAVE_SSE2_INLINE if (INLINE_SSE2(cpu_flags)) { +#if HAVE_6REGS s->dct_quantize = dct_quantize_SSE2; +#endif s->denoise_dct = denoise_dct_sse2; } #endif -#if HAVE_SSSE3_INLINE +#if HAVE_6REGS && HAVE_SSSE3_INLINE if (INLINE_SSSE3(cpu_flags)) s->dct_quantize = dct_quantize_SSSE3; #endif diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/snowdsp.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/snowdsp.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/snowdsp.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/snowdsp.c 2014-04-23 09:55:21.000000000 +0000 @@ -606,6 +606,7 @@ } #endif //HAVE_7REGS +#if HAVE_6REGS #define snow_inner_add_yblock_sse2_header \ IDWTELEM * * dst_array = sb->line + src_y;\ x86_reg tmp;\ @@ -873,6 +874,7 @@ else ff_snow_inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8); } +#endif /* HAVE_6REGS */ #endif /* HAVE_INLINE_ASM */ @@ -887,7 +889,9 @@ #if HAVE_7REGS c->vertical_compose97i = ff_snow_vertical_compose97i_sse2; #endif +#if HAVE_6REGS c->inner_add_yblock = ff_snow_inner_add_yblock_sse2; +#endif } else{ if (mm_flags & AV_CPU_FLAG_MMXEXT) { @@ -896,7 +900,9 @@ c->vertical_compose97i = ff_snow_vertical_compose97i_mmx; #endif } +#if HAVE_6REGS c->inner_add_yblock = ff_snow_inner_add_yblock_mmx; +#endif } } #endif /* HAVE_INLINE_ASM */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vc1dsp_init.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vc1dsp_init.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vc1dsp_init.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vc1dsp_init.c 2014-04-23 09:55:21.000000000 +0000 @@ -27,6 +27,7 @@ #include "libavutil/attributes.h" #include "libavutil/cpu.h" #include "libavutil/x86/cpu.h" +#include "libavutil/x86/asm.h" #include "libavcodec/vc1dsp.h" #include "fpel.h" #include "vc1dsp.h" @@ -62,12 +63,17 @@ ff_vc1_h_loop_filter8_sse4(src, stride, pq); ff_vc1_h_loop_filter8_sse4(src+8*stride, stride, pq); } - static void avg_vc1_mspel_mc00_mmxext(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, int rnd) { ff_avg_pixels8_mmxext(dst, src, stride, 8); } +static void avg_vc1_mspel_mc00_16_sse2(uint8_t *dst, const uint8_t *src, + ptrdiff_t stride, int rnd) +{ + ff_avg_pixels16_sse2(dst, src, stride, 16); +} + #endif /* HAVE_YASM */ void ff_put_vc1_chroma_mc8_nornd_mmx (uint8_t *dst, uint8_t *src, @@ -86,10 +92,10 @@ { int cpu_flags = av_get_cpu_flags(); - if (INLINE_MMX(cpu_flags)) + if (HAVE_6REGS && INLINE_MMX(cpu_flags)) ff_vc1dsp_init_mmx(dsp); - if (INLINE_MMXEXT(cpu_flags)) + if (HAVE_6REGS && INLINE_MMXEXT(cpu_flags)) ff_vc1dsp_init_mmxext(dsp); #define ASSIGN_LF(EXT) \ @@ -111,13 +117,14 @@ ASSIGN_LF(mmxext); dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_nornd_mmxext; - dsp->avg_vc1_mspel_pixels_tab[0] = avg_vc1_mspel_mc00_mmxext; + dsp->avg_vc1_mspel_pixels_tab[1][0] = avg_vc1_mspel_mc00_mmxext; } if (EXTERNAL_SSE2(cpu_flags)) { dsp->vc1_v_loop_filter8 = ff_vc1_v_loop_filter8_sse2; dsp->vc1_h_loop_filter8 = ff_vc1_h_loop_filter8_sse2; dsp->vc1_v_loop_filter16 = vc1_v_loop_filter16_sse2; dsp->vc1_h_loop_filter16 = vc1_h_loop_filter16_sse2; + dsp->avg_vc1_mspel_pixels_tab[0][0] = avg_vc1_mspel_mc00_16_sse2; } if (EXTERNAL_SSSE3(cpu_flags)) { ASSIGN_LF(ssse3); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vc1dsp_mmx.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vc1dsp_mmx.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vc1dsp_mmx.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vc1dsp_mmx.c 2014-04-23 09:55:21.000000000 +0000 @@ -33,7 +33,7 @@ #include "fpel.h" #include "vc1dsp.h" -#if HAVE_INLINE_ASM +#if HAVE_6REGS && HAVE_INLINE_ASM #define OP_PUT(S,D) #define OP_AVG(S,D) "pavgb " #S ", " #D " \n\t" @@ -462,6 +462,15 @@ \ /* Horizontal mode with no vertical mode */\ vc1_put_shift_8bits[hmode](dst, src, stride, rnd, 1);\ +} \ +static void OP ## vc1_mspel_mc_16(uint8_t *dst, const uint8_t *src, \ + int stride, int hmode, int vmode, int rnd)\ +{ \ + OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \ + OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \ + dst += 8*stride; src += 8*stride; \ + OP ## vc1_mspel_mc(dst + 0, src + 0, stride, hmode, vmode, rnd); \ + OP ## vc1_mspel_mc(dst + 8, src + 8, stride, hmode, vmode, rnd); \ } VC1_MSPEL_MC(put_) @@ -482,6 +491,20 @@ int rnd) \ { \ avg_vc1_mspel_mc(dst, src, stride, a, b, rnd); \ +}\ +static void put_vc1_mspel_mc ## a ## b ## _16_mmx(uint8_t *dst, \ + const uint8_t *src, \ + ptrdiff_t stride, \ + int rnd) \ +{ \ + put_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ +}\ +static void avg_vc1_mspel_mc ## a ## b ## _16_mmxext(uint8_t *dst, \ + const uint8_t *src,\ + ptrdiff_t stride, \ + int rnd) \ +{ \ + avg_vc1_mspel_mc_16(dst, src, stride, a, b, rnd); \ } DECLARE_FUNCTION(0, 1) @@ -710,54 +733,75 @@ { ff_put_pixels8_mmx(dst, src, stride, 8); } +static void put_vc1_mspel_mc00_16_mmx(uint8_t *dst, const uint8_t *src, + ptrdiff_t stride, int rnd) +{ + ff_put_pixels16_mmx(dst, src, stride, 16); +} +static void avg_vc1_mspel_mc00_mmx(uint8_t *dst, const uint8_t *src, + ptrdiff_t stride, int rnd) +{ + ff_avg_pixels8_mmx(dst, src, stride, 8); +} +static void avg_vc1_mspel_mc00_16_mmx(uint8_t *dst, const uint8_t *src, + ptrdiff_t stride, int rnd) +{ + ff_avg_pixels16_mmx(dst, src, stride, 16); +} + +#define FN_ASSIGN(OP, X, Y, INSN) \ + dsp->OP##vc1_mspel_pixels_tab[1][X+4*Y] = OP##vc1_mspel_mc##X##Y##INSN; \ + dsp->OP##vc1_mspel_pixels_tab[0][X+4*Y] = OP##vc1_mspel_mc##X##Y##_16##INSN av_cold void ff_vc1dsp_init_mmx(VC1DSPContext *dsp) { - dsp->put_vc1_mspel_pixels_tab[ 0] = put_vc1_mspel_mc00_mmx; - dsp->put_vc1_mspel_pixels_tab[ 4] = put_vc1_mspel_mc01_mmx; - dsp->put_vc1_mspel_pixels_tab[ 8] = put_vc1_mspel_mc02_mmx; - dsp->put_vc1_mspel_pixels_tab[12] = put_vc1_mspel_mc03_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 1] = put_vc1_mspel_mc10_mmx; - dsp->put_vc1_mspel_pixels_tab[ 5] = put_vc1_mspel_mc11_mmx; - dsp->put_vc1_mspel_pixels_tab[ 9] = put_vc1_mspel_mc12_mmx; - dsp->put_vc1_mspel_pixels_tab[13] = put_vc1_mspel_mc13_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 2] = put_vc1_mspel_mc20_mmx; - dsp->put_vc1_mspel_pixels_tab[ 6] = put_vc1_mspel_mc21_mmx; - dsp->put_vc1_mspel_pixels_tab[10] = put_vc1_mspel_mc22_mmx; - dsp->put_vc1_mspel_pixels_tab[14] = put_vc1_mspel_mc23_mmx; - - dsp->put_vc1_mspel_pixels_tab[ 3] = put_vc1_mspel_mc30_mmx; - dsp->put_vc1_mspel_pixels_tab[ 7] = put_vc1_mspel_mc31_mmx; - dsp->put_vc1_mspel_pixels_tab[11] = put_vc1_mspel_mc32_mmx; - dsp->put_vc1_mspel_pixels_tab[15] = put_vc1_mspel_mc33_mmx; + FN_ASSIGN(put_, 0, 0, _mmx); + FN_ASSIGN(put_, 0, 1, _mmx); + FN_ASSIGN(put_, 0, 2, _mmx); + FN_ASSIGN(put_, 0, 3, _mmx); + + FN_ASSIGN(put_, 1, 0, _mmx); + FN_ASSIGN(put_, 1, 1, _mmx); + FN_ASSIGN(put_, 1, 2, _mmx); + FN_ASSIGN(put_, 1, 3, _mmx); + + FN_ASSIGN(put_, 2, 0, _mmx); + FN_ASSIGN(put_, 2, 1, _mmx); + FN_ASSIGN(put_, 2, 2, _mmx); + FN_ASSIGN(put_, 2, 3, _mmx); + + FN_ASSIGN(put_, 3, 0, _mmx); + FN_ASSIGN(put_, 3, 1, _mmx); + FN_ASSIGN(put_, 3, 2, _mmx); + FN_ASSIGN(put_, 3, 3, _mmx); + + FN_ASSIGN(avg_, 0, 0, _mmx); } av_cold void ff_vc1dsp_init_mmxext(VC1DSPContext *dsp) { - dsp->avg_vc1_mspel_pixels_tab[ 4] = avg_vc1_mspel_mc01_mmxext; - dsp->avg_vc1_mspel_pixels_tab[ 8] = avg_vc1_mspel_mc02_mmxext; - dsp->avg_vc1_mspel_pixels_tab[12] = avg_vc1_mspel_mc03_mmxext; - - dsp->avg_vc1_mspel_pixels_tab[ 1] = avg_vc1_mspel_mc10_mmxext; - dsp->avg_vc1_mspel_pixels_tab[ 5] = avg_vc1_mspel_mc11_mmxext; - dsp->avg_vc1_mspel_pixels_tab[ 9] = avg_vc1_mspel_mc12_mmxext; - dsp->avg_vc1_mspel_pixels_tab[13] = avg_vc1_mspel_mc13_mmxext; - - dsp->avg_vc1_mspel_pixels_tab[ 2] = avg_vc1_mspel_mc20_mmxext; - dsp->avg_vc1_mspel_pixels_tab[ 6] = avg_vc1_mspel_mc21_mmxext; - dsp->avg_vc1_mspel_pixels_tab[10] = avg_vc1_mspel_mc22_mmxext; - dsp->avg_vc1_mspel_pixels_tab[14] = avg_vc1_mspel_mc23_mmxext; - - dsp->avg_vc1_mspel_pixels_tab[ 3] = avg_vc1_mspel_mc30_mmxext; - dsp->avg_vc1_mspel_pixels_tab[ 7] = avg_vc1_mspel_mc31_mmxext; - dsp->avg_vc1_mspel_pixels_tab[11] = avg_vc1_mspel_mc32_mmxext; - dsp->avg_vc1_mspel_pixels_tab[15] = avg_vc1_mspel_mc33_mmxext; + FN_ASSIGN(avg_, 0, 1, _mmxext); + FN_ASSIGN(avg_, 0, 2, _mmxext); + FN_ASSIGN(avg_, 0, 3, _mmxext); + + FN_ASSIGN(avg_, 1, 0, _mmxext); + FN_ASSIGN(avg_, 1, 1, _mmxext); + FN_ASSIGN(avg_, 1, 2, _mmxext); + FN_ASSIGN(avg_, 1, 3, _mmxext); + + FN_ASSIGN(avg_, 2, 0, _mmxext); + FN_ASSIGN(avg_, 2, 1, _mmxext); + FN_ASSIGN(avg_, 2, 2, _mmxext); + FN_ASSIGN(avg_, 2, 3, _mmxext); + + FN_ASSIGN(avg_, 3, 0, _mmxext); + FN_ASSIGN(avg_, 3, 1, _mmxext); + FN_ASSIGN(avg_, 3, 2, _mmxext); + FN_ASSIGN(avg_, 3, 3, _mmxext); dsp->vc1_inv_trans_8x8_dc = vc1_inv_trans_8x8_dc_mmxext; dsp->vc1_inv_trans_4x8_dc = vc1_inv_trans_4x8_dc_mmxext; dsp->vc1_inv_trans_8x4_dc = vc1_inv_trans_8x4_dc_mmxext; dsp->vc1_inv_trans_4x4_dc = vc1_inv_trans_4x4_dc_mmxext; } -#endif /* HAVE_INLINE_ASM */ +#endif /* HAVE_6REGS && HAVE_INLINE_ASM */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp3dsp_init.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp3dsp_init.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp3dsp_init.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp3dsp_init.c 2014-04-23 09:55:21.000000000 +0000 @@ -63,6 +63,7 @@ "paddb "#regb", "#regr" \n\t" \ "paddb "#regd", "#regp" \n\t" +#if HAVE_6REGS static void put_vp_no_rnd_pixels8_l2_mmx(uint8_t *dst, const uint8_t *a, const uint8_t *b, ptrdiff_t stride, int h) { // START_TIMER @@ -94,15 +95,16 @@ :"memory"); // STOP_TIMER("put_vp_no_rnd_pixels8_l2_mmx") } +#endif /*HAVE_6REGS */ #endif /* HAVE_MMX_INLINE */ av_cold void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags) { int cpu_flags = av_get_cpu_flags(); -#if HAVE_MMX_INLINE +#if HAVE_6REGS && HAVE_MMX_INLINE c->put_no_rnd_pixels_l2 = put_vp_no_rnd_pixels8_l2_mmx; -#endif /* HAVE_MMX_INLINE */ +#endif /* HAVE_6REGS && HAVE_MMX_INLINE */ #if ARCH_X86_32 if (EXTERNAL_MMX(cpu_flags)) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp56_arith.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp56_arith.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp56_arith.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp56_arith.h 2014-04-23 09:55:21.000000000 +0000 @@ -24,7 +24,7 @@ #ifndef AVCODEC_X86_VP56_ARITH_H #define AVCODEC_X86_VP56_ARITH_H -#if HAVE_INLINE_ASM && HAVE_FAST_CMOV +#if HAVE_INLINE_ASM && HAVE_FAST_CMOV && HAVE_6REGS #define vp56_rac_get_prob vp56_rac_get_prob static av_always_inline int vp56_rac_get_prob(VP56RangeCoder *c, uint8_t prob) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp9lpf.asm ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp9lpf.asm --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavcodec/x86/vp9lpf.asm 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavcodec/x86/vp9lpf.asm 2014-04-23 09:55:21.000000000 +0000 @@ -88,24 +88,19 @@ punpck%2bw %3, %6, m0 paddw %1, %3 punpck%2bw %3, %7, m0 - paddw %1, %3 - mova %3, %1 - psraw %1, %8 + paddw %3, %1 + psraw %1, %3, %8 %endmacro -%macro FILTER_INIT 7-8 ; tmp1, tmp2, cacheL, cacheH, dstp, filterid, [source] +%macro FILTER_INIT 8 ; tmp1, tmp2, cacheL, cacheH, dstp, filterid, mask, source FILTER%6_INIT %1, l, %3 FILTER%6_INIT %2, h, %4 packuswb %1, %2 -%if %0 == 8 MASK_APPLY %1, %8, %7, %2 -%else - MASK_APPLY %1, %5, %7, %2 -%endif mova %5, %1 %endmacro -%macro FILTER_UPDATE 11-14 ; tmp1, tmp2, cacheL, cacheH, dstp, -, -, +, +, rshift, [source], [preload reg + value] +%macro FILTER_UPDATE 11-14 ; tmp1, tmp2, cacheL, cacheH, dstp, -, -, +, +, rshift, mask, [source], [preload reg + value] %if %0 == 13 ; no source + preload mova %12, %13 %elif %0 == 14 ; source + preload @@ -158,49 +153,45 @@ %endmacro %macro FILTER6_INIT 3 ; %1=dst %2=h/l %3=cache - punpck%2bw %3, m14, m0 ; p3: B->W - mova %1, %3 ; p3 - paddw %1, %3 ; p3*2 - paddw %1, %3 ; p3*3 - punpck%2bw %3, m15, m0 ; p2: B->W - paddw %1, %3 ; p3*3 + p2 - paddw %1, %3 ; p3*3 + p2*2 - punpck%2bw %3, m10, m0 ; p1: B->W - paddw %1, %3 ; p3*3 + p2*2 + p1 - punpck%2bw %3, m11, m0 ; p0: B->W - paddw %1, %3 ; p3*3 + p2*2 + p1 + p0 - punpck%2bw %3, m12, m0 ; q0: B->W - paddw %1, %3 ; p3*3 + p2*2 + p1 + p0 + q0 - paddw %1, [pw_4] ; p3*3 + p2*2 + p1 + p0 + q0 + 4 - mova %3, %1 ; base for next line (cache) - psraw %1, 3 ; (p3*3 + p2*2 + p1 + p0 + q0 + 4) >> 3 + punpck%2bw %1, m14, m0 ; p3: B->W + paddw %3, %1, %1 ; p3*2 + paddw %3, %1 ; p3*3 + punpck%2bw %1, m15, m0 ; p2: B->W + paddw %3, %1 ; p3*3 + p2 + paddw %3, %1 ; p3*3 + p2*2 + punpck%2bw %1, m10, m0 ; p1: B->W + paddw %3, %1 ; p3*3 + p2*2 + p1 + punpck%2bw %1, m11, m0 ; p0: B->W + paddw %3, %1 ; p3*3 + p2*2 + p1 + p0 + punpck%2bw %1, m12, m0 ; q0: B->W + paddw %3, %1 ; p3*3 + p2*2 + p1 + p0 + q0 + paddw %3, [pw_4] ; p3*3 + p2*2 + p1 + p0 + q0 + 4 + psraw %1, %3, 3 ; (p3*3 + p2*2 + p1 + p0 + q0 + 4) >> 3 %endmacro %macro FILTER14_INIT 3 ; %1=dst %2=h/l %3=cache punpck%2bw %1, m2, m0 ; p7: B->W - mova %3, %1 - psllw %1, 3 ; p7*8 - psubw %1, %3 ; p7*7 - punpck%2bw %3, m3, m0 ; p6: B->W - paddw %1, %3 ; p7*7 + p6 - paddw %1, %3 ; p7*7 + p6*2 - punpck%2bw %3, m8, m0 ; p5: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 - punpck%2bw %3, m9, m0 ; p4: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + p4 - punpck%2bw %3, m14, m0 ; p3: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + p4 + p3 - punpck%2bw %3, m15, m0 ; p2: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + .. + p2 - punpck%2bw %3, m10, m0 ; p1: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + .. + p1 - punpck%2bw %3, m11, m0 ; p0: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + .. + p0 - punpck%2bw %3, m12, m0 ; q0: B->W - paddw %1, %3 ; p7*7 + p6*2 + p5 + .. + p0 + q0 - paddw %1, [pw_8] ; p7*7 + p6*2 + p5 + .. + p0 + q0 + 8 - mova %3, %1 ; base for next line (cache) - psraw %1, 4 ; (p7*7 + p6*2 + p5 + .. + p0 + q0 + 8) >> 4 + psllw %3, %1, 3 ; p7*8 + psubw %3, %1 ; p7*7 + punpck%2bw %1, m3, m0 ; p6: B->W + paddw %3, %1 ; p7*7 + p6 + paddw %3, %1 ; p7*7 + p6*2 + punpck%2bw %1, m8, m0 ; p5: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + punpck%2bw %1, m9, m0 ; p4: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + p4 + punpck%2bw %1, m14, m0 ; p3: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + p4 + p3 + punpck%2bw %1, m15, m0 ; p2: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p2 + punpck%2bw %1, m10, m0 ; p1: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p1 + punpck%2bw %1, m11, m0 ; p0: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p0 + punpck%2bw %1, m12, m0 ; q0: B->W + paddw %3, %1 ; p7*7 + p6*2 + p5 + .. + p0 + q0 + paddw %3, [pw_8] ; p7*7 + p6*2 + p5 + .. + p0 + q0 + 8 + psraw %1, %3, 4 ; (p7*7 + p6*2 + p5 + .. + p0 + q0 + 8) >> 4 %endmacro %macro TRANSPOSE16x16B 17 @@ -305,7 +296,8 @@ %define Q7 dst2q + strideq + %1 %endmacro -%macro SPLATB_MASK 2 +; ..............AB -> AAAAAAAABBBBBBBB +%macro SPLATB_MIX 1-2 [mask_mix] %if cpuflag(ssse3) pshufb %1, %2 %else @@ -411,8 +403,8 @@ %endif movd m2, Id movd m3, Ed - SPLATB_MASK m2, m0 - SPLATB_MASK m3, m0 + SPLATB_MIX m2, m0 + SPLATB_MIX m3, m0 %endif mova m0, [pb_80] pxor m2, m0 @@ -427,6 +419,8 @@ mova m14, [Q2] mova m15, [Q3] %else + ; In case of horizontal, P3..Q3 are already present in some registers due + ; to the previous transpose, so we just swap registers. SWAP 8, 4, 12 SWAP 9, 5, 13 SWAP 10, 6, 14 @@ -471,7 +465,7 @@ SPLATB_REG m7, H, m0 ; H H H H ... %else movd m7, Hd - SPLATB_MASK m7, [mask_mix] + SPLATB_MIX m7 %endif pxor m7, m8 pxor m4, m8 @@ -494,7 +488,7 @@ %else mova m6, [pb_80] movd m7, Hd - SPLATB_MASK m7, [mask_mix] + SPLATB_MIX m7 pxor m7, m6 ABSSUB m4, m10, m11, m1 ; abs(p1 - p0) pxor m4, m6 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/avdevice.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/avdevice.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/avdevice.h 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/avdevice.h 2014-04-23 09:55:21.000000000 +0000 @@ -135,7 +135,7 @@ /** * Repaint request message. * - * Message is sent to the device when window have to be rapainted. + * Message is sent to the device when window has to be repainted. * * data: AVDeviceRect: area required to be repainted. * NULL: whole area is required to be repainted. @@ -154,6 +154,41 @@ AV_APP_TO_DEV_PAUSE = MKBETAG('P', 'A', 'U', ' '), AV_APP_TO_DEV_PLAY = MKBETAG('P', 'L', 'A', 'Y'), AV_APP_TO_DEV_TOGGLE_PAUSE = MKBETAG('P', 'A', 'U', 'T'), + + /** + * Volume control message. + * + * Set volume level. It may be device-dependent if volume + * is changed per stream or system wide. Per stream volume + * change is expected when possible. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_APP_TO_DEV_SET_VOLUME = MKBETAG('S', 'V', 'O', 'L'), + + /** + * Mute control messages. + * + * Change mute state. It may be device-dependent if mute status + * is changed per stream or system wide. Per stream mute status + * change is expected when possible. + * + * data: NULL. + */ + AV_APP_TO_DEV_MUTE = MKBETAG(' ', 'M', 'U', 'T'), + AV_APP_TO_DEV_UNMUTE = MKBETAG('U', 'M', 'U', 'T'), + AV_APP_TO_DEV_TOGGLE_MUTE = MKBETAG('T', 'M', 'U', 'T'), + + /** + * Get volume/mute messages. + * + * Force the device to send AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED or + * AV_DEV_TO_APP_MUTE_STATE_CHANGED command respectively. + * + * data: NULL. + */ + AV_APP_TO_DEV_GET_VOLUME = MKBETAG('G', 'V', 'O', 'L'), + AV_APP_TO_DEV_GET_MUTE = MKBETAG('G', 'M', 'U', 'T'), }; /** @@ -196,7 +231,7 @@ * Display window buffer message. * * Device requests to display a window buffer. - * Message is sent when new frame is ready to be displyed. + * Message is sent when new frame is ready to be displayed. * Usually buffers need to be swapped in handler of this message. * * data: NULL. @@ -237,6 +272,24 @@ */ AV_DEV_TO_APP_BUFFER_READABLE = MKBETAG('B','R','D',' '), AV_DEV_TO_APP_BUFFER_WRITABLE = MKBETAG('B','W','R',' '), + + /** + * Mute state change message. + * + * Device informs that mute state has changed. + * + * data: int: 0 for not muted state, non-zero for muted state. + */ + AV_DEV_TO_APP_MUTE_STATE_CHANGED = MKBETAG('C','M','U','T'), + + /** + * Volume level change message. + * + * Device informs that volume level has changed. + * + * data: double: new volume with range of 0.0 - 1.0. + */ + AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED = MKBETAG('C','V','O','L'), }; /** @@ -274,7 +327,7 @@ * Queried capabilities allows to set up converters of video or audio * parameters that fit to the device. * - * List of capablities that can be queried: + * List of capabilities that can be queried: * - Capabilities valid for both audio and video devices: * - codec: supported audio/video codecs. * type: AV_OPT_TYPE_INT (AVCodecID value) @@ -338,9 +391,9 @@ */ /** - * Structure describes device capabilites. + * Structure describes device capabilities. * - * It is used by devices in conjuntion with av_device_capabilities AVOption table + * It is used by devices in conjunction with av_device_capabilities AVOption table * to implement capabilities probing API based on AVOption API. Should not be used directly. */ typedef struct AVDeviceCapabilitiesQuery { @@ -360,7 +413,7 @@ } AVDeviceCapabilitiesQuery; /** - * AVOption table used by devices to implement device capabilites API. Should not be used by a user. + * AVOption table used by devices to implement device capabilities API. Should not be used by a user. */ extern const AVOption av_device_capabilities[]; @@ -425,7 +478,7 @@ int avdevice_list_devices(struct AVFormatContext *s, AVDeviceInfoList **device_list); /** - * Convinient function to free result of avdevice_list_devices(). + * Convenient function to free result of avdevice_list_devices(). * * @param devices device list to be freed. */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/opengl_enc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/opengl_enc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/opengl_enc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/opengl_enc.c 2014-04-23 09:55:21.000000000 +0000 @@ -30,6 +30,9 @@ #include "config.h" +#if HAVE_WINDOWS_H +#include +#endif #if HAVE_OPENGL_GL3_H #include #elif HAVE_ES2_GL_H @@ -41,9 +44,6 @@ #if HAVE_GLXGETPROCADDRESS #include #endif -#if HAVE_WINDOWS_H -#include -#endif #if HAVE_SDL #include diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_common.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_common.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_common.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_common.c 2014-04-23 09:55:21.000000000 +0000 @@ -24,6 +24,7 @@ #include "libavutil/attributes.h" #include "libavutil/avstring.h" #include "libavutil/mem.h" +#include "libavutil/avassert.h" pa_sample_format_t av_cold ff_codec_id_to_pulse_format(enum AVCodecID codec_id) { @@ -43,10 +44,10 @@ } } -enum PulseAudioLoopState { - PA_LOOP_INITIALIZING, - PA_LOOP_READY, - PA_LOOP_FINISHED +enum PulseAudioContextState { + PULSE_CONTEXT_INITIALIZING, + PULSE_CONTEXT_READY, + PULSE_CONTEXT_FINISHED }; typedef struct PulseAudioDeviceList { @@ -58,21 +59,79 @@ static void pa_state_cb(pa_context *c, void *userdata) { - enum PulseAudioLoopState *loop_status = userdata; + enum PulseAudioContextState *context_state = userdata; switch (pa_context_get_state(c)) { case PA_CONTEXT_FAILED: case PA_CONTEXT_TERMINATED: - *loop_status = PA_LOOP_FINISHED; + *context_state = PULSE_CONTEXT_FINISHED; break; case PA_CONTEXT_READY: - *loop_status = PA_LOOP_READY; + *context_state = PULSE_CONTEXT_READY; break; default: break; } } +void ff_pulse_audio_disconnect_context(pa_mainloop **pa_ml, pa_context **pa_ctx) +{ + av_assert0(pa_ml); + av_assert0(pa_ctx); + + if (*pa_ctx) { + pa_context_set_state_callback(*pa_ctx, NULL, NULL); + pa_context_disconnect(*pa_ctx); + pa_context_unref(*pa_ctx); + } + if (*pa_ml) + pa_mainloop_free(*pa_ml); + *pa_ml = NULL; + *pa_ctx = NULL; +} + +int ff_pulse_audio_connect_context(pa_mainloop **pa_ml, pa_context **pa_ctx, + const char *server, const char *description) +{ + int ret; + pa_mainloop_api *pa_mlapi = NULL; + enum PulseAudioContextState context_state = PULSE_CONTEXT_INITIALIZING; + + av_assert0(pa_ml); + av_assert0(pa_ctx); + + *pa_ml = NULL; + *pa_ctx = NULL; + + if (!(*pa_ml = pa_mainloop_new())) + return AVERROR(ENOMEM); + if (!(pa_mlapi = pa_mainloop_get_api(*pa_ml))) { + ret = AVERROR_EXTERNAL; + goto fail; + } + if (!(*pa_ctx = pa_context_new(pa_mlapi, description))) { + ret = AVERROR(ENOMEM); + goto fail; + } + pa_context_set_state_callback(*pa_ctx, pa_state_cb, &context_state); + if (pa_context_connect(*pa_ctx, server, 0, NULL) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + + while (context_state == PULSE_CONTEXT_INITIALIZING) + pa_mainloop_iterate(*pa_ml, 1, NULL); + if (context_state == PULSE_CONTEXT_FINISHED) { + ret = AVERROR_EXTERNAL; + goto fail; + } + return 0; + + fail: + ff_pulse_audio_disconnect_context(pa_ml, pa_ctx); + return ret; +} + static void pulse_add_detected_device(PulseAudioDeviceList *info, const char *name, const char *description) { @@ -138,11 +197,9 @@ int ff_pulse_audio_get_devices(AVDeviceInfoList *devices, const char *server, int output) { pa_mainloop *pa_ml = NULL; - pa_mainloop_api *pa_mlapi = NULL; pa_operation *pa_op = NULL; pa_context *pa_ctx = NULL; enum pa_operation_state op_state; - enum PulseAudioLoopState loop_state = PA_LOOP_INITIALIZING; PulseAudioDeviceList dev_list = { 0 }; int i; @@ -152,28 +209,9 @@ return AVERROR(EINVAL); devices->nb_devices = 0; devices->devices = NULL; - if (!(pa_ml = pa_mainloop_new())) - return AVERROR(ENOMEM); - if (!(pa_mlapi = pa_mainloop_get_api(pa_ml))) { - dev_list.error_code = AVERROR_EXTERNAL; - goto fail; - } - if (!(pa_ctx = pa_context_new(pa_mlapi, "Query devices"))) { - dev_list.error_code = AVERROR(ENOMEM); - goto fail; - } - pa_context_set_state_callback(pa_ctx, pa_state_cb, &loop_state); - if (pa_context_connect(pa_ctx, server, 0, NULL) < 0) { - dev_list.error_code = AVERROR_EXTERNAL; - goto fail; - } - while (loop_state == PA_LOOP_INITIALIZING) - pa_mainloop_iterate(pa_ml, 1, NULL); - if (loop_state == PA_LOOP_FINISHED) { - dev_list.error_code = AVERROR_EXTERNAL; + if ((dev_list.error_code = ff_pulse_audio_connect_context(&pa_ml, &pa_ctx, server, "Query devices")) < 0) goto fail; - } if (output) pa_op = pa_context_get_sink_info_list(pa_ctx, pulse_audio_sink_device_cb, &dev_list); @@ -206,11 +244,6 @@ fail: av_free(dev_list.default_device); - if(pa_ctx) - pa_context_disconnect(pa_ctx); - if (pa_ctx) - pa_context_unref(pa_ctx); - if (pa_ml) - pa_mainloop_free(pa_ml); + ff_pulse_audio_disconnect_context(&pa_ml, &pa_ctx); return dev_list.error_code; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_common.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_common.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_common.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_common.h 2014-04-23 09:55:21.000000000 +0000 @@ -30,4 +30,9 @@ int ff_pulse_audio_get_devices(AVDeviceInfoList *devices, const char *server, int output); +int ff_pulse_audio_connect_context(pa_mainloop **pa_ml, pa_context **pa_ctx, + const char *server, const char *description); + +void ff_pulse_audio_disconnect_context(pa_mainloop **pa_ml, pa_context **pa_ctx); + #endif /* AVDEVICE_PULSE_AUDIO_COMMON_H */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_enc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_enc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/pulse_audio_enc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/pulse_audio_enc.c 2014-04-23 09:55:21.000000000 +0000 @@ -18,13 +18,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#include +#include #include #include "libavformat/avformat.h" #include "libavformat/internal.h" #include "libavutil/opt.h" #include "libavutil/time.h" #include "libavutil/log.h" +#include "libavutil/attributes.h" #include "pulse_audio_common.h" typedef struct PulseData { @@ -33,20 +35,419 @@ const char *name; const char *stream_name; const char *device; - pa_simple *pa; int64_t timestamp; - int buffer_size; - int buffer_duration; + int buffer_size; /**< Buffer size in bytes */ + int buffer_duration; /**< Buffer size in ms, recalculated to buffer_size */ + int last_result; + pa_threaded_mainloop *mainloop; + pa_context *ctx; + pa_stream *stream; + int nonblocking; + int mute; + pa_volume_t base_volume; + pa_volume_t last_volume; } PulseData; +static void pulse_audio_sink_device_cb(pa_context *ctx, const pa_sink_info *dev, + int eol, void *userdata) +{ + PulseData *s = userdata; + + if (s->ctx != ctx) + return; + + if (eol) { + pa_threaded_mainloop_signal(s->mainloop, 0); + } else { + if (dev->flags & PA_SINK_FLAT_VOLUME) + s->base_volume = dev->base_volume; + else + s->base_volume = PA_VOLUME_NORM; + av_log(s, AV_LOG_DEBUG, "base volume: %u\n", s->base_volume); + } +} + +/* Mainloop must be locked before calling this function as it uses pa_threaded_mainloop_wait. */ +static int pulse_update_sink_info(AVFormatContext *h) +{ + PulseData *s = h->priv_data; + pa_operation *op; + if (!(op = pa_context_get_sink_info_by_name(s->ctx, s->device, + pulse_audio_sink_device_cb, s))) { + av_log(s, AV_LOG_ERROR, "pa_context_get_sink_info_by_name failed.\n"); + return AVERROR_EXTERNAL; + } + while (pa_operation_get_state(op) == PA_OPERATION_RUNNING) + pa_threaded_mainloop_wait(s->mainloop); + pa_operation_unref(op); + return 0; +} + +static void pulse_audio_sink_input_cb(pa_context *ctx, const pa_sink_input_info *i, + int eol, void *userdata) +{ + AVFormatContext *h = userdata; + PulseData *s = h->priv_data; + + if (s->ctx != ctx) + return; + + if (!eol) { + double val; + pa_volume_t vol = pa_cvolume_avg(&i->volume); + if (s->mute < 0 || (s->mute && !i->mute) || (!s->mute && i->mute)) { + s->mute = i->mute; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_MUTE_STATE_CHANGED, &s->mute, sizeof(s->mute)); + } + + vol = pa_sw_volume_divide(vol, s->base_volume); + if (s->last_volume != vol) { + val = (double)vol / PA_VOLUME_NORM; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_VOLUME_LEVEL_CHANGED, &val, sizeof(val)); + s->last_volume = vol; + } + } +} + +/* This function creates new loop so may be called from PA callbacks. + Mainloop must be locked before calling this function as it operates on streams. */ +static int pulse_update_sink_input_info(AVFormatContext *h) +{ + PulseData *s = h->priv_data; + pa_operation *op; + enum pa_operation_state op_state; + pa_mainloop *ml = NULL; + pa_context *ctx = NULL; + int ret = 0; + + if ((ret = ff_pulse_audio_connect_context(&ml, &ctx, s->server, "Update sink input information")) < 0) + return ret; + + if (!(op = pa_context_get_sink_input_info(ctx, pa_stream_get_index(s->stream), + pulse_audio_sink_input_cb, h))) { + ret = AVERROR_EXTERNAL; + goto fail; + } + + while ((op_state = pa_operation_get_state(op)) == PA_OPERATION_RUNNING) + pa_mainloop_iterate(ml, 1, NULL); + pa_operation_unref(op); + if (op_state != PA_OPERATION_DONE) { + ret = AVERROR_EXTERNAL; + goto fail; + } + + fail: + ff_pulse_audio_disconnect_context(&ml, &ctx); + if (ret) + av_log(s, AV_LOG_ERROR, "pa_context_get_sink_input_info failed.\n"); + return ret; +} + +static void pulse_event(pa_context *ctx, pa_subscription_event_type_t t, + uint32_t idx, void *userdata) +{ + AVFormatContext *h = userdata; + PulseData *s = h->priv_data; + + if (s->ctx != ctx) + return; + + if ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SINK_INPUT) { + if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_CHANGE) + // Calling from mainloop callback. No need to lock mainloop. + pulse_update_sink_input_info(h); + } +} + +static void pulse_stream_writable(pa_stream *stream, size_t nbytes, void *userdata) +{ + AVFormatContext *h = userdata; + PulseData *s = h->priv_data; + int64_t val = nbytes; + + if (stream != s->stream) + return; + + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_WRITABLE, &val, sizeof(val)); + pa_threaded_mainloop_signal(s->mainloop, 0); +} + +static void pulse_overflow(pa_stream *stream, void *userdata) +{ + AVFormatContext *h = userdata; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_OVERFLOW, NULL, 0); +} + +static void pulse_underflow(pa_stream *stream, void *userdata) +{ + AVFormatContext *h = userdata; + avdevice_dev_to_app_control_message(h, AV_DEV_TO_APP_BUFFER_UNDERFLOW, NULL, 0); +} + +static void pulse_stream_state(pa_stream *stream, void *userdata) +{ + PulseData *s = userdata; + + if (stream != s->stream) + return; + + switch (pa_stream_get_state(s->stream)) { + case PA_STREAM_READY: + case PA_STREAM_FAILED: + case PA_STREAM_TERMINATED: + pa_threaded_mainloop_signal(s->mainloop, 0); + default: + break; + } +} + +static int pulse_stream_wait(PulseData *s) +{ + pa_stream_state_t state; + + while ((state = pa_stream_get_state(s->stream)) != PA_STREAM_READY) { + if (state == PA_STREAM_FAILED || state == PA_STREAM_TERMINATED) + return AVERROR_EXTERNAL; + pa_threaded_mainloop_wait(s->mainloop); + } + return 0; +} + +static void pulse_context_state(pa_context *ctx, void *userdata) +{ + PulseData *s = userdata; + + if (s->ctx != ctx) + return; + + switch (pa_context_get_state(ctx)) { + case PA_CONTEXT_READY: + case PA_CONTEXT_FAILED: + case PA_CONTEXT_TERMINATED: + pa_threaded_mainloop_signal(s->mainloop, 0); + default: + break; + } +} + +static int pulse_context_wait(PulseData *s) +{ + pa_context_state_t state; + + while ((state = pa_context_get_state(s->ctx)) != PA_CONTEXT_READY) { + if (state == PA_CONTEXT_FAILED || state == PA_CONTEXT_TERMINATED) + return AVERROR_EXTERNAL; + pa_threaded_mainloop_wait(s->mainloop); + } + return 0; +} + +static void pulse_stream_result(pa_stream *stream, int success, void *userdata) +{ + PulseData *s = userdata; + + if (stream != s->stream) + return; + + s->last_result = success ? 0 : AVERROR_EXTERNAL; + pa_threaded_mainloop_signal(s->mainloop, 0); +} + +static int pulse_finish_stream_operation(PulseData *s, pa_operation *op, const char *name) +{ + if (!op) { + pa_threaded_mainloop_unlock(s->mainloop); + av_log(s, AV_LOG_ERROR, "%s failed.\n", name); + return AVERROR_EXTERNAL; + } + s->last_result = 2; + while (s->last_result == 2) + pa_threaded_mainloop_wait(s->mainloop); + pa_operation_unref(op); + pa_threaded_mainloop_unlock(s->mainloop); + if (s->last_result != 0) + av_log(s, AV_LOG_ERROR, "%s failed.\n", name); + return s->last_result; +} + +static int pulse_set_pause(PulseData *s, int pause) +{ + pa_operation *op; + pa_threaded_mainloop_lock(s->mainloop); + op = pa_stream_cork(s->stream, pause, pulse_stream_result, s); + return pulse_finish_stream_operation(s, op, "pa_stream_cork"); +} + +static int pulse_flash_stream(PulseData *s) +{ + pa_operation *op; + pa_threaded_mainloop_lock(s->mainloop); + op = pa_stream_flush(s->stream, pulse_stream_result, s); + return pulse_finish_stream_operation(s, op, "pa_stream_flush"); +} + +static void pulse_context_result(pa_context *ctx, int success, void *userdata) +{ + PulseData *s = userdata; + + if (s->ctx != ctx) + return; + + s->last_result = success ? 0 : AVERROR_EXTERNAL; + pa_threaded_mainloop_signal(s->mainloop, 0); +} + +static int pulse_finish_context_operation(PulseData *s, pa_operation *op, const char *name) +{ + if (!op) { + pa_threaded_mainloop_unlock(s->mainloop); + av_log(s, AV_LOG_ERROR, "%s failed.\n", name); + return AVERROR_EXTERNAL; + } + s->last_result = 2; + while (s->last_result == 2) + pa_threaded_mainloop_wait(s->mainloop); + pa_operation_unref(op); + pa_threaded_mainloop_unlock(s->mainloop); + if (s->last_result != 0) + av_log(s, AV_LOG_ERROR, "%s failed.\n", name); + return s->last_result; +} + +static int pulse_set_mute(PulseData *s) +{ + pa_operation *op; + pa_threaded_mainloop_lock(s->mainloop); + op = pa_context_set_sink_input_mute(s->ctx, pa_stream_get_index(s->stream), + s->mute, pulse_context_result, s); + return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_mute"); +} + +static int pulse_set_volume(PulseData *s, double volume) +{ + pa_operation *op; + pa_cvolume cvol; + pa_volume_t vol; + const pa_sample_spec *ss = pa_stream_get_sample_spec(s->stream); + + vol = pa_sw_volume_multiply(lround(volume * PA_VOLUME_NORM), s->base_volume); + pa_cvolume_set(&cvol, ss->channels, PA_VOLUME_NORM); + pa_sw_cvolume_multiply_scalar(&cvol, &cvol, vol); + pa_threaded_mainloop_lock(s->mainloop); + op = pa_context_set_sink_input_volume(s->ctx, pa_stream_get_index(s->stream), + &cvol, pulse_context_result, s); + return pulse_finish_context_operation(s, op, "pa_context_set_sink_input_volume"); +} + +static int pulse_subscribe_events(PulseData *s) +{ + pa_operation *op; + + pa_threaded_mainloop_lock(s->mainloop); + op = pa_context_subscribe(s->ctx, PA_SUBSCRIPTION_MASK_SINK_INPUT, pulse_context_result, s); + return pulse_finish_context_operation(s, op, "pa_context_subscribe"); +} + +static void pulse_map_channels_to_pulse(int64_t channel_layout, pa_channel_map *channel_map) +{ + channel_map->channels = 0; + if (channel_layout & AV_CH_FRONT_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_LEFT; + if (channel_layout & AV_CH_FRONT_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_RIGHT; + if (channel_layout & AV_CH_FRONT_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_CENTER; + if (channel_layout & AV_CH_LOW_FREQUENCY) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_LFE; + if (channel_layout & AV_CH_BACK_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_REAR_LEFT; + if (channel_layout & AV_CH_BACK_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_REAR_RIGHT; + if (channel_layout & AV_CH_FRONT_LEFT_OF_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER; + if (channel_layout & AV_CH_FRONT_RIGHT_OF_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER; + if (channel_layout & AV_CH_BACK_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_REAR_CENTER; + if (channel_layout & AV_CH_SIDE_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_SIDE_LEFT; + if (channel_layout & AV_CH_SIDE_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_SIDE_RIGHT; + if (channel_layout & AV_CH_TOP_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_CENTER; + if (channel_layout & AV_CH_TOP_FRONT_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_FRONT_LEFT; + if (channel_layout & AV_CH_TOP_FRONT_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_FRONT_CENTER; + if (channel_layout & AV_CH_TOP_FRONT_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_FRONT_RIGHT; + if (channel_layout & AV_CH_TOP_BACK_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_REAR_LEFT; + if (channel_layout & AV_CH_TOP_BACK_CENTER) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_REAR_CENTER; + if (channel_layout & AV_CH_TOP_BACK_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_TOP_REAR_RIGHT; + if (channel_layout & AV_CH_STEREO_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_LEFT; + if (channel_layout & AV_CH_STEREO_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_FRONT_RIGHT; + if (channel_layout & AV_CH_WIDE_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_AUX0; + if (channel_layout & AV_CH_WIDE_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_AUX1; + if (channel_layout & AV_CH_SURROUND_DIRECT_LEFT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_AUX2; + if (channel_layout & AV_CH_SURROUND_DIRECT_RIGHT) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_AUX3; + if (channel_layout & AV_CH_LOW_FREQUENCY_2) + channel_map->map[channel_map->channels++] = PA_CHANNEL_POSITION_LFE; +} + +static av_cold int pulse_write_trailer(AVFormatContext *h) +{ + PulseData *s = h->priv_data; + + if (s->mainloop) { + pa_threaded_mainloop_lock(s->mainloop); + if (s->stream) { + pa_stream_disconnect(s->stream); + pa_stream_set_state_callback(s->stream, NULL, NULL); + pa_stream_set_write_callback(s->stream, NULL, NULL); + pa_stream_set_overflow_callback(s->stream, NULL, NULL); + pa_stream_set_underflow_callback(s->stream, NULL, NULL); + pa_stream_unref(s->stream); + s->stream = NULL; + } + if (s->ctx) { + pa_context_disconnect(s->ctx); + pa_context_set_state_callback(s->ctx, NULL, NULL); + pa_context_set_subscribe_callback(s->ctx, NULL, NULL); + pa_context_unref(s->ctx); + s->ctx = NULL; + } + pa_threaded_mainloop_unlock(s->mainloop); + pa_threaded_mainloop_stop(s->mainloop); + pa_threaded_mainloop_free(s->mainloop); + s->mainloop = NULL; + } + + return 0; +} + static av_cold int pulse_write_header(AVFormatContext *h) { PulseData *s = h->priv_data; AVStream *st = NULL; int ret; - pa_sample_spec ss; - pa_buffer_attr attr = { -1, -1, -1, -1, -1 }; + pa_sample_spec sample_spec; + pa_buffer_attr buffer_attributes = { -1, -1, -1, -1, -1 }; + pa_channel_map channel_map; + pa_mainloop_api *mainloop_api; const char *stream_name = s->stream_name; + static const pa_stream_flags_t stream_flags = PA_STREAM_INTERPOLATE_TIMING | + PA_STREAM_AUTO_TIMING_UPDATE | + PA_STREAM_NOT_MONOTONIC; if (h->nb_streams != 1 || h->streams[0]->codec->codec_type != AVMEDIA_TYPE_AUDIO) { av_log(s, AV_LOG_ERROR, "Only a single audio stream is supported.\n"); @@ -60,65 +461,158 @@ else stream_name = "Playback"; } + s->nonblocking = (h->flags & AVFMT_FLAG_NONBLOCK); if (s->buffer_duration) { int64_t bytes = s->buffer_duration; bytes *= st->codec->channels * st->codec->sample_rate * av_get_bytes_per_sample(st->codec->sample_fmt); bytes /= 1000; - attr.tlength = FFMAX(s->buffer_size, av_clip64(bytes, 0, UINT32_MAX - 1)); + buffer_attributes.tlength = FFMAX(s->buffer_size, av_clip64(bytes, 0, UINT32_MAX - 1)); av_log(s, AV_LOG_DEBUG, "Buffer duration: %ums recalculated into %"PRId64" bytes buffer.\n", s->buffer_duration, bytes); - av_log(s, AV_LOG_DEBUG, "Real buffer length is %u bytes\n", attr.tlength); + av_log(s, AV_LOG_DEBUG, "Real buffer length is %u bytes\n", buffer_attributes.tlength); } else if (s->buffer_size) - attr.tlength = s->buffer_size; + buffer_attributes.tlength = s->buffer_size; - ss.format = ff_codec_id_to_pulse_format(st->codec->codec_id); - ss.rate = st->codec->sample_rate; - ss.channels = st->codec->channels; - - s->pa = pa_simple_new(s->server, // Server - s->name, // Application name - PA_STREAM_PLAYBACK, - s->device, // Device - stream_name, // Description of a stream - &ss, // Sample format - NULL, // Use default channel map - &attr, // Buffering attributes - &ret); // Result - - if (!s->pa) { - av_log(s, AV_LOG_ERROR, "pa_simple_new failed: %s\n", pa_strerror(ret)); - return AVERROR(EIO); + sample_spec.format = ff_codec_id_to_pulse_format(st->codec->codec_id); + sample_spec.rate = st->codec->sample_rate; + sample_spec.channels = st->codec->channels; + if (!pa_sample_spec_valid(&sample_spec)) { + av_log(s, AV_LOG_ERROR, "Invalid sample spec.\n"); + return AVERROR(EINVAL); } - avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ + if (sample_spec.channels == 1) { + channel_map.channels = 1; + channel_map.map[0] = PA_CHANNEL_POSITION_MONO; + } else if (st->codec->channel_layout) { + if (av_get_channel_layout_nb_channels(st->codec->channel_layout) != st->codec->channels) + return AVERROR(EINVAL); + pulse_map_channels_to_pulse(st->codec->channel_layout, &channel_map); + /* Unknown channel is present in channel_layout, let PulseAudio use its default. */ + if (channel_map.channels != sample_spec.channels) { + av_log(s, AV_LOG_WARNING, "Unknown channel. Using defaul channel map.\n"); + channel_map.channels = 0; + } + } else + channel_map.channels = 0; - return 0; -} + if (!channel_map.channels) + av_log(s, AV_LOG_WARNING, "Using PulseAudio's default channel map.\n"); + else if (!pa_channel_map_valid(&channel_map)) { + av_log(s, AV_LOG_ERROR, "Invalid channel map.\n"); + return AVERROR(EINVAL); + } + + /* start main loop */ + s->mainloop = pa_threaded_mainloop_new(); + if (!s->mainloop) { + av_log(s, AV_LOG_ERROR, "Cannot create threaded mainloop.\n"); + return AVERROR(ENOMEM); + } + if ((ret = pa_threaded_mainloop_start(s->mainloop)) < 0) { + av_log(s, AV_LOG_ERROR, "Cannot start threaded mainloop: %s.\n", pa_strerror(ret)); + pa_threaded_mainloop_free(s->mainloop); + s->mainloop = NULL; + return AVERROR_EXTERNAL; + } + + pa_threaded_mainloop_lock(s->mainloop); + + mainloop_api = pa_threaded_mainloop_get_api(s->mainloop); + if (!mainloop_api) { + av_log(s, AV_LOG_ERROR, "Cannot get mainloop API.\n"); + ret = AVERROR_EXTERNAL; + goto fail; + } + + s->ctx = pa_context_new(mainloop_api, s->name); + if (!s->ctx) { + av_log(s, AV_LOG_ERROR, "Cannot create context.\n"); + ret = AVERROR(ENOMEM); + goto fail; + } + pa_context_set_state_callback(s->ctx, pulse_context_state, s); + pa_context_set_subscribe_callback(s->ctx, pulse_event, h); + + if ((ret = pa_context_connect(s->ctx, s->server, 0, NULL)) < 0) { + av_log(s, AV_LOG_ERROR, "Cannot connect context: %s.\n", pa_strerror(ret)); + ret = AVERROR_EXTERNAL; + goto fail; + } + + if ((ret = pulse_context_wait(s)) < 0) { + av_log(s, AV_LOG_ERROR, "Context failed.\n"); + goto fail; + } + + s->stream = pa_stream_new(s->ctx, stream_name, &sample_spec, + channel_map.channels ? &channel_map : NULL); + + if ((ret = pulse_update_sink_info(h)) < 0) { + av_log(s, AV_LOG_ERROR, "Updating sink info failed.\n"); + goto fail; + } + + if (!s->stream) { + av_log(s, AV_LOG_ERROR, "Cannot create stream.\n"); + ret = AVERROR(ENOMEM); + goto fail; + } + pa_stream_set_state_callback(s->stream, pulse_stream_state, s); + pa_stream_set_write_callback(s->stream, pulse_stream_writable, h); + pa_stream_set_overflow_callback(s->stream, pulse_overflow, h); + pa_stream_set_underflow_callback(s->stream, pulse_underflow, h); + + if ((ret = pa_stream_connect_playback(s->stream, s->device, &buffer_attributes, + stream_flags, NULL, NULL)) < 0) { + av_log(s, AV_LOG_ERROR, "pa_stream_connect_playback failed: %s.\n", pa_strerror(ret)); + ret = AVERROR_EXTERNAL; + goto fail; + } + + if ((ret = pulse_stream_wait(s)) < 0) { + av_log(s, AV_LOG_ERROR, "Stream failed.\n"); + goto fail; + } + + pa_threaded_mainloop_unlock(s->mainloop); + + if ((ret = pulse_subscribe_events(s)) < 0) { + av_log(s, AV_LOG_ERROR, "Event subscription failed.\n"); + /* a bit ugly but the simplest to lock here*/ + pa_threaded_mainloop_lock(s->mainloop); + goto fail; + } + + /* force control messages */ + s->mute = -1; + s->last_volume = PA_VOLUME_INVALID; + pa_threaded_mainloop_lock(s->mainloop); + if ((ret = pulse_update_sink_input_info(h)) < 0) { + av_log(s, AV_LOG_ERROR, "Updating sink input info failed.\n"); + goto fail; + } + pa_threaded_mainloop_unlock(s->mainloop); + + avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ -static av_cold int pulse_write_trailer(AVFormatContext *h) -{ - PulseData *s = h->priv_data; - pa_simple_flush(s->pa, NULL); - pa_simple_free(s->pa); - s->pa = NULL; return 0; + fail: + pa_threaded_mainloop_unlock(s->mainloop); + pulse_write_trailer(h); + return ret; } static int pulse_write_packet(AVFormatContext *h, AVPacket *pkt) { PulseData *s = h->priv_data; - int error; + int ret; - if (!pkt) { - if (pa_simple_flush(s->pa, &error) < 0) { - av_log(s, AV_LOG_ERROR, "pa_simple_flush failed: %s\n", pa_strerror(error)); - return AVERROR(EIO); - } - return 1; - } + if (!pkt) + return pulse_flash_stream(s); if (pkt->dts != AV_NOPTS_VALUE) s->timestamp = pkt->dts; @@ -133,12 +627,29 @@ s->timestamp += av_rescale_q(samples, r, st->time_base); } - if (pa_simple_write(s->pa, pkt->data, pkt->size, &error) < 0) { - av_log(s, AV_LOG_ERROR, "pa_simple_write failed: %s\n", pa_strerror(error)); - return AVERROR(EIO); + pa_threaded_mainloop_lock(s->mainloop); + if (!PA_STREAM_IS_GOOD(pa_stream_get_state(s->stream))) { + av_log(s, AV_LOG_ERROR, "PulseAudio stream is in invalid state.\n"); + goto fail; + } + while (!pa_stream_writable_size(s->stream)) { + if (s->nonblocking) { + pa_threaded_mainloop_unlock(s->mainloop); + return AVERROR(EAGAIN); + } else + pa_threaded_mainloop_wait(s->mainloop); + } + + if ((ret = pa_stream_write(s->stream, pkt->data, pkt->size, NULL, 0, PA_SEEK_RELATIVE)) < 0) { + av_log(s, AV_LOG_ERROR, "pa_stream_write failed: %s\n", pa_strerror(ret)); + goto fail; } + pa_threaded_mainloop_unlock(s->mainloop); return 0; + fail: + pa_threaded_mainloop_unlock(s->mainloop); + return AVERROR_EXTERNAL; } static int pulse_write_frame(AVFormatContext *h, int stream_index, @@ -162,9 +673,13 @@ static void pulse_get_output_timestamp(AVFormatContext *h, int stream, int64_t *dts, int64_t *wall) { PulseData *s = h->priv_data; - pa_usec_t latency = pa_simple_get_latency(s->pa, NULL); + pa_usec_t latency; + int neg; + pa_threaded_mainloop_lock(s->mainloop); + pa_stream_get_latency(s->stream, &latency, &neg); + pa_threaded_mainloop_unlock(s->mainloop); *wall = av_gettime(); - *dts = s->timestamp - latency; + *dts = s->timestamp - (neg ? -latency : latency); } static int pulse_get_device_list(AVFormatContext *h, AVDeviceInfoList *device_list) @@ -173,21 +688,68 @@ return ff_pulse_audio_get_devices(device_list, s->server, 1); } +static int pulse_control_message(AVFormatContext *h, int type, + void *data, size_t data_size) +{ + PulseData *s = h->priv_data; + int ret; + + switch(type) { + case AV_APP_TO_DEV_PAUSE: + return pulse_set_pause(s, 1); + case AV_APP_TO_DEV_PLAY: + return pulse_set_pause(s, 0); + case AV_APP_TO_DEV_TOGGLE_PAUSE: + return pulse_set_pause(s, !pa_stream_is_corked(s->stream)); + case AV_APP_TO_DEV_MUTE: + if (!s->mute) { + s->mute = 1; + return pulse_set_mute(s); + } + return 0; + case AV_APP_TO_DEV_UNMUTE: + if (s->mute) { + s->mute = 0; + return pulse_set_mute(s); + } + return 0; + case AV_APP_TO_DEV_TOGGLE_MUTE: + s->mute = !s->mute; + return pulse_set_mute(s); + case AV_APP_TO_DEV_SET_VOLUME: + return pulse_set_volume(s, *(double *)data); + case AV_APP_TO_DEV_GET_VOLUME: + s->last_volume = PA_VOLUME_INVALID; + pa_threaded_mainloop_lock(s->mainloop); + ret = pulse_update_sink_input_info(h); + pa_threaded_mainloop_unlock(s->mainloop); + return ret; + case AV_APP_TO_DEV_GET_MUTE: + s->mute = -1; + pa_threaded_mainloop_lock(s->mainloop); + ret = pulse_update_sink_input_info(h); + pa_threaded_mainloop_unlock(s->mainloop); + return ret; + default: + break; + } + return AVERROR(ENOSYS); +} + #define OFFSET(a) offsetof(PulseData, a) #define E AV_OPT_FLAG_ENCODING_PARAM - static const AVOption options[] = { - { "server", "set PulseAudio server", OFFSET(server), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, - { "name", "set application name", OFFSET(name), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, E }, - { "stream_name", "set stream description", OFFSET(stream_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, - { "device", "set device name", OFFSET(device), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, - { "buffer_size", "set buffer size in bytes", OFFSET(buffer_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E }, - { "buffer_duration", "set buffer duration in millisecs", OFFSET(buffer_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E }, + { "server", "set PulseAudio server", OFFSET(server), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, + { "name", "set application name", OFFSET(name), AV_OPT_TYPE_STRING, {.str = LIBAVFORMAT_IDENT}, 0, 0, E }, + { "stream_name", "set stream description", OFFSET(stream_name), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, + { "device", "set device name", OFFSET(device), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E }, + { "buffer_size", "set buffer size in bytes", OFFSET(buffer_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E }, + { "buffer_duration", "set buffer duration in millisecs", OFFSET(buffer_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, E }, { NULL } }; static const AVClass pulse_muxer_class = { - .class_name = "Pulse muxer", + .class_name = "PulseAudio muxer", .item_name = av_default_item_name, .option = options, .version = LIBAVUTIL_VERSION_INT, @@ -195,17 +757,18 @@ }; AVOutputFormat ff_pulse_muxer = { - .name = "pulse", - .long_name = NULL_IF_CONFIG_SMALL("Pulse audio output"), - .priv_data_size = sizeof(PulseData), - .audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE), - .video_codec = AV_CODEC_ID_NONE, - .write_header = pulse_write_header, - .write_packet = pulse_write_packet, - .write_uncoded_frame = pulse_write_frame, - .write_trailer = pulse_write_trailer, + .name = "pulse", + .long_name = NULL_IF_CONFIG_SMALL("Pulse audio output"), + .priv_data_size = sizeof(PulseData), + .audio_codec = AV_NE(AV_CODEC_ID_PCM_S16BE, AV_CODEC_ID_PCM_S16LE), + .video_codec = AV_CODEC_ID_NONE, + .write_header = pulse_write_header, + .write_packet = pulse_write_packet, + .write_uncoded_frame = pulse_write_frame, + .write_trailer = pulse_write_trailer, .get_output_timestamp = pulse_get_output_timestamp, - .get_device_list = pulse_get_device_list, - .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH, - .priv_class = &pulse_muxer_class, + .get_device_list = pulse_get_device_list, + .control_message = pulse_control_message, + .flags = AVFMT_NOFILE | AVFMT_ALLOW_FLUSH, + .priv_class = &pulse_muxer_class, }; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/xv.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/xv.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavdevice/xv.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavdevice/xv.c 2014-04-23 09:55:21.000000000 +0000 @@ -24,7 +24,6 @@ * * TODO: * - add support to more formats - * - add support to window id specification */ #include @@ -44,9 +43,12 @@ GC gc; Window window; + int64_t window_id; char *window_title; int window_width, window_height; int window_x, window_y; + int dest_x, dest_y; /**< display area position */ + unsigned int dest_w, dest_h; /**< display area dimensions */ Display* display; char *display_name; @@ -103,6 +105,8 @@ unsigned int num_adaptors; XvAdaptorInfo *ai; XvImageFormatValues *fv; + XColor fgcolor; + XWindowAttributes window_attrs; int num_formats = 0, j, tag, ret; AVCodecContext *encctx = s->streams[0]->codec; @@ -140,6 +144,8 @@ xv->window_height = av_rescale(xv->window_height, sar.den, sar.num); } } + if (!xv->window_id) { + //TODO: reident xv->window = XCreateSimpleWindow(xv->display, DefaultRootWindow(xv->display), xv->window_x, xv->window_y, xv->window_width, xv->window_height, @@ -152,6 +158,8 @@ } XStoreName(xv->display, xv->window, xv->window_title); XMapWindow(xv->display, xv->window); + } else + xv->window = xv->window_id; if (XvQueryAdaptors(xv->display, DefaultRootWindow(xv->display), &num_adaptors, &ai) != Success) { ret = AVERROR_EXTERNAL; @@ -199,33 +207,100 @@ XSync(xv->display, False); shmctl(xv->yuv_shminfo.shmid, IPC_RMID, 0); + XGetWindowAttributes(xv->display, xv->window, &window_attrs); + fgcolor.red = fgcolor.green = fgcolor.blue = 0; + fgcolor.flags = DoRed | DoGreen | DoBlue; + XAllocColor(xv->display, window_attrs.colormap, &fgcolor); + XSetForeground(xv->display, xv->gc, fgcolor.pixel); + //force display area recalculation at first frame + xv->window_width = xv->window_height = 0; + return 0; fail: xv_write_trailer(s); return ret; } +static void compute_display_area(AVFormatContext *s) +{ + XVContext *xv = s->priv_data; + AVRational sar, dar; /* sample and display aspect ratios */ + AVStream *st = s->streams[0]; + AVCodecContext *encctx = st->codec; + + /* compute overlay width and height from the codec context information */ + sar = st->sample_aspect_ratio.num ? st->sample_aspect_ratio : (AVRational){ 1, 1 }; + dar = av_mul_q(sar, (AVRational){ encctx->width, encctx->height }); + + /* we suppose the screen has a 1/1 sample aspect ratio */ + /* fit in the window */ + if (av_cmp_q(dar, (AVRational){ xv->dest_w, xv->dest_h }) > 0) { + /* fit in width */ + xv->dest_y = xv->dest_h; + xv->dest_x = 0; + xv->dest_h = av_rescale(xv->dest_w, dar.den, dar.num); + xv->dest_y -= xv->dest_h; + xv->dest_y /= 2; + } else { + /* fit in height */ + xv->dest_x = xv->dest_w; + xv->dest_y = 0; + xv->dest_w = av_rescale(xv->dest_h, dar.num, dar.den); + xv->dest_x -= xv->dest_w; + xv->dest_x /= 2; + } +} + +static int xv_repaint(AVFormatContext *s) +{ + XVContext *xv = s->priv_data; + XWindowAttributes window_attrs; + + XGetWindowAttributes(xv->display, xv->window, &window_attrs); + if (window_attrs.width != xv->window_width || window_attrs.height != xv->window_height) { + XRectangle rect[2]; + xv->dest_w = window_attrs.width; + xv->dest_h = window_attrs.height; + compute_display_area(s); + if (xv->dest_x) { + rect[0].width = rect[1].width = xv->dest_x; + rect[0].height = rect[1].height = window_attrs.height; + rect[0].y = rect[1].y = 0; + rect[0].x = 0; + rect[1].x = xv->dest_w + xv->dest_x; + XFillRectangles(xv->display, xv->window, xv->gc, rect, 2); + } + if (xv->dest_y) { + rect[0].width = rect[1].width = window_attrs.width; + rect[0].height = rect[1].height = xv->dest_y; + rect[0].x = rect[1].x = 0; + rect[0].y = 0; + rect[1].y = xv->dest_h + xv->dest_y; + XFillRectangles(xv->display, xv->window, xv->gc, rect, 2); + } + } + + if (XvShmPutImage(xv->display, xv->xv_port, xv->window, xv->gc, + xv->yuv_image, 0, 0, xv->image_width, xv->image_height, + xv->dest_x, xv->dest_y, xv->dest_w, xv->dest_h, True) != Success) { + av_log(s, AV_LOG_ERROR, "Could not copy image to XV shared memory buffer\n"); + return AVERROR_EXTERNAL; + } + return 0; +} + static int write_picture(AVFormatContext *s, AVPicture *pict) { XVContext *xv = s->priv_data; XvImage *img = xv->yuv_image; - XWindowAttributes window_attrs; uint8_t *data[3] = { img->data + img->offsets[0], img->data + img->offsets[1], img->data + img->offsets[2] }; - av_image_copy(data, img->pitches, (const uint8_t **)pict->data, pict->linesize, xv->image_format, img->width, img->height); - XGetWindowAttributes(xv->display, xv->window, &window_attrs); - if (XvShmPutImage(xv->display, xv->xv_port, xv->window, xv->gc, - xv->yuv_image, 0, 0, xv->image_width, xv->image_height, 0, 0, - window_attrs.width, window_attrs.height, True) != Success) { - av_log(s, AV_LOG_ERROR, "Could not copy image to XV shared memory buffer\n"); - return AVERROR_EXTERNAL; - } - return 0; + return xv_repaint(s); } static int xv_write_packet(AVFormatContext *s, AVPacket *pkt) @@ -246,9 +321,21 @@ return write_picture(s, (AVPicture *)*frame); } +static int xv_control_message(AVFormatContext *s, int type, void *data, size_t data_size) +{ + switch(type) { + case AV_APP_TO_DEV_WINDOW_REPAINT: + return xv_repaint(s); + default: + break; + } + return AVERROR(ENOSYS); +} + #define OFFSET(x) offsetof(XVContext, x) static const AVOption options[] = { { "display_name", "set display name", OFFSET(display_name), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, + { "window_id", "set existing window id", OFFSET(window_id), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, AV_OPT_FLAG_ENCODING_PARAM }, { "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, { "window_title", "set window title", OFFSET(window_title), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_ENCODING_PARAM }, { "window_x", "set window x offset", OFFSET(window_x), AV_OPT_TYPE_INT, {.i64 = 0 }, -INT_MAX, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, @@ -275,6 +362,7 @@ .write_packet = xv_write_packet, .write_uncoded_frame = xv_write_frame, .write_trailer = xv_write_trailer, + .control_message = xv_control_message, .flags = AVFMT_NOFILE | AVFMT_VARIABLE_FPS | AVFMT_NOTIMESTAMPS, .priv_class = &xv_class, }; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/buffersink.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/buffersink.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/buffersink.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/buffersink.c 2014-04-23 09:55:21.000000000 +0000 @@ -36,7 +36,7 @@ #include "buffersink.h" #include "internal.h" -typedef struct { +typedef struct BufferSinkContext { const AVClass *class; AVFifoBuffer *fifo; ///< FIFO buffer of video frame references unsigned warning_limit; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/buffersrc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/buffersrc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/buffersrc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/buffersrc.c 2014-04-23 09:55:21.000000000 +0000 @@ -41,7 +41,7 @@ #include "video.h" #include "avcodec.h" -typedef struct { +typedef struct BufferSourceContext { const AVClass *class; AVFifoBuffer *fifo; AVRational time_base; ///< time_base to set in the output link diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/fifo.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/fifo.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/fifo.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/fifo.c 2014-04-23 09:55:21.000000000 +0000 @@ -39,7 +39,7 @@ struct Buf *next; } Buf; -typedef struct { +typedef struct FifoContext { Buf root; Buf *last; ///< last buffered frame diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/filtfmts.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/filtfmts.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/filtfmts.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/filtfmts.c 2014-04-23 09:55:21.000000000 +0000 @@ -20,7 +20,7 @@ #include -#include "libavformat/avformat.h" +#include "libavutil/channel_layout.h" #include "libavutil/pixdesc.h" #include "libavutil/samplefmt.h" #include "libavfilter/avfilter.h" @@ -38,7 +38,7 @@ for (j = 0; j < fmts->nb_formats; j++) \ if(av_get_pix_fmt_name(fmts->formats[j])) \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, \ + i, filter_ctx->inout##put_pads[i].name, \ av_get_pix_fmt_name(fmts->formats[j])); \ } else if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_AUDIO) { \ AVFilterFormats *fmts; \ @@ -47,7 +47,7 @@ fmts = filter_ctx->inout##puts[i]->outin##_formats; \ for (j = 0; j < fmts->nb_formats; j++) \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, \ + i, filter_ctx->inout##put_pads[i].name, \ av_get_sample_fmt_name(fmts->formats[j])); \ \ layouts = filter_ctx->inout##puts[i]->outin##_channel_layouts; \ @@ -56,7 +56,7 @@ av_get_channel_layout_string(buf, sizeof(buf), -1, \ layouts->channel_layouts[j]); \ printf(#INOUT "PUT[%d] %s: chlayout:%s\n", \ - i, filter_ctx->filter->inout##puts[i].name, buf); \ + i, filter_ctx->inout##put_pads[i].name, buf); \ } \ } \ } \ @@ -113,12 +113,12 @@ /* create a link for each of the input pads */ for (i = 0; i < filter_ctx->nb_inputs; i++) { AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); - link->type = filter_ctx->filter->inputs[i].type; + link->type = filter_ctx->input_pads[i].type; filter_ctx->inputs[i] = link; } for (i = 0; i < filter_ctx->nb_outputs; i++) { AVFilterLink *link = av_mallocz(sizeof(AVFilterLink)); - link->type = filter_ctx->filter->outputs[i].type; + link->type = filter_ctx->output_pads[i].type; filter_ctx->outputs[i] = link; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/f_select.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/f_select.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/f_select.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/f_select.c 2014-04-23 09:55:21.000000000 +0000 @@ -138,7 +138,7 @@ VAR_VARS_NB }; -typedef struct { +typedef struct SelectContext { const AVClass *class; char *expr_str; AVExpr *expr; @@ -279,7 +279,7 @@ p2 += 8 * linesize; } emms_c(); - mafd = nb_sad ? sad / nb_sad : 0; + mafd = nb_sad ? (double)sad / nb_sad : 0; diff = fabs(mafd - select->prev_mafd); ret = av_clipf(FFMIN(mafd, diff) / 100., 0, 1); select->prev_mafd = mafd; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/pthread.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/pthread.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/pthread.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/pthread.c 2014-04-23 09:55:21.000000000 +0000 @@ -170,7 +170,7 @@ return 1; c->nb_threads = nb_threads; - c->workers = av_mallocz(sizeof(*c->workers) * nb_threads); + c->workers = av_mallocz_array(sizeof(*c->workers), nb_threads); if (!c->workers) return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/setpts.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/setpts.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/setpts.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/setpts.c 2014-04-23 09:55:21.000000000 +0000 @@ -82,7 +82,7 @@ VAR_VARS_NB }; -typedef struct { +typedef struct SetPTSContext { const AVClass *class; char *expr_str; AVExpr *expr; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/settb.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/settb.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/settb.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/settb.c 2014-04-23 09:55:21.000000000 +0000 @@ -51,7 +51,7 @@ VAR_VARS_NB }; -typedef struct { +typedef struct SetTBContext { const AVClass *class; char *tb_expr; double var_values[VAR_VARS_NB]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/src_movie.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/src_movie.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/src_movie.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/src_movie.c 2014-04-23 09:55:21.000000000 +0000 @@ -44,12 +44,12 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct MovieStream { AVStream *st; int done; } MovieStream; -typedef struct { +typedef struct MovieContext { /* common A/V fields */ const AVClass *class; int64_t seek_point; ///< seekpoint in microseconds diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/unsharp.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/unsharp.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/unsharp.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/unsharp.h 2014-04-23 09:55:21.000000000 +0000 @@ -64,7 +64,7 @@ uint32_t *sc[MAX_MATRIX_SIZE - 1]; ///< finite state machine storage } UnsharpFilterParam; -typedef struct { +typedef struct UnsharpContext { const AVClass *class; int lmsize_x, lmsize_y, cmsize_x, cmsize_y; float lamount, camount; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_aspect.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_aspect.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_aspect.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_aspect.c 2014-04-23 09:55:21.000000000 +0000 @@ -56,7 +56,7 @@ VARS_NB }; -typedef struct { +typedef struct AspectContext { const AVClass *class; AVRational dar; AVRational sar; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_blackframe.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_blackframe.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_blackframe.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_blackframe.c 2014-04-23 09:55:21.000000000 +0000 @@ -37,7 +37,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct BlackFrameContext { const AVClass *class; int bamount; ///< black amount int bthresh; ///< black threshold diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_boxblur.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_boxblur.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_boxblur.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_boxblur.c 2014-04-23 09:55:21.000000000 +0000 @@ -55,13 +55,13 @@ VARS_NB }; -typedef struct { +typedef struct FilterParam { int radius; int power; char *radius_expr; } FilterParam; -typedef struct { +typedef struct BoxBlurContext { const AVClass *class; FilterParam luma_param; FilterParam chroma_param; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_crop.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_crop.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_crop.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_crop.c 2014-04-23 09:55:21.000000000 +0000 @@ -73,7 +73,7 @@ VAR_VARS_NB }; -typedef struct { +typedef struct CropContext { const AVClass *class; int x; ///< x offset of the non-cropped area with respect to the input area int y; ///< y offset of the non-cropped area with respect to the input area diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_cropdetect.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_cropdetect.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_cropdetect.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_cropdetect.c 2014-04-23 09:55:21.000000000 +0000 @@ -32,7 +32,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct CropDetectContext { const AVClass *class; int x1, y1, x2, y2; int limit; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_delogo.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_delogo.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_delogo.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_delogo.c 2014-04-23 09:55:21.000000000 +0000 @@ -148,7 +148,7 @@ } } -typedef struct { +typedef struct DelogoContext { const AVClass *class; int x, y, w, h, band, show; } DelogoContext; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_deshake.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_deshake.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_deshake.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_deshake.c 2014-04-23 09:55:21.000000000 +0000 @@ -306,8 +306,8 @@ //av_log(NULL, AV_LOG_ERROR, "\n"); } - p_x = (center_x - width / 2); - p_y = (center_y - height / 2); + p_x = (center_x - width / 2.0); + p_y = (center_y - height / 2.0); t->vector.x += (cos(t->angle)-1)*p_x - sin(t->angle)*p_y; t->vector.y += sin(t->angle)*p_x + (cos(t->angle)-1)*p_y; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_drawbox.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_drawbox.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_drawbox.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_drawbox.c 2014-04-23 09:55:21.000000000 +0000 @@ -66,7 +66,7 @@ VARS_NB }; -typedef struct { +typedef struct DrawBoxContext { const AVClass *class; int x, y, w, h; int thickness; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_drawtext.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_drawtext.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_drawtext.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_drawtext.c 2014-04-23 09:55:21.000000000 +0000 @@ -27,10 +27,18 @@ */ #include "config.h" + #if HAVE_SYS_TIME_H #include #endif +#include +#include #include +#include + +#if CONFIG_LIBFONTCONFIG +#include +#endif #include "libavutil/avstring.h" #include "libavutil/bprint.h" @@ -53,9 +61,6 @@ #include FT_FREETYPE_H #include FT_GLYPH_H #include FT_STROKER_H -#if CONFIG_FONTCONFIG -#include -#endif static const char *const var_names[] = { "dar", @@ -121,10 +126,13 @@ EXP_STRFTIME, }; -typedef struct { +typedef struct DrawTextContext { const AVClass *class; enum expansion_mode exp_mode; ///< expansion mode to use for the text int reinit; ///< tells if the filter is being reinited +#if CONFIG_LIBFONTCONFIG + uint8_t *font; ///< font to be used +#endif uint8_t *fontfile; ///< font to be used uint8_t *text; ///< text to be drawn AVBPrint expanded_text; ///< used to contain the expanded text @@ -198,6 +206,9 @@ #if FF_API_DRAWTEXT_OLD_TIMELINE {"draw", "if false do not draw (deprecated)", OFFSET(draw_expr), AV_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX, FLAGS}, #endif +#if CONFIG_LIBFONTCONFIG + { "font", "Font name", OFFSET(font), AV_OPT_TYPE_STRING, { .str = "Sans" }, .flags = FLAGS }, +#endif {"expansion", "set the expansion mode", OFFSET(exp_mode), AV_OPT_TYPE_INT, {.i64=EXP_NORMAL}, 0, 2, FLAGS, "expansion"}, {"none", "set no expansion", OFFSET(exp_mode), AV_OPT_TYPE_CONST, {.i64=EXP_NONE}, 0, 0, FLAGS, "expansion"}, @@ -249,7 +260,7 @@ #define FT_ERRMSG(e) ft_errors[e].err_msg -typedef struct { +typedef struct Glyph { FT_Glyph *glyph; uint32_t code; FT_Bitmap bitmap; ///< array holding bitmaps of font @@ -337,68 +348,90 @@ return ret; } -static int load_font_file(AVFilterContext *ctx, const char *path, int index, - const char **error) +static int load_font_file(AVFilterContext *ctx, const char *path, int index) { DrawTextContext *s = ctx->priv; int err; err = FT_New_Face(s->library, path, index, &s->face); if (err) { - *error = FT_ERRMSG(err); + av_log(ctx, AV_LOG_ERROR, "Could not load font \"%s\": %s\n", + s->fontfile, FT_ERRMSG(err)); return AVERROR(EINVAL); } return 0; } -#if CONFIG_FONTCONFIG -static int load_font_fontconfig(AVFilterContext *ctx, const char **error) +#if CONFIG_LIBFONTCONFIG +static int load_font_fontconfig(AVFilterContext *ctx) { DrawTextContext *s = ctx->priv; FcConfig *fontconfig; - FcPattern *pattern, *fpat; + FcPattern *pat, *best; FcResult result = FcResultMatch; FcChar8 *filename; - int err, index; + int index; double size; + int err = AVERROR(ENOENT); fontconfig = FcInitLoadConfigAndFonts(); if (!fontconfig) { - *error = "impossible to init fontconfig\n"; - return AVERROR(EINVAL); + av_log(ctx, AV_LOG_ERROR, "impossible to init fontconfig\n"); + return AVERROR_UNKNOWN; } - pattern = FcNameParse(s->fontfile ? s->fontfile : + pat = FcNameParse(s->fontfile ? s->fontfile : (uint8_t *)(intptr_t)"default"); - if (!pattern) { - *error = "could not parse fontconfig pattern"; + if (!pat) { + av_log(ctx, AV_LOG_ERROR, "could not parse fontconfig pat"); return AVERROR(EINVAL); } - if (!FcConfigSubstitute(fontconfig, pattern, FcMatchPattern)) { - *error = "could not substitue fontconfig options"; /* very unlikely */ - return AVERROR(EINVAL); + + FcPatternAddString(pat, FC_FAMILY, s->font); + if (s->fontsize) + FcPatternAddDouble(pat, FC_SIZE, (double)s->fontsize); + + FcDefaultSubstitute(pat); + + if (!FcConfigSubstitute(fontconfig, pat, FcMatchPattern)) { + av_log(ctx, AV_LOG_ERROR, "could not substitue fontconfig options"); /* very unlikely */ + FcPatternDestroy(pat); + return AVERROR(ENOMEM); } - FcDefaultSubstitute(pattern); - fpat = FcFontMatch(fontconfig, pattern, &result); - if (!fpat || result != FcResultMatch) { - *error = "impossible to find a matching font"; - return AVERROR(EINVAL); + + best = FcFontMatch(fontconfig, pat, &result); + FcPatternDestroy(pat); + + if (!best || result != FcResultMatch) { + av_log(ctx, AV_LOG_ERROR, + "Cannot find a valid font for the family %s\n", + s->font); + goto fail; } - if (FcPatternGetString (fpat, FC_FILE, 0, &filename) != FcResultMatch || - FcPatternGetInteger(fpat, FC_INDEX, 0, &index ) != FcResultMatch || - FcPatternGetDouble (fpat, FC_SIZE, 0, &size ) != FcResultMatch) { - *error = "impossible to find font information"; + + if ( + FcPatternGetInteger(best, FC_INDEX, 0, &index ) != FcResultMatch || + FcPatternGetDouble (best, FC_SIZE, 0, &size ) != FcResultMatch) { + av_log(ctx, AV_LOG_ERROR, "impossible to find font information"); return AVERROR(EINVAL); } + + if (FcPatternGetString(best, FC_FILE, 0, &filename) != FcResultMatch) { + av_log(ctx, AV_LOG_ERROR, "No file path for %s\n", + s->font); + goto fail; + } + av_log(ctx, AV_LOG_INFO, "Using \"%s\"\n", filename); if (!s->fontsize) s->fontsize = size + 0.5; - err = load_font_file(ctx, filename, index, error); + + err = load_font_file(ctx, filename, index); if (err) return err; - FcPatternDestroy(fpat); - FcPatternDestroy(pattern); FcConfigDestroy(fontconfig); - return 0; +fail: + FcPatternDestroy(best); + return err; } #endif @@ -406,19 +439,16 @@ { DrawTextContext *s = ctx->priv; int err; - const char *error = "unknown error\n"; /* load the face, and set up the encoding, which is by default UTF-8 */ - err = load_font_file(ctx, s->fontfile, 0, &error); + err = load_font_file(ctx, s->fontfile, 0); if (!err) return 0; -#if CONFIG_FONTCONFIG - err = load_font_fontconfig(ctx, &error); +#if CONFIG_LIBFONTCONFIG + err = load_font_fontconfig(ctx); if (!err) return 0; #endif - av_log(ctx, AV_LOG_ERROR, "Could not load font \"%s\": %s\n", - s->fontfile, error); return err; } @@ -457,7 +487,7 @@ "you are encouraged to use the generic timeline support through the 'enable' option\n"); #endif - if (!s->fontfile && !CONFIG_FONTCONFIG) { + if (!s->fontfile && !CONFIG_LIBFONTCONFIG) { av_log(ctx, AV_LOG_ERROR, "No font filename provided\n"); return AVERROR(EINVAL); } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_elbg.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_elbg.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_elbg.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_elbg.c 2014-04-23 09:55:21.000000000 +0000 @@ -33,7 +33,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct ColorContext { const AVClass *class; AVLFG lfg; unsigned int lfg_seed; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_fade.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_fade.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_fade.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_fade.c 2014-04-23 09:55:21.000000000 +0000 @@ -49,7 +49,7 @@ #define FADE_IN 0 #define FADE_OUT 1 -typedef struct { +typedef struct FadeContext { const AVClass *class; int type; int factor, fade_per_frame; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_fieldorder.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_fieldorder.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_fieldorder.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_fieldorder.c 2014-04-23 09:55:21.000000000 +0000 @@ -32,7 +32,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct FieldOrderContext { const AVClass *class; int dst_tff; ///< output bff/tff int line_size[4]; ///< bytes of pixel data per line for each plane diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_format.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_format.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_format.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_format.c 2014-04-23 09:55:21.000000000 +0000 @@ -35,7 +35,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct FormatContext { const AVClass *class; char *pix_fmts; /** diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_framestep.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_framestep.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_framestep.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_framestep.c 2014-04-23 09:55:21.000000000 +0000 @@ -28,7 +28,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct NullContext { const AVClass *class; int frame_step; } FrameStepContext; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_hflip.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_hflip.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_hflip.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_hflip.c 2014-04-23 09:55:21.000000000 +0000 @@ -35,7 +35,7 @@ #include "libavutil/intreadwrite.h" #include "libavutil/imgutils.h" -typedef struct { +typedef struct FlipContext { int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes int planewidth[4]; ///< width of each plane int planeheight[4]; ///< height of each plane diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_hqdn3d.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_hqdn3d.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_hqdn3d.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_hqdn3d.h 2014-04-23 09:55:21.000000000 +0000 @@ -28,7 +28,7 @@ #include "libavutil/opt.h" -typedef struct { +typedef struct HQDN3DContext { const AVClass *class; int16_t *coefs[4]; uint16_t *line; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_interlace.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_interlace.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_interlace.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_interlace.c 2014-04-23 09:55:21.000000000 +0000 @@ -47,7 +47,7 @@ FIELD_LOWER = 1, }; -typedef struct { +typedef struct InterlaceContext { const AVClass *class; enum ScanMode scan; // top or bottom field first scanning #if FF_API_INTERLACE_LOWPASS_SET diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_libopencv.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_libopencv.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_libopencv.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_libopencv.c 2014-04-23 09:55:21.000000000 +0000 @@ -68,7 +68,7 @@ return 0; } -typedef struct { +typedef struct OCVContext { const AVClass *class; char *name; char *params; @@ -78,7 +78,7 @@ void *priv; } OCVContext; -typedef struct { +typedef struct SmoothContext { int type; int param1, param2; double param3, param4; @@ -245,7 +245,7 @@ return 0; } -typedef struct { +typedef struct DilateContext { int nb_iterations; IplConvKernel *kernel; } DilateContext; @@ -302,7 +302,7 @@ cvErode(inimg, outimg, dilate->kernel, dilate->nb_iterations); } -typedef struct { +typedef struct OCVFilterEntry { const char *name; size_t priv_size; int (*init)(AVFilterContext *ctx, const char *args); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_lut.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_lut.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_lut.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_lut.c 2014-04-23 09:55:21.000000000 +0000 @@ -57,7 +57,7 @@ VAR_VARS_NB }; -typedef struct { +typedef struct LutContext { const AVClass *class; uint8_t lut[4][256]; ///< lookup table for each component char *comp_expr_str[4]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_noise.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_noise.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_noise.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_noise.c 2014-04-23 09:55:21.000000000 +0000 @@ -289,7 +289,7 @@ static inline void line_noise_avg_mmx(uint8_t *dst, const uint8_t *src, int len, int8_t **shift) { -#if HAVE_MMX_INLINE +#if HAVE_MMX_INLINE && HAVE_6REGS x86_reg mmx_len= len&(~7); __asm__ volatile( @@ -438,7 +438,9 @@ if (HAVE_MMX_INLINE && cpu_flags & AV_CPU_FLAG_MMX) { n->line_noise = line_noise_mmx; +#if HAVE_6REGS n->line_noise_avg = line_noise_avg_mmx; +#endif } if (HAVE_MMXEXT_INLINE && cpu_flags & AV_CPU_FLAG_MMXEXT) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_overlay.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_overlay.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_overlay.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_overlay.c 2014-04-23 09:55:21.000000000 +0000 @@ -91,7 +91,7 @@ #define U 1 #define V 2 -typedef struct { +typedef struct OverlayContext { const AVClass *class; int x, y; ///< position of overlayed picture diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_pad.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_pad.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_pad.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_pad.c 2014-04-23 09:55:21.000000000 +0000 @@ -77,7 +77,7 @@ return 0; } -typedef struct { +typedef struct PadContext { const AVClass *class; int w, h; ///< output dimensions, a value of 0 will result in the input size int x, y; ///< offsets of the input area with respect to the padded area diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_pixdesctest.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_pixdesctest.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_pixdesctest.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_pixdesctest.c 2014-04-23 09:55:21.000000000 +0000 @@ -29,7 +29,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct PixdescTestContext { const AVPixFmtDescriptor *pix_desc; uint16_t *line; } PixdescTestContext; @@ -47,7 +47,7 @@ priv->pix_desc = av_pix_fmt_desc_get(inlink->format); av_freep(&priv->line); - if (!(priv->line = av_malloc(sizeof(*priv->line) * inlink->w))) + if (!(priv->line = av_malloc_array(sizeof(*priv->line), inlink->w))) return AVERROR(ENOMEM); return 0; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_rotate.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_rotate.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_rotate.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_rotate.c 2014-04-23 09:55:21.000000000 +0000 @@ -36,6 +36,8 @@ #include "internal.h" #include "video.h" +#include + static const char *var_names[] = { "in_w" , "iw", ///< width of the input video "in_h" , "ih", ///< height of the input video @@ -252,11 +254,12 @@ } #define FIXP (1<<16) -#define INT_PI 205887 //(M_PI * FIXP) +#define FIXP2 (1<<20) +#define INT_PI 3294199 //(M_PI * FIXP2) /** * Compute the sin of a using integer values. - * Input and output values are scaled by FIXP. + * Input is scaled by FIXP2 and output values are scaled by FIXP. */ static int64_t int_sin(int64_t a) { @@ -268,13 +271,13 @@ if (a >= INT_PI*3/2) a -= 2*INT_PI; // -PI/2 .. 3PI/2 if (a >= INT_PI/2 ) a = INT_PI - a; // -PI/2 .. PI/2 - /* compute sin using Taylor series approximated to the third term */ - a2 = (a*a)/FIXP; - for (i = 2; i < 7; i += 2) { + /* compute sin using Taylor series approximated to the fifth term */ + a2 = (a*a)/(FIXP2); + for (i = 2; i < 11; i += 2) { res += a; - a = -a*a2 / (FIXP*i*(i+1)); + a = -a*a2 / (FIXP2*i*(i+1)); } - return res; + return (res + 8)>>4; } /** @@ -307,6 +310,62 @@ return dst_color; } +static av_always_inline void copy_elem(uint8_t *pout, const uint8_t *pin, int elem_size) +{ + int v; + switch (elem_size) { + case 1: + *pout = *pin; + break; + case 2: + *((uint16_t *)pout) = *((uint16_t *)pin); + break; + case 3: + v = AV_RB24(pin); + AV_WB24(pout, v); + break; + case 4: + *((uint32_t *)pout) = *((uint32_t *)pin); + break; + default: + memcpy(pout, pin, elem_size); + break; + } +} + +static av_always_inline void simple_rotate_internal(uint8_t *dst, const uint8_t *src, int src_linesize, int angle, int elem_size, int len) +{ + int i; + switch(angle) { + case 0: + memcpy(dst, src, elem_size * len); + break; + case 1: + for (i = 0; iangle - 0) < FLT_EPSILON && outw == inw && outh == inh) { + simple_rotate(out->data[plane] + j * out->linesize[plane], + in->data[plane] + j * in->linesize[plane], + in->linesize[plane], 0, rot->draw.pixelstep[plane], outw); + } else if (fabs(rot->angle - M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) { + simple_rotate(out->data[plane] + j * out->linesize[plane], + in->data[plane] + j * rot->draw.pixelstep[plane], + in->linesize[plane], 1, rot->draw.pixelstep[plane], outw); + } else if (fabs(rot->angle - M_PI) < FLT_EPSILON && outw == inw && outh == inh) { + simple_rotate(out->data[plane] + j * out->linesize[plane], + in->data[plane] + (outh-j-1) * in->linesize[plane], + in->linesize[plane], 2, rot->draw.pixelstep[plane], outw); + } else if (fabs(rot->angle - 3*M_PI/2) < FLT_EPSILON && outw == inh && outh == inw) { + simple_rotate(out->data[plane] + j * out->linesize[plane], + in->data[plane] + (outh-j-1) * rot->draw.pixelstep[plane], + in->linesize[plane], 3, rot->draw.pixelstep[plane], outw); + } else { for (i = 0; i < outw; i++) { int32_t v; int x1, y1; uint8_t *pin, *pout; - x += c; - y -= s; x1 = x>>16; y1 = y>>16; @@ -371,6 +446,9 @@ break; } } + x += c; + y -= s; + } } xprime += s; yprime += c; @@ -402,7 +480,7 @@ av_log(ctx, AV_LOG_DEBUG, "n:%f time:%f angle:%f/PI\n", rot->var_values[VAR_N], rot->var_values[VAR_T], rot->angle/M_PI); - angle_int = res * FIXP; + angle_int = res * FIXP * 16; s = int_sin(angle_int); c = int_sin(angle_int + INT_PI/2); @@ -420,9 +498,9 @@ .inw = FF_CEIL_RSHIFT(inlink->w, hsub), .inh = FF_CEIL_RSHIFT(inlink->h, vsub), .outh = outh, .outw = outw, - .xi = -outw/2 * c, .yi = outw/2 * s, - .xprime = -outh/2 * s, - .yprime = -outh/2 * c, + .xi = -(outw-1) * c / 2, .yi = (outw-1) * s / 2, + .xprime = -(outh-1) * s / 2, + .yprime = -(outh-1) * c / 2, .plane = plane, .c = c, .s = s }; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_scale.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_scale.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_scale.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_scale.c 2014-04-23 09:55:21.000000000 +0000 @@ -71,7 +71,7 @@ VARS_NB }; -typedef struct { +typedef struct ScaleContext { const AVClass *class; struct SwsContext *sws; ///< software scaler context struct SwsContext *isws[2]; ///< software scaler context for interlaced material diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_transpose.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_transpose.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_transpose.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_transpose.c 2014-04-23 09:55:21.000000000 +0000 @@ -51,7 +51,7 @@ TRANSPOSE_CLOCK_FLIP, }; -typedef struct { +typedef struct TransContext { const AVClass *class; int hsub, vsub; int pixsteps[4]; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_vflip.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_vflip.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vf_vflip.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vf_vflip.c 2014-04-23 09:55:21.000000000 +0000 @@ -29,7 +29,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct FlipContext { int vsub; ///< vertical chroma subsampling } FlipContext; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vsrc_testsrc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vsrc_testsrc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavfilter/vsrc_testsrc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavfilter/vsrc_testsrc.c 2014-04-23 09:55:21.000000000 +0000 @@ -47,7 +47,7 @@ #include "internal.h" #include "video.h" -typedef struct { +typedef struct TestSourceContext { const AVClass *class; int w, h; unsigned int nb_frame; @@ -488,7 +488,7 @@ #define LEFT_BOT_VBAR 16 #define RIGHT_TOP_VBAR 32 #define RIGHT_BOT_VBAR 64 - struct { + struct segments { int x, y, w, h; } segments[] = { { 1, 0, 5, 1 }, /* TOP_HBAR */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/aiffdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/aiffdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/aiffdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/aiffdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -237,7 +237,7 @@ break; case MKTAG('I', 'D', '3', ' '): position = avio_tell(pb); - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); + ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, size); if (id3v2_extra_meta) if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) { ff_id3v2_free_extra_meta(&id3v2_extra_meta); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/allformats.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/allformats.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/allformats.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/allformats.c 2014-04-23 09:55:21.000000000 +0000 @@ -106,6 +106,7 @@ REGISTER_DEMUXER (DFA, dfa); REGISTER_MUXDEMUX(DIRAC, dirac); REGISTER_MUXDEMUX(DNXHD, dnxhd); + REGISTER_DEMUXER (DSF, dsf); REGISTER_DEMUXER (DSICIN, dsicin); REGISTER_MUXDEMUX(DTS, dts); REGISTER_DEMUXER (DTSHD, dtshd); @@ -171,6 +172,7 @@ REGISTER_MUXDEMUX(MICRODVD, microdvd); REGISTER_MUXDEMUX(MJPEG, mjpeg); REGISTER_MUXDEMUX(MLP, mlp); + REGISTER_DEMUXER (MLV, mlv); REGISTER_DEMUXER (MM, mm); REGISTER_MUXDEMUX(MMF, mmf); REGISTER_MUXDEMUX(MOV, mov); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/asfdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/asfdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/asfdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/asfdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -268,7 +268,7 @@ { ID3v2ExtraMeta *id3v2_extra_meta = NULL; - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); + ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, len); if (id3v2_extra_meta) ff_id3v2_parse_apic(s, &id3v2_extra_meta); ff_id3v2_free_extra_meta(&id3v2_extra_meta); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/asfenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/asfenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/asfenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/asfenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -352,7 +352,7 @@ AVIOContext *pb = s->pb; AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; - int has_title; + int has_title, has_aspect_ratio = 0; int metadata_count; AVCodecContext *enc; int64_t header_offset, cur_pos, hpos; @@ -378,6 +378,10 @@ avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */ bit_rate += enc->bit_rate; + if ( enc->codec_type == AVMEDIA_TYPE_VIDEO + && enc->sample_aspect_ratio.num > 0 + && enc->sample_aspect_ratio.den > 0) + has_aspect_ratio++; } if (asf->is_streamed) { @@ -410,8 +414,40 @@ /* unknown headers */ hpos = put_header(pb, &ff_asf_head1_guid); ff_put_guid(pb, &ff_asf_head2_guid); - avio_wl32(pb, 6); - avio_wl16(pb, 0); + avio_wl16(pb, 6); + if (has_aspect_ratio) { + int64_t hpos2; + avio_wl32(pb, 26 + has_aspect_ratio * 84); + hpos2 = put_header(pb, &ff_asf_metadata_header); + avio_wl16(pb, 2 * has_aspect_ratio); + for (n = 0; n < s->nb_streams; n++) { + enc = s->streams[n]->codec; + if ( enc->codec_type == AVMEDIA_TYPE_VIDEO + && enc->sample_aspect_ratio.num > 0 + && enc->sample_aspect_ratio.den > 0) { + AVRational sar = enc->sample_aspect_ratio; + avio_wl16(pb, 0); + // the stream number is set like this below + avio_wl16(pb, n + 1); + avio_wl16(pb, 26); // name_len + avio_wl16(pb, 3); // value_type + avio_wl32(pb, 4); // value_len + avio_put_str16le(pb, "AspectRatioX"); + avio_wl32(pb, sar.num); + avio_wl16(pb, 0); + // the stream number is set like this below + avio_wl16(pb, n + 1); + avio_wl16(pb, 26); // name_len + avio_wl16(pb, 3); // value_type + avio_wl32(pb, 4); // value_len + avio_put_str16le(pb, "AspectRatioY"); + avio_wl32(pb, sar.den); + } + } + end_header(pb, hpos2); + } else { + avio_wl32(pb, 0); + } end_header(pb, hpos); /* title and other infos */ @@ -611,6 +647,7 @@ ASFContext *asf = s->priv_data; s->packet_size = PACKET_SIZE; + s->max_interleave_delta = 0; asf->nb_packets = 0; asf->index_ptr = av_malloc(sizeof(ASFIndex) * ASF_INDEX_BLOCK); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avformat.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avformat.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avformat.h 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avformat.h 2014-04-23 09:55:21.000000000 +0000 @@ -862,6 +862,8 @@ * - muxing: May be set by the caller before avformat_write_header(). * * Freed by libavformat in avformat_free_context(). + * + * @see av_format_inject_global_side_data() */ AVPacketSideData *side_data; /** @@ -889,6 +891,12 @@ double (*duration_error)[2][MAX_STD_TIMEBASES]; int64_t codec_info_duration; int64_t codec_info_duration_fields; + + /** + * 0 -> decoder has not been searched for yet. + * >0 -> decoder found + * <0 -> decoder with codec_id == -found_decoder has not been found + */ int found_decoder; int64_t last_duration; @@ -1040,6 +1048,11 @@ uint8_t dts_ordered; uint8_t dts_misordered; + /** + * Internal data to inject global side data + */ + int inject_global_side_data; + } AVStream; AVRational av_stream_get_r_frame_rate(const AVStream *s); @@ -1608,6 +1621,12 @@ void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); /** + * This function will cause global side data to be injected in the next packet + * of each stream as well as after any subsequent seek. + */ +void av_format_inject_global_side_data(AVFormatContext *s); + +/** * Returns the method used to set ctx->duration. * * @return AVFMT_DURATION_FROM_PTS, AVFMT_DURATION_FROM_STREAM, or AVFMT_DURATION_FROM_BITRATE. diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avidec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avidec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avidec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avidec.c 2014-04-23 09:55:21.000000000 +0000 @@ -1413,7 +1413,7 @@ AVIndexEntry *e; int index; - index = av_index_search_timestamp(st, ast->frame_offset, 0); + index = av_index_search_timestamp(st, ast->frame_offset, AVSEEK_FLAG_ANY); e = &st->index_entries[index]; if (index >= 0 && e->timestamp == ast->frame_offset) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avienc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avienc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avienc.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avienc.c 2014-04-23 09:55:21.000000000 +0000 @@ -308,6 +308,12 @@ if (stream->codec_id != AV_CODEC_ID_XSUB) break; case AVMEDIA_TYPE_VIDEO: + /* WMP expects RGB 5:5:5 rawvideo in avi to have bpp set to 16. */ + if ( !stream->codec_tag + && stream->codec_id == AV_CODEC_ID_RAWVIDEO + && stream->pix_fmt == AV_PIX_FMT_RGB555LE + && stream->bits_per_coded_sample == 15) + stream->bits_per_coded_sample = 16; ff_put_bmp_header(pb, stream, ff_codec_bmp_tags, 0, 0); pix_fmt = avpriv_find_pix_fmt(avpriv_pix_fmt_bps_avi, stream->bits_per_coded_sample); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/aviobuf.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/aviobuf.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/aviobuf.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/aviobuf.c 2014-04-23 09:55:21.000000000 +0000 @@ -469,6 +469,12 @@ return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); } +unsigned long ff_crcA001_update(unsigned long checksum, const uint8_t *buf, + unsigned int len) +{ + return av_crc(av_crc_get_table(AV_CRC_16_ANSI_LE), checksum, buf, len); +} + unsigned long ffio_get_checksum(AVIOContext *s) { s->checksum = s->update_checksum(s->checksum, s->checksum_ptr, diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avio_internal.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avio_internal.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/avio_internal.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/avio_internal.h 2014-04-23 09:55:21.000000000 +0000 @@ -105,6 +105,8 @@ unsigned long ffio_get_checksum(AVIOContext *s); unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len); +unsigned long ff_crcA001_update(unsigned long checksum, const uint8_t *buf, + unsigned int len); /** * Open a write only packetized memory stream with a maximum packet diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/dsfdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/dsfdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/dsfdec.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/dsfdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,159 @@ +/* + * DSD Stream File (DSF) demuxer + * Copyright (c) 2014 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/intreadwrite.h" +#include "avformat.h" +#include "internal.h" +#include "id3v2.h" + +typedef struct { + uint64_t data_end; +} DSFContext; + +static int dsf_probe(AVProbeData *p) +{ + if (p->buf_size < 12 || memcmp(p->buf, "DSD ", 4) || AV_RL64(p->buf + 4) != 28) + return 0; + return AVPROBE_SCORE_MAX; +} + +static const uint64_t dsf_channel_layout[] = { + 0, + AV_CH_LAYOUT_MONO, + AV_CH_LAYOUT_STEREO, + AV_CH_LAYOUT_SURROUND, + AV_CH_LAYOUT_QUAD, + AV_CH_LAYOUT_4POINT0, + AV_CH_LAYOUT_5POINT0_BACK, + AV_CH_LAYOUT_5POINT1_BACK, +}; + +static void read_id3(AVFormatContext *s, uint64_t id3pos) +{ + ID3v2ExtraMeta *id3v2_extra_meta = NULL; + if (avio_seek(s->pb, id3pos, SEEK_SET) < 0) + return; + + ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, 0); + if (id3v2_extra_meta) + ff_id3v2_parse_apic(s, &id3v2_extra_meta); + ff_id3v2_free_extra_meta(&id3v2_extra_meta); +} + +static int dsf_read_header(AVFormatContext *s) +{ + DSFContext *dsf = s->priv_data; + AVIOContext *pb = s->pb; + AVStream *st; + uint64_t id3pos; + unsigned int channel_type; + + avio_skip(pb, 4); + if (avio_rl64(pb) != 28) + return AVERROR_INVALIDDATA; + + /* create primary stream before any id3 coverart streams */ + st = avformat_new_stream(s, NULL); + if (!st) + return AVERROR(ENOMEM); + + avio_skip(pb, 8); + id3pos = avio_rl64(pb); + if (pb->seekable) { + read_id3(s, id3pos); + avio_seek(pb, 28, SEEK_SET); + } + + /* fmt chunk */ + + if (avio_rl32(pb) != MKTAG('f', 'm', 't', ' ') || avio_rl64(pb) != 52) + return AVERROR_INVALIDDATA; + + if (avio_rl32(pb) != 1) { + avpriv_request_sample(s, "unknown format version"); + return AVERROR_INVALIDDATA; + } + + if (avio_rl32(pb)) { + avpriv_request_sample(s, "unknown format id"); + return AVERROR_INVALIDDATA; + } + + channel_type = avio_rl32(pb); + if (channel_type < FF_ARRAY_ELEMS(dsf_channel_layout)) + st->codec->channel_layout = dsf_channel_layout[channel_type]; + if (!st->codec->channel_layout) + avpriv_request_sample(s, "channel type %i", channel_type); + + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + st->codec->channels = avio_rl32(pb); + st->codec->sample_rate = avio_rl32(pb) / 8; + + switch(avio_rl32(pb)) { + case 1: st->codec->codec_id = AV_CODEC_ID_DSD_LSBF_PLANAR; break; + case 8: st->codec->codec_id = AV_CODEC_ID_DSD_MSBF_PLANAR; break; + default: + avpriv_request_sample(s, "unknown most significant bit"); + return AVERROR_INVALIDDATA; + } + + avio_skip(pb, 8); + st->codec->block_align = avio_rl32(pb); + if (st->codec->block_align > INT_MAX / st->codec->channels) { + avpriv_request_sample(s, "block_align overflow"); + return AVERROR_INVALIDDATA; + } + st->codec->block_align *= st->codec->channels; + avio_skip(pb, 4); + + /* data chunk */ + + dsf->data_end = avio_tell(pb); + if (avio_rl32(pb) != MKTAG('d', 'a', 't', 'a')) + return AVERROR_INVALIDDATA; + dsf->data_end += avio_rl64(pb); + + return 0; +} + +static int dsf_read_packet(AVFormatContext *s, AVPacket *pkt) +{ + DSFContext *dsf = s->priv_data; + AVIOContext *pb = s->pb; + AVStream *st = s->streams[0]; + int64_t pos = avio_tell(pb); + + if (pos >= dsf->data_end) + return AVERROR_EOF; + + pkt->stream_index = 0; + return av_get_packet(pb, pkt, FFMIN(dsf->data_end - pos, st->codec->block_align)); +} + +AVInputFormat ff_dsf_demuxer = { + .name = "dsf", + .long_name = NULL_IF_CONFIG_SMALL("DSD Stream File (DSF)"), + .priv_data_size = sizeof(DSFContext), + .read_probe = dsf_probe, + .read_header = dsf_read_header, + .read_packet = dsf_read_packet, + .flags = AVFMT_GENERIC_INDEX | AVFMT_NO_BYTE_SEEK, +}; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/flacdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/flacdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/flacdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/flacdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -162,12 +162,61 @@ return AVPROBE_SCORE_EXTENSION; } +static av_unused int64_t flac_read_timestamp(AVFormatContext *s, int stream_index, + int64_t *ppos, int64_t pos_limit) +{ + AVPacket pkt, out_pkt; + AVStream *st = s->streams[stream_index]; + AVCodecParserContext *parser; + int ret; + int64_t pts = AV_NOPTS_VALUE; + + if (avio_seek(s->pb, *ppos, SEEK_SET) < 0) + return AV_NOPTS_VALUE; + + av_init_packet(&pkt); + parser = av_parser_init(st->codec->codec_id); + if (!parser){ + return AV_NOPTS_VALUE; + } + parser->flags |= PARSER_FLAG_USE_CODEC_TS; + + for (;;){ + ret = ff_raw_read_partial_packet(s, &pkt); + if (ret < 0){ + if (ret == AVERROR(EAGAIN)) + continue; + else + break; + } + av_init_packet(&out_pkt); + ret = av_parser_parse2(parser, st->codec, + &out_pkt.data, &out_pkt.size, pkt.data, pkt.size, + pkt.pts, pkt.dts, *ppos); + + av_free_packet(&pkt); + if (out_pkt.size){ + int size = out_pkt.size; + if (parser->pts != AV_NOPTS_VALUE){ + // seeking may not have started from beginning of a frame + // calculate frame start position from next frame backwards + *ppos = parser->next_frame_offset - size; + pts = parser->pts; + break; + } + } + } + av_parser_close(parser); + return pts; +} + AVInputFormat ff_flac_demuxer = { .name = "flac", .long_name = NULL_IF_CONFIG_SMALL("raw FLAC"), .read_probe = flac_probe, .read_header = flac_read_header, .read_packet = ff_raw_read_partial_packet, + .read_timestamp = flac_read_timestamp, .flags = AVFMT_GENERIC_INDEX, .extensions = "flac", .raw_codec_id = AV_CODEC_ID_FLAC, diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/flvdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/flvdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/flvdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/flvdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -772,7 +772,7 @@ size = avio_rb24(s->pb); dts = avio_rb24(s->pb); dts |= avio_r8(s->pb) << 24; - av_dlog(s, "type:%d, size:%d, dts:%"PRId64"\n", type, size, dts); + av_dlog(s, "type:%d, size:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, dts, avio_tell(s->pb)); if (url_feof(s->pb)) return AVERROR_EOF; avio_skip(s->pb, 3); /* stream id, always 0 */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/hnm.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/hnm.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/hnm.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/hnm.c 2014-04-23 09:55:21.000000000 +0000 @@ -92,7 +92,7 @@ hnm->currentframe = 0; - if (hnm->width < 320 || hnm->width > 640 || + if (hnm->width < 256 || hnm->width > 640 || hnm->height < 150 || hnm->height > 480) { av_log(s, AV_LOG_ERROR, "invalid resolution: %ux%u\n", hnm->width, hnm->height); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/icodec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/icodec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/icodec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/icodec.c 2014-04-23 09:55:21.000000000 +0000 @@ -58,7 +58,7 @@ avio_skip(pb, 4); ico->nb_images = avio_rl16(pb); - ico->images = av_malloc(ico->nb_images * sizeof(IcoImage)); + ico->images = av_malloc_array(ico->nb_images, sizeof(IcoImage)); if (!ico->images) return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/icoenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/icoenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/icoenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/icoenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -101,7 +101,7 @@ avio_skip(pb, 16); } - ico->images = av_mallocz(ico->nb_images * sizeof(IcoMuxContext)); + ico->images = av_mallocz_array(ico->nb_images, sizeof(IcoMuxContext)); if (!ico->images) return AVERROR(ENOMEM); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/id3v2.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/id3v2.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/id3v2.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/id3v2.c 2014-04-23 09:55:21.000000000 +0000 @@ -880,16 +880,25 @@ static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata, AVFormatContext *s, const char *magic, - ID3v2ExtraMeta **extra_meta) + ID3v2ExtraMeta **extra_meta, int64_t max_search_size) { int len, ret; uint8_t buf[ID3v2_HEADER_SIZE]; int found_header; - int64_t off; + int64_t start, off; + if (max_search_size && max_search_size < ID3v2_HEADER_SIZE) + return; + + start = avio_tell(pb); do { /* save the current offset in case there's nothing to read/skip */ off = avio_tell(pb); + if (max_search_size && off - start >= max_search_size - ID3v2_HEADER_SIZE) { + avio_seek(pb, off, SEEK_SET); + break; + } + ret = avio_read(pb, buf, ID3v2_HEADER_SIZE); if (ret != ID3v2_HEADER_SIZE) { avio_seek(pb, off, SEEK_SET); @@ -916,13 +925,13 @@ void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta) { - id3v2_read_internal(pb, metadata, NULL, magic, extra_meta); + id3v2_read_internal(pb, metadata, NULL, magic, extra_meta, 0); } void ff_id3v2_read(AVFormatContext *s, const char *magic, - ID3v2ExtraMeta **extra_meta) + ID3v2ExtraMeta **extra_meta, unsigned int max_search_size) { - id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta); + id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta, max_search_size); } void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta) @@ -937,6 +946,8 @@ av_freep(¤t); current = next; } + + *extra_meta = NULL; } int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/id3v2.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/id3v2.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/id3v2.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/id3v2.h 2014-04-23 09:55:21.000000000 +0000 @@ -112,8 +112,10 @@ * * @param extra_meta If not NULL, extra metadata is parsed into a list of * ID3v2ExtraMeta structs and *extra_meta points to the head of the list + * @param[opt] max_search_search restrict ID3 magic number search (bytes from start) */ -void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta); +void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta, + unsigned int max_search_size); /** * Initialize an ID3v2 tag. diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/iff.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/iff.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/iff.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/iff.c 2014-04-23 09:55:21.000000000 +0000 @@ -36,6 +36,7 @@ #include "libavutil/dict.h" #include "libavcodec/bytestream.h" #include "avformat.h" +#include "id3v2.h" #include "internal.h" #define ID_8SVX MKTAG('8','S','V','X') @@ -57,8 +58,10 @@ #define ID_DEEP MKTAG('D','E','E','P') #define ID_RGB8 MKTAG('R','G','B','8') #define ID_RGBN MKTAG('R','G','B','N') +#define ID_DSD MKTAG('D','S','D',' ') #define ID_FORM MKTAG('F','O','R','M') +#define ID_FRM8 MKTAG('F','R','M','8') #define ID_ANNO MKTAG('A','N','N','O') #define ID_AUTH MKTAG('A','U','T','H') #define ID_CHRS MKTAG('C','H','R','S') @@ -95,6 +98,7 @@ } svx8_compression_type; typedef struct { + int is_64bit; ///< chunk size is 64-bit int64_t body_pos; int64_t body_end; uint32_t body_size; @@ -133,7 +137,7 @@ { const uint8_t *d = p->buf; - if ( AV_RL32(d) == ID_FORM && + if ( (AV_RL32(d) == ID_FORM && (AV_RL32(d+8) == ID_8SVX || AV_RL32(d+8) == ID_16SV || AV_RL32(d+8) == ID_MAUD || @@ -142,11 +146,188 @@ AV_RL32(d+8) == ID_DEEP || AV_RL32(d+8) == ID_ILBM || AV_RL32(d+8) == ID_RGB8 || - AV_RL32(d+8) == ID_RGBN) ) + AV_RL32(d+8) == ID_RGB8 || + AV_RL32(d+8) == ID_RGBN)) || + (AV_RL32(d) == ID_FRM8 && AV_RL32(d+12) == ID_DSD)) return AVPROBE_SCORE_MAX; return 0; } +static const AVCodecTag dsd_codec_tags[] = { + { AV_CODEC_ID_DSD_MSBF, ID_DSD }, + { AV_CODEC_ID_NONE, 0 }, +}; + + +#define DSD_SLFT MKTAG('S','L','F','T') +#define DSD_SRGT MKTAG('S','R','G','T') +#define DSD_MLFT MKTAG('M','L','F','T') +#define DSD_MRGT MKTAG('M','R','G','T') +#define DSD_C MKTAG('C',' ',' ',' ') +#define DSD_LS MKTAG('L','S',' ',' ') +#define DSD_RS MKTAG('R','S',' ',' ') +#define DSD_LFE MKTAG('L','F','E',' ') + +static const uint32_t dsd_stereo[] = { DSD_SLFT, DSD_SRGT }; +static const uint32_t dsd_5point0[] = { DSD_MLFT, DSD_MRGT, DSD_C, DSD_LS, DSD_RS }; +static const uint32_t dsd_5point1[] = { DSD_MLFT, DSD_MRGT, DSD_C, DSD_LFE, DSD_LS, DSD_RS }; + +typedef struct { + uint64_t layout; + const uint32_t * dsd_layout; +} DSDLayoutDesc; + +static const DSDLayoutDesc dsd_channel_layout[] = { + { AV_CH_LAYOUT_STEREO, dsd_stereo }, + { AV_CH_LAYOUT_5POINT0, dsd_5point0 }, + { AV_CH_LAYOUT_5POINT1, dsd_5point1 }, +}; + +static const uint64_t dsd_loudspeaker_config[] = { + AV_CH_LAYOUT_STEREO, + 0, 0, + AV_CH_LAYOUT_5POINT0, AV_CH_LAYOUT_5POINT1, +}; + +static const char * dsd_source_comment[] = { + "dsd_source_comment", + "analogue_source_comment", + "pcm_source_comment", +}; + +static const char * dsd_history_comment[] = { + "general_remark", + "operator_name", + "creating_machine", + "timezone", + "file_revision" +}; + +static int parse_dsd_diin(AVFormatContext *s, AVStream *st, uint64_t eof) +{ + AVIOContext *pb = s->pb; + + while (avio_tell(pb) + 12 <= eof) { + uint32_t tag = avio_rl32(pb); + uint64_t size = avio_rb64(pb); + uint64_t orig_pos = avio_tell(pb); + const char * metadata_tag = NULL; + + switch(tag) { + case MKTAG('D','I','A','R'): metadata_tag = "artist"; break; + case MKTAG('D','I','T','I'): metadata_tag = "title"; break; + } + + if (metadata_tag && size > 4) { + unsigned int tag_size = avio_rb32(pb); + int ret = get_metadata(s, metadata_tag, FFMIN(tag_size, size - 4)); + if (ret < 0) { + av_log(s, AV_LOG_ERROR, "cannot allocate metadata tag %s!\n", metadata_tag); + return ret; + } + } + + avio_skip(pb, size - (avio_tell(pb) - orig_pos) + (size & 1)); + } + + return 0; +} + +static int parse_dsd_prop(AVFormatContext *s, AVStream *st, uint64_t eof) +{ + AVIOContext *pb = s->pb; + char abss[24]; + int hour, min, sec, i, ret, config; + int dsd_layout[6]; + ID3v2ExtraMeta *id3v2_extra_meta; + + while (avio_tell(pb) + 12 <= eof) { + uint32_t tag = avio_rl32(pb); + uint64_t size = avio_rb64(pb); + uint64_t orig_pos = avio_tell(pb); + + switch(tag) { + case MKTAG('A','B','S','S'): + if (size < 8) + return AVERROR_INVALIDDATA; + hour = avio_rb16(pb); + min = avio_r8(pb); + sec = avio_r8(pb); + snprintf(abss, sizeof(abss), "%02dh:%02dm:%02ds:%d", hour, min, sec, avio_rb32(pb)); + av_dict_set(&st->metadata, "absolute_start_time", abss, 0); + break; + + case MKTAG('C','H','N','L'): + if (size < 2) + return AVERROR_INVALIDDATA; + st->codec->channels = avio_rb16(pb); + if (size < 2 + st->codec->channels * 4) + return AVERROR_INVALIDDATA; + st->codec->channel_layout = 0; + if (st->codec->channels > FF_ARRAY_ELEMS(dsd_layout)) { + avpriv_request_sample(s, "channel layout"); + break; + } + for (i = 0; i < st->codec->channels; i++) + dsd_layout[i] = avio_rl32(pb); + for (i = 0; i < FF_ARRAY_ELEMS(dsd_channel_layout); i++) { + const DSDLayoutDesc * d = &dsd_channel_layout[i]; + if (av_get_channel_layout_nb_channels(d->layout) == st->codec->channels && + !memcmp(d->dsd_layout, dsd_layout, st->codec->channels * sizeof(uint32_t))) { + st->codec->channel_layout = d->layout; + break; + } + } + break; + + case MKTAG('C','M','P','R'): + if (size < 4) + return AVERROR_INVALIDDATA; + st->codec->codec_id = ff_codec_get_id(dsd_codec_tags, avio_rl32(pb)); + break; + + case MKTAG('F','S',' ',' '): + if (size < 4) + return AVERROR_INVALIDDATA; + st->codec->sample_rate = avio_rb32(pb) / 8; + break; + + case MKTAG('I','D','3',' '): + id3v2_extra_meta = NULL; + ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, size); + if (id3v2_extra_meta) { + if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) { + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + return ret; + } + ff_id3v2_free_extra_meta(&id3v2_extra_meta); + } + + if (size < avio_tell(pb) - orig_pos) { + av_log(s, AV_LOG_ERROR, "id3 exceeds chunk size\n"); + return AVERROR_INVALIDDATA; + } + break; + + case MKTAG('L','S','C','O'): + if (size < 2) + return AVERROR_INVALIDDATA; + config = avio_rb16(pb); + if (config != 0xFFFF) { + if (config < FF_ARRAY_ELEMS(dsd_loudspeaker_config)) + st->codec->channel_layout = dsd_loudspeaker_config[config]; + if (!st->codec->channel_layout) + avpriv_request_sample(s, "loudspeaker configuration %d", config); + } + break; + } + + avio_skip(pb, size - (avio_tell(pb) - orig_pos) + (size & 1)); + } + + return 0; +} + static const uint8_t deep_rgb24[] = {0, 0, 0, 3, 0, 1, 0, 8, 0, 2, 0, 8, 0, 3, 0, 8}; static const uint8_t deep_rgba[] = {0, 0, 0, 4, 0, 1, 0, 8, 0, 2, 0, 8, 0, 3, 0, 8}; static const uint8_t deep_bgra[] = {0, 0, 0, 4, 0, 3, 0, 8, 0, 2, 0, 8, 0, 1, 0, 8}; @@ -159,7 +340,8 @@ AVIOContext *pb = s->pb; AVStream *st; uint8_t *buf; - uint32_t chunk_id, data_size; + uint32_t chunk_id; + uint64_t data_size; uint32_t screenmode = 0, num, den; unsigned transparency = 0; unsigned masking = 0; // no mask @@ -172,7 +354,8 @@ st->codec->channels = 1; st->codec->channel_layout = AV_CH_LAYOUT_MONO; - avio_skip(pb, 8); + iff->is_64bit = avio_rl32(pb) == ID_FRM8; + avio_skip(pb, iff->is_64bit ? 8 : 4); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content st->codec->codec_tag = avio_rl32(pb); iff->bitmap_compression = -1; @@ -184,8 +367,9 @@ uint64_t orig_pos; int res; const char *metadata_tag = NULL; + int version, nb_comments, i; chunk_id = avio_rl32(pb); - data_size = avio_rb32(pb); + data_size = iff->is_64bit ? avio_rb64(pb) : avio_rb32(pb); orig_pos = avio_tell(pb); switch(chunk_id) { @@ -227,6 +411,7 @@ case ID_ABIT: case ID_BODY: case ID_DBOD: + case ID_DSD: case ID_MDAT: iff->body_pos = avio_tell(pb); iff->body_end = iff->body_pos + data_size; @@ -253,7 +438,7 @@ case ID_CMAP: if (data_size < 3 || data_size > 768 || data_size % 3) { - av_log(s, AV_LOG_ERROR, "Invalid CMAP chunk size %"PRIu32"\n", + av_log(s, AV_LOG_ERROR, "Invalid CMAP chunk size %"PRIu64"\n", data_size); return AVERROR_INVALIDDATA; } @@ -340,6 +525,84 @@ case ID_AUTH: metadata_tag = "artist"; break; case ID_COPYRIGHT: metadata_tag = "copyright"; break; case ID_NAME: metadata_tag = "title"; break; + + /* DSD tags */ + + case MKTAG('F','V','E','R'): + if (data_size < 4) + return AVERROR_INVALIDDATA; + version = avio_rb32(pb); + av_log(s, AV_LOG_DEBUG, "DSIFF v%d.%d.%d.%d\n",version >> 24, (version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF); + st->codec->codec_type = AVMEDIA_TYPE_AUDIO; + break; + + case MKTAG('D','I','I','N'): + res = parse_dsd_diin(s, st, orig_pos + data_size); + if (res < 0) + return res; + break; + + case MKTAG('P','R','O','P'): + if (data_size < 4) + return AVERROR_INVALIDDATA; + if (avio_rl32(pb) != MKTAG('S','N','D',' ')) { + avpriv_request_sample(s, "unknown property type"); + break; + } + res = parse_dsd_prop(s, st, orig_pos + data_size); + if (res < 0) + return res; + break; + + case MKTAG('C','O','M','T'): + if (data_size < 2) + return AVERROR_INVALIDDATA; + nb_comments = avio_rb16(pb); + for (i = 0; i < nb_comments; i++) { + int year, mon, day, hour, min, type, ref; + char tmp[24]; + const char *tag; + int metadata_size; + + year = avio_rb16(pb); + mon = avio_r8(pb); + day = avio_r8(pb); + hour = avio_r8(pb); + min = avio_r8(pb); + snprintf(tmp, sizeof(tmp), "%04d-%02d-%02d %02d:%02d", year, mon, day, hour, min); + av_dict_set(&st->metadata, "comment_time", tmp, 0); + + type = avio_rb16(pb); + ref = avio_rb16(pb); + switch (type) { + case 1: + if (!i) + tag = "channel_comment"; + else { + snprintf(tmp, sizeof(tmp), "channel%d_comment", ref); + tag = tmp; + } + break; + case 2: + tag = ref < FF_ARRAY_ELEMS(dsd_source_comment) ? dsd_history_comment[ref] : "source_comment"; + break; + case 3: + tag = ref < FF_ARRAY_ELEMS(dsd_history_comment) ? dsd_history_comment[ref] : "file_history"; + break; + default: + tag = "comment"; + } + + metadata_size = avio_rb32(pb); + if ((res = get_metadata(s, tag, metadata_size)) < 0) { + av_log(s, AV_LOG_ERROR, "cannot allocate metadata tag %s!\n", tag); + return res; + } + + if (metadata_size & 1) + avio_skip(pb, 1); + } + break; } if (metadata_tag) { @@ -372,7 +635,7 @@ avpriv_request_sample(s, "compression %d and bit depth %d", iff->maud_compression, iff->maud_bits); return AVERROR_PATCHWELCOME; } - } else { + } else if (st->codec->codec_tag != ID_DSD) { switch (iff->svx8_compression) { case COMP_NONE: st->codec->codec_id = AV_CODEC_ID_PCM_S8_PLANAR; @@ -443,7 +706,7 @@ return AVERROR_EOF; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - if (st->codec->codec_tag == ID_MAUD) { + if (st->codec->codec_tag == ID_DSD || st->codec->codec_tag == ID_MAUD) { ret = av_get_packet(pb, pkt, FFMIN(iff->body_end - pos, 1024 * st->codec->block_align)); } else { ret = av_get_packet(pb, pkt, iff->body_size); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/img2dec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/img2dec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/img2dec.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/img2dec.c 2014-04-23 09:55:21.000000000 +0000 @@ -481,8 +481,8 @@ { "frame_size", "force frame size in bytes", OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, DEC }, { "ts_from_file", "set frame timestamp from file's one", OFFSET(ts_from_file), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 2, DEC, "ts_type" }, { "none", "none", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, 0, 2, DEC, "ts_type" }, - { "sec", "second precission", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, "ts_type" }, - { "ns", "nano second precission", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, "ts_type" }, + { "sec", "second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 1 }, 0, 2, DEC, "ts_type" }, + { "ns", "nano second precision", 0, AV_OPT_TYPE_CONST, {.i64 = 2 }, 0, 2, DEC, "ts_type" }, { NULL }, }; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/internal.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/internal.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/internal.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/internal.h 2014-04-23 09:55:21.000000000 +0000 @@ -52,6 +52,8 @@ * Muxing only. */ int nb_interleaved_streams; + + int inject_global_side_data; }; #ifdef __GNUC__ @@ -358,11 +360,11 @@ /** * Chooses a timebase for muxing the specified stream. * - * The choosen timebase allows sample accurate timestamps based + * The chosen timebase allows sample accurate timestamps based * on the framerate or sample rate for audio streams. It also is - * at least as precisse as 1/min_precission would be. + * at least as precise as 1/min_precision would be. */ -AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission); +AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precision); /** * Generate standard extradata for AVC-Intra based on width/height and field diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/Makefile ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/Makefile --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/Makefile 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/Makefile 2014-04-23 09:55:21.000000000 +0000 @@ -84,7 +84,7 @@ OBJS-$(CONFIG_AU_DEMUXER) += au.o pcm.o OBJS-$(CONFIG_AU_MUXER) += au.o rawenc.o OBJS-$(CONFIG_AVI_DEMUXER) += avidec.o -OBJS-$(CONFIG_AVI_MUXER) += avienc.o +OBJS-$(CONFIG_AVI_MUXER) += avienc.o avlanguage.o OBJS-$(CONFIG_AVISYNTH) += avisynth.o OBJS-$(CONFIG_AVM2_MUXER) += swfenc.o swf.o OBJS-$(CONFIG_AVR_DEMUXER) += avr.o pcm.o @@ -118,6 +118,7 @@ OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o OBJS-$(CONFIG_DNXHD_MUXER) += rawenc.o +OBJS-$(CONFIG_DSF_DEMUXER) += dsfdec.o OBJS-$(CONFIG_DSICIN_DEMUXER) += dsicin.o OBJS-$(CONFIG_DTSHD_DEMUXER) += dtshddec.o OBJS-$(CONFIG_DTS_DEMUXER) += dtsdec.o rawdec.o @@ -217,6 +218,7 @@ OBJS-$(CONFIG_MJPEG_MUXER) += rawenc.o OBJS-$(CONFIG_MLP_DEMUXER) += rawdec.o OBJS-$(CONFIG_MLP_MUXER) += rawenc.o +OBJS-$(CONFIG_MLV_DEMUXER) += mlvdec.o riffdec.o OBJS-$(CONFIG_MM_DEMUXER) += mm.o OBJS-$(CONFIG_MMF_DEMUXER) += mmf.o OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o @@ -244,8 +246,8 @@ OBJS-$(CONFIG_MPSUB_DEMUXER) += mpsubdec.o subtitles.o OBJS-$(CONFIG_MSNWC_TCP_DEMUXER) += msnwc_tcp.o OBJS-$(CONFIG_MTV_DEMUXER) += mtv.o -OBJS-$(CONFIG_MVI_DEMUXER) += mvi.o OBJS-$(CONFIG_MV_DEMUXER) += mvdec.o +OBJS-$(CONFIG_MVI_DEMUXER) += mvi.o OBJS-$(CONFIG_MXF_DEMUXER) += mxfdec.o mxf.o OBJS-$(CONFIG_MXF_MUXER) += mxfenc.o mxf.o audiointerleave.o OBJS-$(CONFIG_MXG_DEMUXER) += mxg.o diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/matroskadec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/matroskadec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/matroskadec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/matroskadec.c 2014-04-23 09:55:21.000000000 +0000 @@ -2545,7 +2545,8 @@ pkt_data = wv_data; } - if (st->codec->codec_id == AV_CODEC_ID_PRORES) + if (st->codec->codec_id == AV_CODEC_ID_PRORES && + AV_RB32(&data[4]) != MKBETAG('i', 'c', 'p', 'f')) offset = 8; pkt = av_mallocz(sizeof(AVPacket)); @@ -2556,7 +2557,7 @@ goto fail; } - if (st->codec->codec_id == AV_CODEC_ID_PRORES) { + if (st->codec->codec_id == AV_CODEC_ID_PRORES && offset == 8) { uint8_t *buf = pkt->data; bytestream_put_be32(&buf, pkt_size); bytestream_put_be32(&buf, MKBETAG('i', 'c', 'p', 'f')); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mlvdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mlvdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mlvdec.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mlvdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,458 @@ +/* + * Magic Lantern Video (MLV) demuxer + * Copyright (c) 2014 Peter Ross + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Magic Lantern Video (MLV) demuxer + */ + +#include "libavutil/eval.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/rational.h" +#include "avformat.h" +#include "internal.h" +#include "riff.h" + +#define MLV_VERSION "v2.0" + +#define MLV_VIDEO_CLASS_RAW 1 +#define MLV_VIDEO_CLASS_YUV 2 +#define MLV_VIDEO_CLASS_JPEG 3 +#define MLV_VIDEO_CLASS_H264 4 + +#define MLV_AUDIO_CLASS_WAV 1 + +#define MLV_CLASS_FLAG_DELTA 0x40 +#define MLV_CLASS_FLAG_LZMA 0x80 + +typedef struct { + AVIOContext *pb[101]; + int class[2]; + int stream_index; + uint64_t pts; + uint8_t * buffer; + unsigned int buffer_size; +} MlvContext; + +static int probe(AVProbeData *p) +{ + if (AV_RL32(p->buf) == MKTAG('M','L','V','I') && + AV_RL32(p->buf + 4) >= 52 && + !memcmp(p->buf + 8, MLV_VERSION, 5)) + return AVPROBE_SCORE_MAX; + return 0; +} + +static int check_file_header(AVIOContext *pb, uint64_t guid) +{ + unsigned int size; + uint8_t version[8]; + + avio_skip(pb, 4); + size = avio_rl32(pb); + if (size < 52) + return AVERROR_INVALIDDATA; + avio_read(pb, version, 8); + if (memcmp(version, MLV_VERSION, 5) || avio_rl64(pb) != guid) + return AVERROR_INVALIDDATA; + avio_skip(pb, size - 24); + return 0; +} + +static void read_string(AVFormatContext *avctx, AVIOContext *pb, const char *tag, int size) +{ + char * value = av_malloc(size + 1); + if (!value) { + avio_skip(pb, size); + return; + } + + avio_read(pb, value, size); + if (!value[0]) { + av_free(value); + return; + } + + value[size] = 0; + av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL); +} + +static void read_uint8(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt) +{ + char value[4]; + snprintf(value, sizeof(value), "%i", avio_r8(pb)); + av_dict_set(&avctx->metadata, tag, value, 0); +} + +static void read_uint16(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt) +{ + char value[8]; + snprintf(value, sizeof(value), "%i", avio_rl16(pb)); + av_dict_set(&avctx->metadata, tag, value, 0); +} + +static void read_uint32(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt) +{ + char value[16]; + snprintf(value, sizeof(value), fmt, avio_rl32(pb)); + av_dict_set(&avctx->metadata, tag, value, 0); +} + +static void read_uint64(AVFormatContext *avctx, AVIOContext *pb, const char *tag, const char *fmt) +{ + char value[32]; + snprintf(value, sizeof(value), fmt, avio_rl64(pb)); + av_dict_set(&avctx->metadata, tag, value, 0); +} + +static void scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int file) +{ + MlvContext *mlv = avctx->priv_data; + AVIOContext *pb = mlv->pb[file]; + while (!url_feof(pb)) { + int type; + unsigned int size; + type = avio_rl32(pb); + size = avio_rl32(pb); + avio_skip(pb, 8); //timestamp + if (size < 16) + break; + size -= 16; + if (vst && type == MKTAG('R','A','W','I') && size >= 164) { + vst->codec->width = avio_rl16(pb); + vst->codec->height = avio_rl16(pb); + if (avio_rl32(pb) != 1) + avpriv_request_sample(avctx, "raw api version"); + avio_skip(pb, 20); // pointer, width, height, pitch, frame_size + vst->codec->bits_per_coded_sample = avio_rl32(pb); + avio_skip(pb, 8 + 16 + 24); // black_level, white_level, xywh, active_area, exposure_bias + if (avio_rl32(pb) != 0x2010100) /* RGGB */ + avpriv_request_sample(avctx, "cfa_pattern"); + avio_skip(pb, 80); // calibration_illuminant1, color_matrix1, dynamic_range + vst->codec->pix_fmt = AV_PIX_FMT_BAYER_RGGB16LE; + vst->codec->codec_tag = MKTAG('B', 'I', 'T', 16); + size -= 164; + } else if (ast && type == MKTAG('W', 'A', 'V', 'I') && size >= 16) { + ff_get_wav_header(pb, ast->codec, 16); + size -= 16; + } else if (type == MKTAG('I','N','F','O')) { + if (size > 0) + read_string(avctx, pb, "info", size); + continue; + } else if (type == MKTAG('I','D','N','T') && size >= 36) { + read_string(avctx, pb, "cameraName", 32); + read_uint32(avctx, pb, "cameraModel", "0x%"PRIx32); + size -= 36; + if (size >= 32) { + read_string(avctx, pb, "cameraSerial", 32); + size -= 32; + } + } else if (type == MKTAG('L','E','N','S') && size >= 48) { + read_uint16(avctx, pb, "focalLength", "%i"); + read_uint16(avctx, pb, "focalDist", "%i"); + read_uint16(avctx, pb, "aperture", "%i"); + read_uint8(avctx, pb, "stabilizerMode", "%i"); + read_uint8(avctx, pb, "autofocusMode", "%i"); + read_uint32(avctx, pb, "flags", "0x%"PRIx32); + read_uint32(avctx, pb, "lensID", "%"PRIi32); + read_string(avctx, pb, "lensName", 32); + size -= 48; + if (size >= 32) { + read_string(avctx, pb, "lensSerial", 32); + size -= 32; + } + } else if (vst && type == MKTAG('V', 'I', 'D', 'F') && size >= 4) { + uint64_t pts = avio_rl32(pb); + ff_add_index_entry(&vst->index_entries, &vst->nb_index_entries, &vst->index_entries_allocated_size, + avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME); + size -= 4; + } else if (ast && type == MKTAG('A', 'U', 'D', 'F') && size >= 4) { + uint64_t pts = avio_rl32(pb); + ff_add_index_entry(&ast->index_entries, &ast->nb_index_entries, &ast->index_entries_allocated_size, + avio_tell(pb) - 20, pts, file, 0, AVINDEX_KEYFRAME); + size -= 4; + } else if (vst && type == MKTAG('W','B','A','L') && size >= 28) { + read_uint32(avctx, pb, "wb_mode", "%"PRIi32); + read_uint32(avctx, pb, "kelvin", "%"PRIi32); + read_uint32(avctx, pb, "wbgain_r", "%"PRIi32); + read_uint32(avctx, pb, "wbgain_g", "%"PRIi32); + read_uint32(avctx, pb, "wbgain_b", "%"PRIi32); + read_uint32(avctx, pb, "wbs_gm", "%"PRIi32); + read_uint32(avctx, pb, "wbs_ba", "%"PRIi32); + size -= 28; + } else if (type == MKTAG('R','T','C','I') && size >= 20) { + char str[32]; + struct tm time = { 0 }; + time.tm_sec = avio_rl16(pb); + time.tm_min = avio_rl16(pb); + time.tm_hour = avio_rl16(pb); + time.tm_mday = avio_rl16(pb); + time.tm_mon = avio_rl16(pb); + time.tm_year = avio_rl16(pb); + time.tm_wday = avio_rl16(pb); + time.tm_yday = avio_rl16(pb); + time.tm_isdst = avio_rl16(pb); + avio_skip(pb, 2); + strftime(str, sizeof(str), "%Y-%m-%d %H:%M:%S", &time); + av_dict_set(&avctx->metadata, "time", str, 0); + size -= 20; + } else if (type == MKTAG('E','X','P','O') && size >= 16) { + av_dict_set(&avctx->metadata, "isoMode", avio_rl32(pb) ? "auto" : "manual", 0); + read_uint32(avctx, pb, "isoValue", "%"PRIi32); + read_uint32(avctx, pb, "isoAnalog", "%"PRIi32); + read_uint32(avctx, pb, "digitalGain", "%"PRIi32); + size -= 16; + if (size >= 8) { + read_uint64(avctx, pb, "shutterValue", "%"PRIi64); + size -= 8; + } + } else if (type == MKTAG('S','T','Y','L') && size >= 36) { + read_uint32(avctx, pb, "picStyleId", "%"PRIi32); + read_uint32(avctx, pb, "contrast", "%"PRIi32); + read_uint32(avctx, pb, "sharpness", "%"PRIi32); + read_uint32(avctx, pb, "saturation", "%"PRIi32); + read_uint32(avctx, pb, "colortone", "%"PRIi32); + read_string(avctx, pb, "picStyleName", 16); + size -= 36; + } else if (type == MKTAG('M','A','R','K')) { + } else if (type == MKTAG('N','U','L','L')) { + } else if (type == MKTAG('M','L','V','I')) { /* occurs when MLV and Mnn files are concatenated */ + } else { + av_log(avctx, AV_LOG_INFO, "unsupported tag %c%c%c%c, size %d\n", type&0xFF, (type>>8)&0xFF, (type>>16)&0xFF, (type>>24)&0xFF, size); + } + avio_skip(pb, size); + } +} + +static int read_header(AVFormatContext *avctx) +{ + MlvContext *mlv = avctx->priv_data; + AVIOContext *pb = avctx->pb; + AVStream *vst = NULL, *ast = NULL; + int size; + uint64_t guid; + char guidstr[32]; + + avio_skip(pb, 4); + size = avio_rl32(pb); + if (size < 52) + return AVERROR_INVALIDDATA; + + avio_skip(pb, 8); + + guid = avio_rl64(pb); + snprintf(guidstr, sizeof(guidstr), "0x%"PRIx64, guid); + av_dict_set(&avctx->metadata, "guid", guidstr, 0); + + avio_skip(pb, 8); //fileNum, fileCount, fileFlags + + mlv->class[0] = avio_rl16(pb); + if (mlv->class[0]) { + vst = avformat_new_stream(avctx, NULL); + if (!vst) + return AVERROR(ENOMEM); + vst->id = 0; + if ((mlv->class[0] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) + avpriv_request_sample(avctx, "compression"); + vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; + switch (mlv->class[0] & ~(MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)) { + case MLV_VIDEO_CLASS_RAW: + vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; + break; + case MLV_VIDEO_CLASS_YUV: + vst->codec->pix_fmt = AV_PIX_FMT_YUV420P; + vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; + vst->codec->codec_tag = 0; + break; + case MLV_VIDEO_CLASS_JPEG: + vst->codec->codec_id = AV_CODEC_ID_MJPEG; + vst->codec->codec_tag = 0; + break; + case MLV_VIDEO_CLASS_H264: + vst->codec->codec_id = AV_CODEC_ID_H264; + vst->codec->codec_tag = 0; + break; + default: + avpriv_request_sample(avctx, "unknown video class"); + } + } + + mlv->class[1] = avio_rl16(pb); + if (mlv->class[1]) { + ast = avformat_new_stream(avctx, NULL); + if (!ast) + return AVERROR(ENOMEM); + ast->id = 1; + if ((mlv->class[1] & MLV_CLASS_FLAG_LZMA)) + avpriv_request_sample(avctx, "compression"); + if ((mlv->class[1] & ~MLV_CLASS_FLAG_LZMA) != MLV_AUDIO_CLASS_WAV) + avpriv_request_sample(avctx, "unknown audio class"); + + ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; + avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate); + } + + if (vst) + vst->nb_frames = avio_rl32(pb); + else + avio_skip(pb, 4); + + if (ast) + ast->nb_frames = avio_rl32(pb); + else + avio_skip(pb, 4); + + if (vst) { + AVRational framerate; + framerate.num = avio_rl32(pb); + framerate.den = avio_rl32(pb); + avpriv_set_pts_info(vst, 64, framerate.den, framerate.num); + } else + avio_skip(pb, 8); + + avio_skip(pb, size - 52); + + /* scan primary file */ + mlv->pb[100] = avctx->pb; + scan_file(avctx, vst, ast, 100); + + /* scan secondary files */ + if (strlen(avctx->filename) > 2) { + int i; + char *filename = av_strdup(avctx->filename); + if (!filename) + return AVERROR(ENOMEM); + for (i = 0; i < 100; i++) { + snprintf(filename + strlen(filename) - 2, 3, "%02d", i); + if (avio_open2(&mlv->pb[i], filename, AVIO_FLAG_READ, &avctx->interrupt_callback, NULL) < 0) + break; + if (check_file_header(mlv->pb[i], guid) < 0) { + av_log(avctx, AV_LOG_WARNING, "ignoring %s; bad format or guid mismatch\n", filename); + avio_close(mlv->pb[i]); + mlv->pb[i] = NULL; + continue; + } + av_log(avctx, AV_LOG_INFO, "scanning %s\n", filename); + scan_file(avctx, vst, ast, i); + } + av_free(filename); + } + + if (vst) + vst->duration = vst->nb_index_entries; + if (ast) + ast->duration = ast->nb_index_entries; + + if (vst && ast) + avio_seek(pb, FFMIN(vst->index_entries[0].pos, ast->index_entries[0].pos), SEEK_SET); + else if (vst) + avio_seek(pb, vst->index_entries[0].pos, SEEK_SET); + else if (ast) + avio_seek(pb, ast->index_entries[0].pos, SEEK_SET); + + return 0; +} + +static int read_packet(AVFormatContext *avctx, AVPacket *pkt) +{ + MlvContext *mlv = avctx->priv_data; + AVIOContext *pb; + AVStream *st = avctx->streams[mlv->stream_index]; + int index, ret; + unsigned int size, space; + + if (mlv->pts >= st->duration) + return AVERROR_EOF; + + index = av_index_search_timestamp(st, mlv->pts, AVSEEK_FLAG_ANY); + if (index < 0) { + av_log(avctx, AV_LOG_ERROR, "could not find index entry for frame %"PRId64"\n", mlv->pts); + return AVERROR(EIO); + } + + pb = mlv->pb[st->index_entries[index].size]; + avio_seek(pb, st->index_entries[index].pos, SEEK_SET); + + avio_skip(pb, 4); // blockType + size = avio_rl32(pb); + if (size < 16) + return AVERROR_INVALIDDATA; + avio_skip(pb, 12); //timestamp, frameNumber + if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + avio_skip(pb, 8); // cropPosX, cropPosY, panPosX, panPosY + space = avio_rl32(pb); + avio_skip(pb, space); + + if ((mlv->class[st->id] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA))) { + ret = AVERROR_PATCHWELCOME; + } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + ret = av_get_packet(pb, pkt, (st->codec->width * st->codec->height * st->codec->bits_per_coded_sample + 7) >> 3); + } else { // AVMEDIA_TYPE_AUDIO + if (space > UINT_MAX - 24 || size < (24 + space)) + return AVERROR_INVALIDDATA; + ret = av_get_packet(pb, pkt, size - (24 + space)); + } + + if (ret < 0) + return ret; + + pkt->stream_index = mlv->stream_index; + pkt->pts = mlv->pts; + + mlv->stream_index++; + if (mlv->stream_index == avctx->nb_streams) { + mlv->stream_index = 0; + mlv->pts++; + } + return 0; +} + +static int read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags) +{ + MlvContext *mlv = avctx->priv_data; + + if ((flags & AVSEEK_FLAG_FRAME) || (flags & AVSEEK_FLAG_BYTE)) + return AVERROR(ENOSYS); + + if (!avctx->pb->seekable) + return AVERROR(EIO); + + mlv->pts = timestamp; + return 0; +} + +static int read_close(AVFormatContext *s) +{ + MlvContext *mlv = s->priv_data; + av_freep(&mlv->buffer); + return 0; +} + +AVInputFormat ff_mlv_demuxer = { + .name = "mlv", + .long_name = NULL_IF_CONFIG_SMALL("Magic Lantern Video (MLV)"), + .priv_data_size = sizeof(MlvContext), + .read_probe = probe, + .read_header = read_header, + .read_packet = read_packet, + .read_close = read_close, + .read_seek = read_seek, +}; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mp3dec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mp3dec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mp3dec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mp3dec.c 2014-04-23 09:55:21.000000000 +0000 @@ -22,10 +22,12 @@ #include "libavutil/opt.h" #include "libavutil/avstring.h" #include "libavutil/intreadwrite.h" +#include "libavutil/crc.h" #include "libavutil/dict.h" #include "libavutil/mathematics.h" #include "avformat.h" #include "internal.h" +#include "avio_internal.h" #include "id3v2.h" #include "id3v1.h" #include "replaygain.h" @@ -41,11 +43,12 @@ typedef struct { AVClass *class; int64_t filesize; - int64_t header_filesize; int xing_toc; int start_pad; int end_pad; int usetoc; + unsigned frames; /* Total number of frames in file */ + unsigned header_filesize; /* Total number of bytes in the stream */ int is_cbr; } MP3DecContext; @@ -119,19 +122,153 @@ mp3->xing_toc = 1; } +static void mp3_parse_info_tag(AVFormatContext *s, AVStream *st, + MPADecodeHeader *c, uint32_t spf) +{ +#define LAST_BITS(k, n) ((k) & ((1 << (n)) - 1)) +#define MIDDLE_BITS(k, m, n) LAST_BITS((k) >> (m), ((n) - (m))) + + uint16_t crc; + uint32_t v; + + char version[10]; + + uint32_t peak = 0; + int32_t r_gain = INT32_MIN, a_gain = INT32_MIN; + + MP3DecContext *mp3 = s->priv_data; + static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; + + /* Check for Xing / Info tag */ + avio_skip(s->pb, xing_offtbl[c->lsf == 1][c->nb_channels == 1]); + v = avio_rb32(s->pb); + mp3->is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); + if (v != MKBETAG('X', 'i', 'n', 'g') && !mp3->is_cbr) + return; + + v = avio_rb32(s->pb); + if (v & XING_FLAG_FRAMES) + mp3->frames = avio_rb32(s->pb); + if (v & XING_FLAG_SIZE) + mp3->header_filesize = avio_rb32(s->pb); + if (v & XING_FLAG_TOC) + read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames, + (AVRational){spf, c->sample_rate}, + st->time_base)); + /* VBR quality */ + if(v & 8) + avio_skip(s->pb, 4); + + /* Encoder short version string */ + memset(version, 0, sizeof(version)); + avio_read(s->pb, version, 9); + + /* Info Tag revision + VBR method */ + avio_r8(s->pb); + + /* Lowpass filter value */ + avio_r8(s->pb); + + /* ReplayGain peak */ + v = avio_rb32(s->pb); + peak = av_rescale(v, 100000, 1 << 23); + + /* Radio ReplayGain */ + v = avio_rb16(s->pb); + + if (MIDDLE_BITS(v, 13, 15) == 1) { + r_gain = MIDDLE_BITS(v, 0, 8) * 10000; + + if (v & (1 << 9)) + r_gain *= -1; + } + + /* Audiophile ReplayGain */ + v = avio_rb16(s->pb); + + if (MIDDLE_BITS(v, 13, 15) == 2) { + a_gain = MIDDLE_BITS(v, 0, 8) * 10000; + + if (v & (1 << 9)) + a_gain *= -1; + } + + /* Encoding flags + ATH Type */ + avio_r8(s->pb); + + /* if ABR {specified bitrate} else {minimal bitrate} */ + avio_r8(s->pb); + + /* Encoder delays */ + v= avio_rb24(s->pb); + if(AV_RB32(version) == MKBETAG('L', 'A', 'M', 'E') + || AV_RB32(version) == MKBETAG('L', 'a', 'v', 'f')) { + + mp3->start_pad = v>>12; + mp3-> end_pad = v&4095; + st->skip_samples = mp3->start_pad + 528 + 1; + if (!st->start_time) + st->start_time = av_rescale_q(st->skip_samples, + (AVRational){1, c->sample_rate}, + st->time_base); + av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); + } + + /* Misc */ + avio_r8(s->pb); + + /* MP3 gain */ + avio_r8(s->pb); + + /* Preset and surround info */ + avio_rb16(s->pb); + + /* Music length */ + avio_rb32(s->pb); + + /* Music CRC */ + avio_rb16(s->pb); + + /* Info Tag CRC */ + crc = ffio_get_checksum(s->pb); + v = avio_rb16(s->pb); + + if (v == crc) { + ff_replaygain_export_raw(st, r_gain, peak, a_gain, 0); + av_dict_set(&st->metadata, "encoder", version, 0); + } +} + +static void mp3_parse_vbri_tag(AVFormatContext *s, AVStream *st, int64_t base) +{ + uint32_t v; + MP3DecContext *mp3 = s->priv_data; + + /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ + avio_seek(s->pb, base + 4 + 32, SEEK_SET); + v = avio_rb32(s->pb); + if (v == MKBETAG('V', 'B', 'R', 'I')) { + /* Check tag version */ + if (avio_rb16(s->pb) == 1) { + /* skip delay and quality */ + avio_skip(s->pb, 4); + mp3->header_filesize = avio_rb32(s->pb); + mp3->frames = avio_rb32(s->pb); + } + } +} + /** * Try to find Xing/Info/VBRI tags and compute duration from info therein */ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) { - MP3DecContext *mp3 = s->priv_data; uint32_t v, spf; - unsigned frames = 0; /* Total number of frames in file */ - unsigned size = 0; /* Total number of bytes in the stream */ - static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; MPADecodeHeader c; int vbrtag_size = 0; - int is_cbr; + MP3DecContext *mp3 = s->priv_data; + + ffio_init_checksum(s->pb, ff_crcA001_update, 0); v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) @@ -144,64 +281,23 @@ spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ - /* Check for Xing / Info tag */ - avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); - v = avio_rb32(s->pb); - is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); - if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) { - v = avio_rb32(s->pb); - if(v & XING_FLAG_FRAMES) - frames = avio_rb32(s->pb); - if(v & XING_FLAG_SIZE) - size = avio_rb32(s->pb); - if (v & XING_FLAG_TOC) - read_xing_toc(s, size, av_rescale_q(frames, (AVRational){spf, c.sample_rate}, - st->time_base)); - if(v & 8) - avio_skip(s->pb, 4); - - v = avio_rb32(s->pb); - if(v == MKBETAG('L', 'A', 'M', 'E') || v == MKBETAG('L', 'a', 'v', 'f')) { - avio_skip(s->pb, 21-4); - v= avio_rb24(s->pb); - mp3->start_pad = v>>12; - mp3-> end_pad = v&4095; - st->skip_samples = mp3->start_pad + 528 + 1; - if (!st->start_time) - st->start_time = av_rescale_q(st->skip_samples, - (AVRational){1, c.sample_rate}, - st->time_base); - av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); - } - } + mp3->frames = 0; + mp3->header_filesize = 0; - /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ - avio_seek(s->pb, base + 4 + 32, SEEK_SET); - v = avio_rb32(s->pb); - if(v == MKBETAG('V', 'B', 'R', 'I')) { - /* Check tag version */ - if(avio_rb16(s->pb) == 1) { - /* skip delay and quality */ - avio_skip(s->pb, 4); - size = avio_rb32(s->pb); - frames = avio_rb32(s->pb); - } - } + mp3_parse_info_tag(s, st, &c, spf); + mp3_parse_vbri_tag(s, st, base); - if(!frames && !size) + if (!mp3->frames && !mp3->header_filesize) return -1; /* Skip the vbr tag frame */ avio_seek(s->pb, base + vbrtag_size, SEEK_SET); - if(frames) - st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, + if (mp3->frames) + st->duration = av_rescale_q(mp3->frames, (AVRational){spf, c.sample_rate}, st->time_base); - if (size && frames && !is_cbr) - st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf); - - mp3->is_cbr = is_cbr; - mp3->header_filesize = size; + if (mp3->header_filesize && mp3->frames && !mp3->is_cbr) + st->codec->bit_rate = av_rescale(mp3->header_filesize, 8 * c.sample_rate, mp3->frames * (int64_t)spf); return 0; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mp3enc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mp3enc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mp3enc.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mp3enc.c 2014-04-23 09:55:21.000000000 +0000 @@ -124,7 +124,7 @@ int best_bitrate_error = INT_MAX; int xing_offset; int ver = 0; - int bytes_needed, lsf; + int bytes_needed; const char *vendor = (codec->flags & CODEC_FLAG_BITEXACT) ? "Lavf" : LIBAVFORMAT_IDENT; if (!s->pb->seekable || !mp3->write_xing) @@ -161,7 +161,7 @@ header |= channels << 6; for (bitrate_idx = 1; bitrate_idx < 15; bitrate_idx++) { - int bit_rate = 1000 * avpriv_mpa_bitrate_tab[lsf][3 - 1][bitrate_idx]; + int bit_rate = 1000 * avpriv_mpa_bitrate_tab[ver != 3][3 - 1][bitrate_idx]; int error = FFABS(bit_rate - codec->bit_rate); if (error < best_bitrate_error) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -387,7 +387,9 @@ if (st->codec->rc_buffer_size) stream->max_buffer_size = 6*1024 + st->codec->rc_buffer_size/8; else { - av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, muxing may fail\n"); + av_log(ctx, AV_LOG_WARNING, "VBV buffer size not set, using default size of 130KB\n" + "If you want the mpeg file to be compliant to some specification\n" + "Like DVD, VCD or others, make sure you set the correct buffer size\n"); stream->max_buffer_size = 230*1024; //FIXME this is probably too small as default } if (stream->max_buffer_size > 1024 * 8191) { diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegts.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegts.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegts.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegts.c 2014-04-23 09:55:21.000000000 +0000 @@ -1432,7 +1432,7 @@ AVStream *st; if (ts->pids[pid]->es_id != mp4_descr[i].es_id) continue; - if (!(ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES)) { + if (ts->pids[pid]->type != MPEGTS_PES) { av_log(s, AV_LOG_ERROR, "pid %x is not PES\n", pid); continue; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegtsenc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegtsenc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mpegtsenc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mpegtsenc.c 2014-04-23 09:55:21.000000000 +0000 @@ -86,6 +86,8 @@ int flags; int copyts; int tables_version; + + int omit_video_pes_length; } MpegTSWrite; /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */ @@ -124,6 +126,8 @@ offsetof(MpegTSWrite, copyts), AV_OPT_TYPE_INT, {.i64=-1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "tables_version", "set PAT, PMT and SDT version", offsetof(MpegTSWrite, tables_version), AV_OPT_TYPE_INT, {.i64=0}, 0, 31, AV_OPT_FLAG_ENCODING_PARAM}, + { "omit_video_pes_length", "Ommit the PES packet length for video packets", + offsetof(MpegTSWrite, omit_video_pes_length), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM}, { NULL }, }; @@ -628,7 +632,7 @@ ts->sdt.write_packet = section_write_packet; ts->sdt.opaque = s; - pids = av_malloc(s->nb_streams * sizeof(*pids)); + pids = av_malloc_array(s->nb_streams, sizeof(*pids)); if (!pids) return AVERROR(ENOMEM); @@ -1066,6 +1070,9 @@ } if (len > 0xffff) len = 0; + if (ts->omit_video_pes_length && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { + len = 0; + } *q++ = len >> 8; *q++ = len; val = 0x80; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mux.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mux.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mux.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mux.c 2014-04-23 09:55:21.000000000 +0000 @@ -102,7 +102,7 @@ f->num = num; } -AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission) +AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precision) { AVRational q; int j; @@ -113,9 +113,9 @@ q = st->codec->time_base; } for (j=2; j<14; j+= 1+(j>2)) - while (q.den / q.num < min_precission && q.num % j == 0) + while (q.den / q.num < min_precision && q.num % j == 0) q.num /= j; - while (q.den / q.num < min_precission && q.den < (1<<24)) + while (q.den / q.num < min_precision && q.den < (1<<24)) q.den <<= 1; return q; @@ -435,6 +435,12 @@ av_dlog(s, "compute_pkt_fields2: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n", av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index); + if (pkt->duration < 0 && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) { + av_log(s, AV_LOG_WARNING, "Packet with invalid duration %d in stream %d\n", + pkt->duration, pkt->stream_index); + pkt->duration = 0; + } + /* duration field */ if (pkt->duration == 0) { ff_compute_frame_duration(&num, &den, st, NULL, pkt); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mvdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mvdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/mvdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/mvdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -24,48 +24,55 @@ * Silicon Graphics Movie demuxer */ +#include "libavutil/channel_layout.h" #include "libavutil/eval.h" #include "libavutil/intreadwrite.h" #include "libavutil/rational.h" + #include "avformat.h" #include "internal.h" -typedef struct { +typedef struct MvContext { int nb_video_tracks; int nb_audio_tracks; - int eof_count; /**< number of streams that have finished */ - int stream_index; /**< current stream index */ - int frame[2]; /**< frame nb for current stream */ + int eof_count; ///< number of streams that have finished + int stream_index; ///< current stream index + int frame[2]; ///< frame nb for current stream + + int acompression; ///< compression level for audio stream + int aformat; ///< audio format } MvContext; #define AUDIO_FORMAT_SIGNED 401 static int mv_probe(AVProbeData *p) { - if (AV_RB32(p->buf) == MKBETAG('M','O','V','I') && AV_RB16(p->buf + 4) < 3) + if (AV_RB32(p->buf) == MKBETAG('M', 'O', 'V', 'I') && + AV_RB16(p->buf + 4) < 3) return AVPROBE_SCORE_MAX; return 0; } -static char * var_read_string(AVIOContext *pb, int size) +static char *var_read_string(AVIOContext *pb, int size) { - char *str = av_malloc(size + 1); int n; + char *str = av_malloc(size + 1); if (!str) return NULL; n = avio_get_str(pb, size, str, size + 1); if (n < size) - avio_skip(pb, size - n); + avio_skip(pb, size - n); return str; } static int var_read_int(AVIOContext *pb, int size) { int v; - char * s = var_read_string(pb, size); - if (!s || sscanf(s, "%d", &v) != 1) - v = 0; + char *s = var_read_string(pb, size); + if (!s) + return 0; + v = strtol(s, NULL, 10); av_free(s); return v; } @@ -73,9 +80,9 @@ static AVRational var_read_float(AVIOContext *pb, int size) { AVRational v; - char * s = var_read_string(pb, size); + char *s = var_read_string(pb, size); if (!s) - return (AVRational){0, 0}; + return (AVRational) { 0, 0 }; v = av_d2q(av_strtod(s, NULL), INT_MAX); av_free(s); return v; @@ -88,13 +95,15 @@ av_dict_set(&avctx->metadata, tag, value, AV_DICT_DONT_STRDUP_VAL); } -static int set_channels(AVFormatContext *avctx, AVStream *st, int channels) { +static int set_channels(AVFormatContext *avctx, AVStream *st, int channels) +{ if (channels <= 0) { - av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid\n", channels); + av_log(avctx, AV_LOG_ERROR, "Channel count %d invalid.\n", channels); return AVERROR_INVALIDDATA; } - st->codec->channels = channels; - st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; + st->codec->channels = channels; + st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO + : AV_CH_LAYOUT_STEREO; return 0; } @@ -102,7 +111,8 @@ * Parse global variable * @return < 0 if unknown */ -static int parse_global_var(AVFormatContext *avctx, AVStream *st, const char *name, int size) +static int parse_global_var(AVFormatContext *avctx, AVStream *st, + const char *name, int size) { MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; @@ -112,10 +122,11 @@ mv->nb_audio_tracks = var_read_int(pb, size); } else if (!strcmp(name, "COMMENT") || !strcmp(name, "TITLE")) { var_read_metadata(avctx, name, size); - } else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") || !strcmp(name, "OPTIMIZED")) { + } else if (!strcmp(name, "LOOP_MODE") || !strcmp(name, "NUM_LOOPS") || + !strcmp(name, "OPTIMIZED")) { avio_skip(pb, size); // ignore } else - return -1; + return AVERROR_INVALIDDATA; return 0; } @@ -124,15 +135,17 @@ * Parse audio variable * @return < 0 if unknown */ -static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size) +static int parse_audio_var(AVFormatContext *avctx, AVStream *st, + const char *name, int size) { + MvContext *mv = avctx->priv_data; AVIOContext *pb = avctx->pb; if (!strcmp(name, "__DIR_COUNT")) { st->nb_frames = var_read_int(pb, size); } else if (!strcmp(name, "AUDIO_FORMAT")) { - st->codec->codec_id = var_read_int(pb, size); + mv->aformat = var_read_int(pb, size); } else if (!strcmp(name, "COMPRESSION")) { - st->codec->codec_tag = var_read_int(pb, size); + mv->acompression = var_read_int(pb, size); } else if (!strcmp(name, "DEFAULT_VOL")) { var_read_metadata(avctx, name, size); } else if (!strcmp(name, "NUM_CHANNELS")) { @@ -143,7 +156,8 @@ } else if (!strcmp(name, "SAMPLE_WIDTH")) { st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8; } else - return -1; + return AVERROR_INVALIDDATA; + return 0; } @@ -151,13 +165,14 @@ * Parse video variable * @return < 0 if unknown */ -static int parse_video_var(AVFormatContext *avctx, AVStream *st, const char *name, int size) +static int parse_video_var(AVFormatContext *avctx, AVStream *st, + const char *name, int size) { AVIOContext *pb = avctx->pb; if (!strcmp(name, "__DIR_COUNT")) { st->nb_frames = st->duration = var_read_int(pb, size); } else if (!strcmp(name, "COMPRESSION")) { - char * str = var_read_string(pb, size); + char *str = var_read_string(pb, size); if (!str) return AVERROR_INVALIDDATA; if (!strcmp(str, "1")) { @@ -172,35 +187,40 @@ } else if (!strcmp(str, "MVC2")) { st->codec->codec_id = AV_CODEC_ID_MVC2; } else { - avpriv_request_sample(avctx, "video compression %s", str); + avpriv_request_sample(avctx, "Video compression %s", str); } av_free(str); } else if (!strcmp(name, "FPS")) { AVRational fps = var_read_float(pb, size); avpriv_set_pts_info(st, 64, fps.den, fps.num); + st->avg_frame_rate = fps; } else if (!strcmp(name, "HEIGHT")) { st->codec->height = var_read_int(pb, size); } else if (!strcmp(name, "PIXEL_ASPECT")) { st->sample_aspect_ratio = var_read_float(pb, size); av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, INT_MAX); + st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, + INT_MAX); } else if (!strcmp(name, "WIDTH")) { st->codec->width = var_read_int(pb, size); } else if (!strcmp(name, "ORIENTATION")) { if (var_read_int(pb, size) == 1101) { - st->codec->extradata = av_strdup("BottomUp"); - st->codec->extradata_size = 9; + st->codec->extradata = av_strdup("BottomUp"); + st->codec->extradata_size = 9; } } else if (!strcmp(name, "Q_SPATIAL") || !strcmp(name, "Q_TEMPORAL")) { var_read_metadata(avctx, name, size); } else if (!strcmp(name, "INTERLACING") || !strcmp(name, "PACKING")) { avio_skip(pb, size); // ignore } else - return -1; + return AVERROR_INVALIDDATA; + return 0; } -static void read_table(AVFormatContext *avctx, AVStream *st, int (*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size)) +static void read_table(AVFormatContext *avctx, AVStream *st, + int (*parse)(AVFormatContext *avctx, AVStream *st, + const char *name, int size)) { int count, i; AVIOContext *pb = avctx->pb; @@ -214,7 +234,7 @@ name[sizeof(name) - 1] = 0; size = avio_rb32(pb); if (parse(avctx, st, name, size) < 0) { - avpriv_request_sample(avctx, "variable %s", name); + avpriv_request_sample(avctx, "Variable %s", name); avio_skip(pb, size); } } @@ -253,7 +273,7 @@ avio_skip(pb, 22); /* allocate audio track first to prevent unnecessary seeking - (audio packet always precede video packet for a given frame) */ + * (audio packet always precede video packet for a given frame) */ ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); @@ -261,9 +281,10 @@ vst = avformat_new_stream(avctx, NULL); if (!vst) return AVERROR(ENOMEM); - vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; avpriv_set_pts_info(vst, 64, 1, 15); - vst->nb_frames = avio_rb32(pb); + vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; + vst->avg_frame_rate = av_inv_q(vst->time_base); + vst->nb_frames = avio_rb32(pb); v = avio_rb32(pb); switch (v) { case 1: @@ -274,7 +295,7 @@ vst->codec->codec_id = AV_CODEC_ID_RAWVIDEO; break; default: - avpriv_request_sample(avctx, "video compression %i", v); + avpriv_request_sample(avctx, "Video compression %i", v); break; } vst->codec->codec_tag = 0; @@ -282,9 +303,9 @@ vst->codec->height = avio_rb32(pb); avio_skip(pb, 12); - ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - ast->nb_frames = vst->nb_frames; - ast->codec->sample_rate = avio_rb32(pb); + ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; + ast->nb_frames = vst->nb_frames; + ast->codec->sample_rate = avio_rb32(pb); avpriv_set_pts_info(ast, 33, 1, ast->codec->sample_rate); if (set_channels(avctx, ast, avio_rb32(pb)) < 0) return AVERROR_INVALIDDATA; @@ -293,7 +314,7 @@ if (v == AUDIO_FORMAT_SIGNED) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { - avpriv_request_sample(avctx, "audio compression (format %i)", v); + avpriv_request_sample(avctx, "Audio compression (format %i)", v); } avio_skip(pb, 12); @@ -307,8 +328,8 @@ uint32_t asize = avio_rb32(pb); uint32_t vsize = avio_rb32(pb); avio_skip(pb, 8); - av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME); - av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME); + av_add_index_entry(ast, pos, timestamp, asize, 0, AVINDEX_KEYFRAME); + av_add_index_entry(vst, pos + asize, i, vsize, 0, AVINDEX_KEYFRAME); timestamp += asize / (ast->codec->channels * 2); } } else if (!version && avio_rb16(pb) == 3) { @@ -317,31 +338,33 @@ read_table(avctx, NULL, parse_global_var); if (mv->nb_audio_tracks > 1) { - avpriv_request_sample(avctx, "multiple audio streams support"); + avpriv_request_sample(avctx, "Multiple audio streams support"); return AVERROR_PATCHWELCOME; } else if (mv->nb_audio_tracks) { ast = avformat_new_stream(avctx, NULL); if (!ast) return AVERROR(ENOMEM); ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - /* temporarily store compression value in codec_tag; format value in codec_id */ read_table(avctx, ast, parse_audio_var); - if (ast->codec->codec_tag == 100 && ast->codec->codec_id == AUDIO_FORMAT_SIGNED && ast->codec->bits_per_coded_sample == 16) { + if (mv->acompression == 100 && + mv->aformat == AUDIO_FORMAT_SIGNED && + ast->codec->bits_per_coded_sample == 16) { ast->codec->codec_id = AV_CODEC_ID_PCM_S16BE; } else { - avpriv_request_sample(avctx, "audio compression %i (format %i, width %i)", - ast->codec->codec_tag, ast->codec->codec_id, ast->codec->bits_per_coded_sample); + avpriv_request_sample(avctx, + "Audio compression %i (format %i, sr %i)", + mv->acompression, mv->aformat, + ast->codec->bits_per_coded_sample); ast->codec->codec_id = AV_CODEC_ID_NONE; } - ast->codec->codec_tag = 0; if (ast->codec->channels <= 0) { - av_log(avctx, AV_LOG_ERROR, "No valid channel count found\n"); + av_log(avctx, AV_LOG_ERROR, "No valid channel count found.\n"); return AVERROR_INVALIDDATA; } } if (mv->nb_video_tracks > 1) { - avpriv_request_sample(avctx, "multiple video streams support"); + avpriv_request_sample(avctx, "Multiple video streams support"); return AVERROR_PATCHWELCOME; } else if (mv->nb_video_tracks) { vst = avformat_new_stream(avctx, NULL); @@ -357,7 +380,7 @@ if (mv->nb_video_tracks) read_index(pb, vst); } else { - avpriv_request_sample(avctx, "version %i", version); + avpriv_request_sample(avctx, "Version %i", version); return AVERROR_PATCHWELCOME; } @@ -374,9 +397,9 @@ int ret; uint64_t pos; - if (frame < st->nb_index_entries) { + if (frame < st->nb_index_entries) { index = &st->index_entries[frame]; - pos = avio_tell(pb); + pos = avio_tell(pb); if (index->pos > pos) avio_skip(pb, index->pos - pos); else if (index->pos < pos) { @@ -391,8 +414,8 @@ return ret; pkt->stream_index = mv->stream_index; - pkt->pts = index->timestamp; - pkt->flags |= AV_PKT_FLAG_KEY; + pkt->pts = index->timestamp; + pkt->flags |= AV_PKT_FLAG_KEY; mv->frame[mv->stream_index]++; mv->eof_count = 0; @@ -400,6 +423,9 @@ mv->eof_count++; if (mv->eof_count >= avctx->nb_streams) return AVERROR_EOF; + + // avoid returning 0 without a packet + return AVERROR(EAGAIN); } mv->stream_index++; @@ -409,7 +435,8 @@ return 0; } -static int mv_read_seek(AVFormatContext *avctx, int stream_index, int64_t timestamp, int flags) +static int mv_read_seek(AVFormatContext *avctx, int stream_index, + int64_t timestamp, int flags) { MvContext *mv = avctx->priv_data; AVStream *st = avctx->streams[stream_index]; @@ -423,7 +450,7 @@ frame = av_index_search_timestamp(st, timestamp, flags); if (frame < 0) - return -1; + return AVERROR_INVALIDDATA; for (i = 0; i < avctx->nb_streams; i++) mv->frame[i] = frame; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/network.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/network.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/network.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/network.c 2014-04-23 09:55:21.000000000 +0000 @@ -76,7 +76,7 @@ #if HAVE_THREADS if (!CRYPTO_get_locking_callback()) { int i; - openssl_mutexes = av_malloc(sizeof(pthread_mutex_t) * CRYPTO_num_locks()); + openssl_mutexes = av_malloc_array(sizeof(pthread_mutex_t), CRYPTO_num_locks()); for (i = 0; i < CRYPTO_num_locks(); i++) pthread_mutex_init(&openssl_mutexes[i], NULL); CRYPTO_set_locking_callback(openssl_lock); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/omadec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/omadec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/omadec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/omadec.c 2014-04-23 09:55:21.000000000 +0000 @@ -295,7 +295,7 @@ ID3v2ExtraMeta *extra_meta = NULL; OMAContext *oc = s->priv_data; - ff_id3v2_read(s, ID3v2_EA3_MAGIC, &extra_meta); + ff_id3v2_read(s, ID3v2_EA3_MAGIC, &extra_meta, 0); ret = avio_read(s->pb, buf, EA3_HEADER_SIZE); if (ret < EA3_HEADER_SIZE) return -1; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/pcm.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/pcm.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/pcm.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/pcm.c 2014-04-23 09:55:21.000000000 +0000 @@ -37,8 +37,6 @@ pkt->flags &= ~AV_PKT_FLAG_CORRUPT; pkt->stream_index = 0; - if (ret < 0) - return ret; return ret; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/pmpdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/pmpdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/pmpdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/pmpdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -160,10 +160,6 @@ ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]); if (ret >= 0) { ret = 0; - // FIXME: this is a hack that should be removed once - // compute_pkt_fields() can handle timestamps properly - if (pmp->cur_stream == 0) - pkt->dts = s->streams[0]->cur_dts++; pkt->stream_index = pmp->cur_stream; } if (pmp->current_packet % pmp->audio_packets == 0) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/replaygain.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/replaygain.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/replaygain.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/replaygain.c 2014-04-23 09:55:21.000000000 +0000 @@ -66,23 +66,23 @@ return db * 100000 + sign * mb; } -static int replaygain_export(AVStream *st, - const uint8_t *track_gain, const uint8_t *track_peak, - const uint8_t *album_gain, const uint8_t *album_peak) +int ff_replaygain_export_raw(AVStream *st, int32_t tg, uint32_t tp, + int32_t ag, uint32_t ap) { AVPacketSideData *sd, *tmp; AVReplayGain *replaygain; - int32_t tg, ag; - uint32_t tp, ap; - - tg = parse_value(track_gain, INT32_MIN); - ag = parse_value(album_gain, INT32_MIN); - tp = parse_value(track_peak, 0); - ap = parse_value(album_peak, 0); + int i; if (tg == INT32_MIN && ag == INT32_MIN) return 0; + for (i = 0; i < st->nb_side_data; i++) { + AVPacketSideData *src_sd = &st->side_data[i]; + + if (src_sd->type == AV_PKT_DATA_REPLAYGAIN) + return 0; + } + replaygain = av_mallocz(sizeof(*replaygain)); if (!replaygain) return AVERROR(ENOMEM); @@ -117,9 +117,9 @@ ag = av_dict_get(metadata, "REPLAYGAIN_ALBUM_GAIN", NULL, 0); ap = av_dict_get(metadata, "REPLAYGAIN_ALBUM_PEAK", NULL, 0); - return replaygain_export(st, - tg ? tg->value : NULL, - tp ? tp->value : NULL, - ag ? ag->value : NULL, - ap ? ap->value : NULL); + return ff_replaygain_export_raw(st, + parse_value(tg ? tg->value : NULL, INT32_MIN), + parse_value(tp ? tp->value : NULL, 0), + parse_value(ag ? ag->value : NULL, INT32_MIN), + parse_value(ap ? ap->value : NULL, 0)); } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/replaygain.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/replaygain.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/replaygain.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/replaygain.h 2014-04-23 09:55:21.000000000 +0000 @@ -28,4 +28,11 @@ */ int ff_replaygain_export(AVStream *st, AVDictionary *metadata); + +/** + * Export already decoded replaygain values as per-stream side data. + */ +int ff_replaygain_export_raw(AVStream *st, int32_t tg, uint32_t tp, + int32_t ag, uint32_t ap); + #endif /* AVFORMAT_REPLAYGAIN_H */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/rtmpproto.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/rtmpproto.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/rtmpproto.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/rtmpproto.c 2014-04-23 09:55:21.000000000 +0000 @@ -150,6 +150,8 @@ 0xE6, 0x36, 0xCF, 0xEB, 0x31, 0xAE }; +static int handle_chunk_size(URLContext *s, RTMPPacket *pkt); + static int add_tracked_method(RTMPContext *rt, const char *name, int id) { int err; @@ -408,6 +410,17 @@ if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size, &rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0) return ret; + + if (pkt.type == RTMP_PT_CHUNK_SIZE) { + if ((ret = handle_chunk_size(s, &pkt)) < 0) + return ret; + + ff_rtmp_packet_destroy(&pkt); + if ((ret = ff_rtmp_packet_read(rt->stream, &pkt, rt->in_chunk_size, + &rt->prev_pkt[0], &rt->nb_prev_pkt[0])) < 0) + return ret; + } + cp = pkt.data; bytestream2_init(&gbc, cp, pkt.size); if (ff_amf_read_string(&gbc, command, sizeof(command), &stringlen)) { @@ -2556,7 +2569,7 @@ if ((ret = gen_connect(s, rt)) < 0) goto fail; } else { - if (read_connect(s, s->priv_data) < 0) + if ((ret = read_connect(s, s->priv_data)) < 0) goto fail; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/txd.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/txd.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/txd.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/txd.c 2014-04-23 09:55:21.000000000 +0000 @@ -21,6 +21,7 @@ #include "libavutil/intreadwrite.h" #include "avformat.h" +#include "internal.h" #define TXD_FILE 0x16 #define TXD_INFO 0x01 @@ -45,8 +46,8 @@ return AVERROR(ENOMEM); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_TXD; - st->codec->time_base.den = 5; - st->codec->time_base.num = 1; + avpriv_set_pts_info(st, 64, 1, 5); + st->avg_frame_rate = av_inv_q(st->time_base); /* the parameters will be extracted from the compressed bitstream */ return 0; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/utils.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/utils.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/utils.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/utils.c 2014-04-23 09:55:21.000000000 +0000 @@ -110,6 +110,16 @@ MAKE_ACCESSORS(AVFormatContext, format, void *, opaque) MAKE_ACCESSORS(AVFormatContext, format, av_format_control_message, control_message_cb) +void av_format_inject_global_side_data(AVFormatContext *s) +{ + int i; + s->internal->inject_global_side_data = 1; + for (i = 0; i < s->nb_streams; i++) { + AVStream *st = s->streams[i]; + st->inject_global_side_data = 1; + } +} + static AVCodec *find_decoder(AVFormatContext *s, AVStream *st, enum AVCodecID codec_id) { if (st->codec->codec) @@ -564,7 +574,7 @@ /* e.g. AVFMT_NOFILE formats will not have a AVIOContext */ if (s->pb) - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); + ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, 0); if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header) if ((ret = s->iformat->read_header(s)) < 0) @@ -1350,12 +1360,6 @@ st->time_base, AV_ROUND_DOWN); } - } else if (st->codec->time_base.num != 0 && - st->codec->time_base.den != 0) { - out_pkt.duration = av_rescale_q_rnd(st->parser->duration, - st->codec->time_base, - st->time_base, - AV_ROUND_DOWN); } out_pkt.stream_index = st->index; @@ -1526,10 +1530,29 @@ } st->skip_samples = 0; } - } - if (ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA)) - av_packet_merge_side_data(pkt); + if (st->inject_global_side_data) { + for (i = 0; i < st->nb_side_data; i++) { + AVPacketSideData *src_sd = &st->side_data[i]; + uint8_t *dst_data; + + if (av_packet_get_side_data(pkt, src_sd->type, NULL)) + continue; + + dst_data = av_packet_new_side_data(pkt, src_sd->type, src_sd->size); + if (!dst_data) { + av_log(s, AV_LOG_WARNING, "Could not inject global side data\n"); + continue; + } + + memcpy(dst_data, src_sd->data, src_sd->size); + } + st->inject_global_side_data = 0; + } + + if (!(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA)) + av_packet_merge_side_data(pkt); + } if (s->debug & FF_FDEBUG_TS) av_log(s, AV_LOG_DEBUG, @@ -1697,6 +1720,9 @@ for (j = 0; j < MAX_REORDER_DELAY + 1; j++) st->pts_buffer[j] = AV_NOPTS_VALUE; + + if (s->internal->inject_global_side_data) + st->inject_global_side_data = 1; } } @@ -2623,13 +2649,15 @@ if (!frame) return AVERROR(ENOMEM); - if (!avcodec_is_open(st->codec) && !st->info->found_decoder) { + if (!avcodec_is_open(st->codec) && + st->info->found_decoder <= 0 && + (st->codec->codec_id != -st->info->found_decoder || !st->codec->codec_id)) { AVDictionary *thread_opt = NULL; codec = find_decoder(s, st, st->codec->codec_id); if (!codec) { - st->info->found_decoder = -1; + st->info->found_decoder = -st->codec->codec_id; ret = -1; goto fail; } @@ -2641,7 +2669,7 @@ if (!options) av_dict_free(&thread_opt); if (ret < 0) { - st->info->found_decoder = -1; + st->info->found_decoder = -st->codec->codec_id; goto fail; } st->info->found_decoder = 1; @@ -3669,6 +3697,8 @@ st->info->fps_first_dts = AV_NOPTS_VALUE; st->info->fps_last_dts = AV_NOPTS_VALUE; + st->inject_global_side_data = s->internal->inject_global_side_data; + s->streams[s->nb_streams++] = st; return st; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/version.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/version.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/version.h 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/version.h 2014-04-23 09:55:21.000000000 +0000 @@ -31,7 +31,7 @@ #define LIBAVFORMAT_VERSION_MAJOR 55 #define LIBAVFORMAT_VERSION_MINOR 37 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/wavdec.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/wavdec.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/wavdec.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/wavdec.c 2014-04-23 09:55:21.000000000 +0000 @@ -114,7 +114,7 @@ { if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) { st->request_probe = AVPROBE_SCORE_EXTENSION; - st->probe_packets = FFMIN(st->probe_packets, 4); + st->probe_packets = FFMIN(st->probe_packets, 14); } } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/xmv.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/xmv.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavformat/xmv.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavformat/xmv.c 2014-04-23 09:55:21.000000000 +0000 @@ -182,7 +182,7 @@ avio_skip(pb, 2); /* Unknown (padding?) */ - xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket)); + xmv->audio = av_malloc_array(xmv->audio_track_count, sizeof(XMVAudioPacket)); if (!xmv->audio) { ret = AVERROR(ENOMEM); goto fail; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/audio_convert_init.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/audio_convert_init.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/audio_convert_init.c 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/audio_convert_init.c 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/aarch64/cpu.h" +#include "libavutil/samplefmt.h" +#include "libavresample/audio_convert.h" + +void ff_conv_flt_to_s16_neon(int16_t *dst, const float *src, int len); +void ff_conv_fltp_to_s16_neon(int16_t *dst, float *const *src, + int len, int channels); +void ff_conv_fltp_to_s16_2ch_neon(int16_t *dst, float *const *src, + int len, int channels); + +av_cold void ff_audio_convert_init_aarch64(AudioConvert *ac) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT, + 0, 16, 8, "NEON", + ff_conv_flt_to_s16_neon); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, + 2, 16, 8, "NEON", + ff_conv_fltp_to_s16_2ch_neon); + ff_audio_convert_set_func(ac, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLTP, + 0, 16, 8, "NEON", + ff_conv_fltp_to_s16_neon); + } +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/audio_convert_neon.S ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/audio_convert_neon.S --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/audio_convert_neon.S 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/audio_convert_neon.S 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2008 Mans Rullgard + * Copyright (c) 2014 Janne Grunau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/aarch64/asm.S" + +function ff_conv_flt_to_s16_neon, export=1 + subs x2, x2, #8 + ld1 {v0.4s}, [x1], #16 + fcvtzs v4.4s, v0.4s, #31 + ld1 {v1.4s}, [x1], #16 + fcvtzs v5.4s, v1.4s, #31 + b.eq 3f + ands x12, x2, #~15 + b.eq 2f +1: subs x12, x12, #16 + sqrshrn v4.4h, v4.4s, #16 + ld1 {v2.4s}, [x1], #16 + fcvtzs v6.4s, v2.4s, #31 + sqrshrn2 v4.8h, v5.4s, #16 + ld1 {v3.4s}, [x1], #16 + fcvtzs v7.4s, v3.4s, #31 + sqrshrn v6.4h, v6.4s, #16 + st1 {v4.8h}, [x0], #16 + sqrshrn2 v6.8h, v7.4s, #16 + ld1 {v0.4s}, [x1], #16 + fcvtzs v4.4s, v0.4s, #31 + ld1 {v1.4s}, [x1], #16 + fcvtzs v5.4s, v1.4s, #31 + st1 {v6.8h}, [x0], #16 + b.ne 1b + ands x2, x2, #15 + b.eq 3f +2: ld1 {v2.4s}, [x1], #16 + sqrshrn v4.4h, v4.4s, #16 + fcvtzs v6.4s, v2.4s, #31 + ld1 {v3.4s}, [x1], #16 + sqrshrn2 v4.8h, v5.4s, #16 + fcvtzs v7.4s, v3.4s, #31 + sqrshrn v6.4h, v6.4s, #16 + st1 {v4.8h}, [x0], #16 + sqrshrn2 v6.8h, v7.4s, #16 + st1 {v6.8h}, [x0] + ret +3: sqrshrn v4.4h, v4.4s, #16 + sqrshrn2 v4.8h, v5.4s, #16 + st1 {v4.8h}, [x0] + ret +endfunc + +function ff_conv_fltp_to_s16_2ch_neon, export=1 + ldp x4, x5, [x1] + subs x2, x2, #8 + ld1 {v0.4s}, [x4], #16 + fcvtzs v4.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v5.4s, v1.4s, #31 + ld1 {v2.4s}, [x5], #16 + fcvtzs v6.4s, v2.4s, #31 + ld1 {v3.4s}, [x5], #16 + fcvtzs v7.4s, v3.4s, #31 + b.eq 3f + ands x12, x2, #~15 + b.eq 2f +1: subs x12, x12, #16 + ld1 {v16.4s}, [x4], #16 + fcvtzs v20.4s, v16.4s, #31 + sri v6.4s, v4.4s, #16 + ld1 {v17.4s}, [x4], #16 + fcvtzs v21.4s, v17.4s, #31 + ld1 {v18.4s}, [x5], #16 + fcvtzs v22.4s, v18.4s, #31 + ld1 {v19.4s}, [x5], #16 + sri v7.4s, v5.4s, #16 + st1 {v6.4s}, [x0], #16 + fcvtzs v23.4s, v19.4s, #31 + st1 {v7.4s}, [x0], #16 + sri v22.4s, v20.4s, #16 + ld1 {v0.4s}, [x4], #16 + sri v23.4s, v21.4s, #16 + st1 {v22.4s}, [x0], #16 + fcvtzs v4.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v5.4s, v1.4s, #31 + ld1 {v2.4s}, [x5], #16 + fcvtzs v6.4s, v2.4s, #31 + ld1 {v3.4s}, [x5], #16 + fcvtzs v7.4s, v3.4s, #31 + st1 {v23.4s}, [x0], #16 + b.ne 1b + ands x2, x2, #15 + b.eq 3f +2: sri v6.4s, v4.4s, #16 + ld1 {v0.4s}, [x4], #16 + fcvtzs v0.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v1.4s, v1.4s, #31 + ld1 {v2.4s}, [x5], #16 + fcvtzs v2.4s, v2.4s, #31 + sri v7.4s, v5.4s, #16 + ld1 {v3.4s}, [x5], #16 + fcvtzs v3.4s, v3.4s, #31 + sri v2.4s, v0.4s, #16 + st1 {v6.4s,v7.4s}, [x0], #32 + sri v3.4s, v1.4s, #16 + st1 {v2.4s,v3.4s}, [x0], #32 + ret +3: sri v6.4s, v4.4s, #16 + sri v7.4s, v5.4s, #16 + st1 {v6.4s,v7.4s}, [x0] + ret +endfunc + +function ff_conv_fltp_to_s16_neon, export=1 + cmp w3, #2 + b.eq X(ff_conv_fltp_to_s16_2ch_neon) + b.gt 1f + ldr x1, [x1] + b X(ff_conv_flt_to_s16_neon) +1: + cmp w3, #4 + lsl x12, x3, #1 + b.lt 4f + +5: // 4 channels + ldp x4, x5, [x1], #16 + ldp x6, x7, [x1], #16 + mov w9, w2 + mov x8, x0 + ld1 {v4.4s}, [x4], #16 + fcvtzs v4.4s, v4.4s, #31 + ld1 {v5.4s}, [x5], #16 + fcvtzs v5.4s, v5.4s, #31 + ld1 {v6.4s}, [x6], #16 + fcvtzs v6.4s, v6.4s, #31 + ld1 {v7.4s}, [x7], #16 + fcvtzs v7.4s, v7.4s, #31 +6: + subs w9, w9, #8 + ld1 {v0.4s}, [x4], #16 + fcvtzs v0.4s, v0.4s, #31 + sri v5.4s, v4.4s, #16 + ld1 {v1.4s}, [x5], #16 + fcvtzs v1.4s, v1.4s, #31 + sri v7.4s, v6.4s, #16 + ld1 {v2.4s}, [x6], #16 + fcvtzs v2.4s, v2.4s, #31 + zip1 v16.4s, v5.4s, v7.4s + ld1 {v3.4s}, [x7], #16 + fcvtzs v3.4s, v3.4s, #31 + zip2 v17.4s, v5.4s, v7.4s + st1 {v16.d}[0], [x8], x12 + sri v1.4s, v0.4s, #16 + st1 {v16.d}[1], [x8], x12 + sri v3.4s, v2.4s, #16 + st1 {v17.d}[0], [x8], x12 + zip1 v18.4s, v1.4s, v3.4s + st1 {v17.d}[1], [x8], x12 + zip2 v19.4s, v1.4s, v3.4s + b.eq 7f + ld1 {v4.4s}, [x4], #16 + fcvtzs v4.4s, v4.4s, #31 + st1 {v18.d}[0], [x8], x12 + ld1 {v5.4s}, [x5], #16 + fcvtzs v5.4s, v5.4s, #31 + st1 {v18.d}[1], [x8], x12 + ld1 {v6.4s}, [x6], #16 + fcvtzs v6.4s, v6.4s, #31 + st1 {v19.d}[0], [x8], x12 + ld1 {v7.4s}, [x7], #16 + fcvtzs v7.4s, v7.4s, #31 + st1 {v19.d}[1], [x8], x12 + b 6b +7: + st1 {v18.d}[0], [x8], x12 + st1 {v18.d}[1], [x8], x12 + st1 {v19.d}[0], [x8], x12 + st1 {v19.d}[1], [x8], x12 + subs w3, w3, #4 + b.eq end + cmp w3, #4 + add x0, x0, #8 + b.ge 5b + +4: // 2 channels + cmp w3, #2 + b.lt 4f + ldp x4, x5, [x1], #16 + mov w9, w2 + mov x8, x0 + tst w9, #8 + ld1 {v4.4s}, [x4], #16 + fcvtzs v4.4s, v4.4s, #31 + ld1 {v5.4s}, [x5], #16 + fcvtzs v5.4s, v5.4s, #31 + ld1 {v6.4s}, [x4], #16 + fcvtzs v6.4s, v6.4s, #31 + ld1 {v7.4s}, [x5], #16 + fcvtzs v7.4s, v7.4s, #31 + b.eq 6f + subs w9, w9, #8 + b.eq 7f + sri v5.4s, v4.4s, #16 + ld1 {v4.4s}, [x4], #16 + fcvtzs v4.4s, v4.4s, #31 + st1 {v5.s}[0], [x8], x12 + sri v7.4s, v6.4s, #16 + st1 {v5.s}[1], [x8], x12 + ld1 {v6.4s}, [x4], #16 + fcvtzs v6.4s, v6.4s, #31 + st1 {v5.s}[2], [x8], x12 + st1 {v5.s}[3], [x8], x12 + st1 {v7.s}[0], [x8], x12 + st1 {v7.s}[1], [x8], x12 + ld1 {v5.4s}, [x5], #16 + fcvtzs v5.4s, v5.4s, #31 + st1 {v7.s}[2], [x8], x12 + st1 {v7.s}[3], [x8], x12 + ld1 {v7.4s}, [x5], #16 + fcvtzs v7.4s, v7.4s, #31 +6: + subs w9, w9, #16 + ld1 {v0.4s}, [x4], #16 + sri v5.4s, v4.4s, #16 + fcvtzs v0.4s, v0.4s, #31 + ld1 {v1.4s}, [x5], #16 + sri v7.4s, v6.4s, #16 + st1 {v5.s}[0], [x8], x12 + st1 {v5.s}[1], [x8], x12 + fcvtzs v1.4s, v1.4s, #31 + st1 {v5.s}[2], [x8], x12 + st1 {v5.s}[3], [x8], x12 + ld1 {v2.4s}, [x4], #16 + st1 {v7.s}[0], [x8], x12 + fcvtzs v2.4s, v2.4s, #31 + st1 {v7.s}[1], [x8], x12 + ld1 {v3.4s}, [x5], #16 + st1 {v7.s}[2], [x8], x12 + fcvtzs v3.4s, v3.4s, #31 + st1 {v7.s}[3], [x8], x12 + sri v1.4s, v0.4s, #16 + sri v3.4s, v2.4s, #16 + b.eq 6f + ld1 {v4.4s}, [x4], #16 + st1 {v1.s}[0], [x8], x12 + fcvtzs v4.4s, v4.4s, #31 + st1 {v1.s}[1], [x8], x12 + ld1 {v5.4s}, [x5], #16 + st1 {v1.s}[2], [x8], x12 + fcvtzs v5.4s, v5.4s, #31 + st1 {v1.s}[3], [x8], x12 + ld1 {v6.4s}, [x4], #16 + st1 {v3.s}[0], [x8], x12 + fcvtzs v6.4s, v6.4s, #31 + st1 {v3.s}[1], [x8], x12 + ld1 {v7.4s}, [x5], #16 + st1 {v3.s}[2], [x8], x12 + fcvtzs v7.4s, v7.4s, #31 + st1 {v3.s}[3], [x8], x12 + b.gt 6b +6: + st1 {v1.s}[0], [x8], x12 + st1 {v1.s}[1], [x8], x12 + st1 {v1.s}[2], [x8], x12 + st1 {v1.s}[3], [x8], x12 + st1 {v3.s}[0], [x8], x12 + st1 {v3.s}[1], [x8], x12 + st1 {v3.s}[2], [x8], x12 + st1 {v3.s}[3], [x8], x12 + b 8f +7: + sri v5.4s, v4.4s, #16 + sri v7.4s, v6.4s, #16 + st1 {v5.s}[0], [x8], x12 + st1 {v5.s}[1], [x8], x12 + st1 {v5.s}[2], [x8], x12 + st1 {v5.s}[3], [x8], x12 + st1 {v7.s}[0], [x8], x12 + st1 {v7.s}[1], [x8], x12 + st1 {v7.s}[2], [x8], x12 + st1 {v7.s}[3], [x8], x12 +8: + subs w3, w3, #2 + add x0, x0, #4 + b.eq end + +4: // 1 channel + ldr x4, [x1] + tst w2, #8 + mov w9, w2 + mov x5, x0 + ld1 {v0.4s}, [x4], #16 + fcvtzs v0.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v1.4s, v1.4s, #31 + b.ne 8f +6: + subs w9, w9, #16 + ld1 {v2.4s}, [x4], #16 + fcvtzs v2.4s, v2.4s, #31 + ld1 {v3.4s}, [x4], #16 + fcvtzs v3.4s, v3.4s, #31 + st1 {v0.h}[1], [x5], x12 + st1 {v0.h}[3], [x5], x12 + st1 {v0.h}[5], [x5], x12 + st1 {v0.h}[7], [x5], x12 + st1 {v1.h}[1], [x5], x12 + st1 {v1.h}[3], [x5], x12 + st1 {v1.h}[5], [x5], x12 + st1 {v1.h}[7], [x5], x12 + b.eq 7f + ld1 {v0.4s}, [x4], #16 + fcvtzs v0.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v1.4s, v1.4s, #31 +7: + st1 {v2.h}[1], [x5], x12 + st1 {v2.h}[3], [x5], x12 + st1 {v2.h}[5], [x5], x12 + st1 {v2.h}[7], [x5], x12 + st1 {v3.h}[1], [x5], x12 + st1 {v3.h}[3], [x5], x12 + st1 {v3.h}[5], [x5], x12 + st1 {v3.h}[7], [x5], x12 + b.gt 6b + ret +8: + subs w9, w9, #8 + st1 {v0.h}[1], [x5], x12 + st1 {v0.h}[3], [x5], x12 + st1 {v0.h}[5], [x5], x12 + st1 {v0.h}[7], [x5], x12 + st1 {v1.h}[1], [x5], x12 + st1 {v1.h}[3], [x5], x12 + st1 {v1.h}[5], [x5], x12 + st1 {v1.h}[7], [x5], x12 + b.eq end + ld1 {v0.4s}, [x4], #16 + fcvtzs v0.4s, v0.4s, #31 + ld1 {v1.4s}, [x4], #16 + fcvtzs v1.4s, v1.4s, #31 + b 6b +end: + ret +endfunc diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/Makefile ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/Makefile --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/aarch64/Makefile 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/aarch64/Makefile 2014-04-23 09:55:21.000000000 +0000 @@ -1 +1,5 @@ +OBJS += aarch64/audio_convert_init.o + OBJS-$(CONFIG_NEON_CLOBBER_TEST) += aarch64/neontest.o + +NEON-OBJS += aarch64/audio_convert_neon.o diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/audio_convert.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/audio_convert.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/audio_convert.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/audio_convert.c 2014-04-23 09:55:21.000000000 +0000 @@ -301,6 +301,8 @@ set_generic_function(ac); + if (ARCH_AARCH64) + ff_audio_convert_init_aarch64(ac); if (ARCH_ARM) ff_audio_convert_init_arm(ac); if (ARCH_X86) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/audio_convert.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/audio_convert.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/audio_convert.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/audio_convert.h 2014-04-23 09:55:21.000000000 +0000 @@ -96,6 +96,7 @@ /* arch-specific initialization functions */ +void ff_audio_convert_init_aarch64(AudioConvert *ac); void ff_audio_convert_init_arm(AudioConvert *ac); void ff_audio_convert_init_x86(AudioConvert *ac); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/resample.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/resample.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavresample/resample.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavresample/resample.c 2014-04-23 09:55:21.000000000 +0000 @@ -42,7 +42,6 @@ int linear; enum AVResampleFilterType filter_type; int kaiser_beta; - double factor; void (*set_filter)(void *filter, double *tab, int phase, int tap_count); void (*resample_one)(struct ResampleContext *c, void *dst0, int dst_index, const void *src0, @@ -94,10 +93,10 @@ } /* Build a polyphase filterbank. */ -static int build_filter(ResampleContext *c) +static int build_filter(ResampleContext *c, double factor) { int ph, i; - double x, y, w, factor; + double x, y, w; double *tab; int tap_count = c->filter_length; int phase_count = 1 << c->phase_shift; @@ -107,9 +106,6 @@ if (!tab) return AVERROR(ENOMEM); - /* if upsampling, only need to interpolate, no filter */ - factor = FFMIN(c->factor, 1.0); - for (ph = 0; ph < phase_count; ph++) { double norm = 0; for (i = 0; i < tap_count; i++) { @@ -176,7 +172,6 @@ c->phase_shift = avr->phase_shift; c->phase_mask = phase_count - 1; c->linear = avr->linear_interp; - c->factor = factor; c->filter_length = FFMAX((int)ceil(avr->filter_size / factor), 1); c->filter_type = avr->filter_type; c->kaiser_beta = avr->kaiser_beta; @@ -209,7 +204,7 @@ if (!c->filter_bank) goto error; - if (build_filter(c) < 0) + if (build_filter(c, factor) < 0) goto error; memcpy(&c->filter_bank[(c->filter_length * phase_count + 1) * felem_size], diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/avstring.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/avstring.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/avstring.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/avstring.c 2014-04-23 09:55:21.000000000 +0000 @@ -331,15 +331,15 @@ while (code & top) { int tmp; if (p >= buf_end) { - ret = AVERROR(EILSEQ); /* incomplete sequence */ - goto end; + (*bufp) ++; + return AVERROR(EILSEQ); /* incomplete sequence */ } /* we assume the byte to be in the form 10xx-xxxx */ tmp = *p++ - 128; /* strip leading 1 */ if (tmp>>6) { - ret = AVERROR(EILSEQ); - goto end; + (*bufp) ++; + return AVERROR(EILSEQ); } code = (code<<6) + tmp; top <<= 5; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/avutil.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/avutil.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/avutil.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/avutil.h 2014-04-23 09:55:21.000000000 +0000 @@ -282,10 +282,10 @@ #include "common.h" #include "error.h" +#include "rational.h" #include "version.h" #include "macros.h" #include "mathematics.h" -#include "rational.h" #include "log.h" #include "pixfmt.h" @@ -326,6 +326,11 @@ FILE *av_fopen_utf8(const char *path, const char *mode); /** + * Return the fractional representation of the internal time base. + */ +AVRational av_get_time_base_q(void); + +/** * @} * @} */ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/crc.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/crc.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/crc.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/crc.c 2014-04-23 09:55:21.000000000 +0000 @@ -248,6 +248,41 @@ 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, 0x00000001 }, + [AV_CRC_16_ANSI_LE] = { + 0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241, + 0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440, + 0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40, + 0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841, + 0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40, + 0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41, + 0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641, + 0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040, + 0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240, + 0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441, + 0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41, + 0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840, + 0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41, + 0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40, + 0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640, + 0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041, + 0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240, + 0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441, + 0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41, + 0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840, + 0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41, + 0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40, + 0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640, + 0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041, + 0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241, + 0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440, + 0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40, + 0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841, + 0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40, + 0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41, + 0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641, + 0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040, + 0x0001 + }, }; #else #if CONFIG_SMALL @@ -266,6 +301,7 @@ [AV_CRC_24_IEEE] = { 0, 24, 0x864CFB }, [AV_CRC_32_IEEE] = { 0, 32, 0x04C11DB7 }, [AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 }, + [AV_CRC_16_ANSI_LE] = { 1, 16, 0xA001 }, }; static AVCRC av_crc_table[AV_CRC_MAX][CRC_TABLE_SIZE]; #endif @@ -347,9 +383,10 @@ { uint8_t buf[1999]; int i; - int p[5][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 }, + int p[6][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 }, { AV_CRC_32_IEEE , 0x04C11DB7, 0xC0F5BAE0 }, { AV_CRC_24_IEEE , 0x864CFB , 0xB704CE }, + { AV_CRC_16_ANSI_LE, 0xA001 , 0xBFD8 }, { AV_CRC_16_ANSI , 0x8005 , 0x1FBB }, { AV_CRC_8_ATM , 0x07 , 0xE3 } }; @@ -358,7 +395,7 @@ for (i = 0; i < sizeof(buf); i++) buf[i] = i + i * i; - for (i = 0; i < 5; i++) { + for (i = 0; i < 6; i++) { ctx = av_crc_get_table(p[i][0]); printf("crc %08X = %X\n", p[i][1], av_crc(ctx, 0, buf, sizeof(buf))); } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/crc.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/crc.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/crc.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/crc.h 2014-04-23 09:55:21.000000000 +0000 @@ -39,6 +39,7 @@ AV_CRC_16_CCITT, AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ AV_CRC_24_IEEE = 12, AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/frame.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/frame.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/frame.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/frame.c 2014-04-23 09:55:21.000000000 +0000 @@ -204,9 +204,9 @@ } if (planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz(planes * + frame->extended_data = av_mallocz_array(planes, sizeof(*frame->extended_data)); - frame->extended_buf = av_mallocz((planes - AV_NUM_DATA_POINTERS) * + frame->extended_buf = av_mallocz_array((planes - AV_NUM_DATA_POINTERS), sizeof(*frame->extended_buf)); if (!frame->extended_data || !frame->extended_buf) { av_freep(&frame->extended_data); @@ -290,7 +290,7 @@ } if (src->extended_buf) { - dst->extended_buf = av_mallocz(sizeof(*dst->extended_buf) * + dst->extended_buf = av_mallocz_array(sizeof(*dst->extended_buf), src->nb_extended_buf); if (!dst->extended_buf) { ret = AVERROR(ENOMEM); @@ -317,7 +317,7 @@ } CHECK_CHANNELS_CONSISTENCY(src); - dst->extended_data = av_malloc(sizeof(*dst->extended_data) * ch); + dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch); if (!dst->extended_data) { ret = AVERROR(ENOMEM); goto fail; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/internal.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/internal.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/internal.h 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/internal.h 2014-04-23 09:55:21.000000000 +0000 @@ -133,6 +133,24 @@ }\ } +#define FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ +{\ + p = av_malloc_array(nelem, elsize);\ + if (p == NULL) {\ + av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ + goto label;\ + }\ +} + +#define FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, elsize, label)\ +{\ + p = av_mallocz_array(nelem, elsize);\ + if (p == NULL) {\ + av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ + goto label;\ + }\ +} + #include "libm.h" #if defined(_MSC_VER) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/utils.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/utils.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/utils.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/utils.c 2014-04-23 09:55:21.000000000 +0000 @@ -113,3 +113,8 @@ } return i; } + +AVRational av_get_time_base_q(void) +{ + return (AVRational){1, AV_TIME_BASE}; +} diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/version.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/version.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/version.h 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/version.h 2014-04-23 09:55:21.000000000 +0000 @@ -56,7 +56,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 76 +#define LIBAVUTIL_VERSION_MINOR 78 #define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/x86/float_dsp.asm ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/x86/float_dsp.asm --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/x86/float_dsp.asm 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/x86/float_dsp.asm 2014-04-23 09:55:21.000000000 +0000 @@ -61,40 +61,48 @@ %macro VECTOR_FMAC_SCALAR 0 %if UNIX64 -cglobal vector_fmac_scalar, 3,3,3, dst, src, len +cglobal vector_fmac_scalar, 3,3,5, dst, src, len %else -cglobal vector_fmac_scalar, 4,4,3, dst, src, mul, len +cglobal vector_fmac_scalar, 4,4,5, dst, src, mul, len %endif %if ARCH_X86_32 VBROADCASTSS m0, mulm %else %if WIN64 - mova xmm0, xmm2 + SWAP 0, 2 %endif - shufps xmm0, xmm0, 0 + shufps xm0, xm0, 0 %if cpuflag(avx) - vinsertf128 m0, m0, xmm0, 1 + vinsertf128 m0, m0, xm0, 1 %endif %endif lea lenq, [lend*4-64] .loop: -%assign a 0 -%rep 32/mmsize %if cpuflag(fma3) - mova m1, [dstq+lenq+(a+0)*mmsize] - mova m2, [dstq+lenq+(a+1)*mmsize] - fmaddps m1, m0, [srcq+lenq+(a+0)*mmsize], m1 - fmaddps m2, m0, [srcq+lenq+(a+1)*mmsize], m2 -%else - mulps m1, m0, [srcq+lenq+(a+0)*mmsize] - mulps m2, m0, [srcq+lenq+(a+1)*mmsize] - addps m1, m1, [dstq+lenq+(a+0)*mmsize] - addps m2, m2, [dstq+lenq+(a+1)*mmsize] -%endif - mova [dstq+lenq+(a+0)*mmsize], m1 - mova [dstq+lenq+(a+1)*mmsize], m2 -%assign a a+2 -%endrep + mova m1, [dstq+lenq] + mova m2, [dstq+lenq+1*mmsize] + fmaddps m1, m0, [srcq+lenq], m1 + fmaddps m2, m0, [srcq+lenq+1*mmsize], m2 +%else ; cpuflag + mulps m1, m0, [srcq+lenq] + mulps m2, m0, [srcq+lenq+1*mmsize] +%if mmsize < 32 + mulps m3, m0, [srcq+lenq+2*mmsize] + mulps m4, m0, [srcq+lenq+3*mmsize] +%endif ; mmsize + addps m1, m1, [dstq+lenq] + addps m2, m2, [dstq+lenq+1*mmsize] +%if mmsize < 32 + addps m3, m3, [dstq+lenq+2*mmsize] + addps m4, m4, [dstq+lenq+3*mmsize] +%endif ; mmsize +%endif ; cpuflag + mova [dstq+lenq], m1 + mova [dstq+lenq+1*mmsize], m2 +%if mmsize < 32 + mova [dstq+lenq+2*mmsize], m3 + mova [dstq+lenq+3*mmsize], m4 +%endif ; mmsize sub lenq, 64 jge .loop REP_RET @@ -158,16 +166,11 @@ VBROADCASTSD m0, mulm %else %if WIN64 - movlhps xmm2, xmm2 -%if cpuflag(avx) - vinsertf128 ymm2, ymm2, xmm2, 1 -%endif SWAP 0, 2 -%else - movlhps xmm0, xmm0 -%if cpuflag(avx) - vinsertf128 ymm0, ymm0, xmm0, 1 %endif + movlhps xm0, xm0 +%if cpuflag(avx) + vinsertf128 ym0, ym0, xm0, 1 %endif %endif lea lenq, [lend*8-2*mmsize] diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/x86/x86util.asm ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/x86/x86util.asm --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libavutil/x86/x86util.asm 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libavutil/x86/x86util.asm 2014-04-23 09:55:21.000000000 +0000 @@ -273,6 +273,39 @@ %endif %endmacro +%macro HADDD 2 ; sum junk +%if sizeof%1 == 32 +%define %2 xmm%2 + vextracti128 %2, %1, 1 +%define %1 xmm%1 + paddd %1, %2 +%endif +%if mmsize >= 16 +%if cpuflag(xop) && sizeof%1 == 16 + vphadddq %1, %1 +%endif + movhlps %2, %1 + paddd %1, %2 +%endif +%if notcpuflag(xop) || sizeof%1 != 16 + PSHUFLW %2, %1, q0032 + paddd %1, %2 +%endif +%undef %1 +%undef %2 +%endmacro + +%macro HADDW 2 ; reg, tmp +%if cpuflag(xop) && sizeof%1 == 16 + vphaddwq %1, %1 + movhlps %2, %1 + paddd %1, %2 +%else + pmaddwd %1, [pw_1] + HADDD %1, %2 +%endif +%endmacro + %macro PALIGNR 4-5 %if cpuflag(ssse3) %if %0==5 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswresample/resample_template.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswresample/resample_template.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswresample/resample_template.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswresample/resample_template.c 2014-04-23 09:55:21.000000000 +0000 @@ -104,9 +104,11 @@ av_assert1(c->felem_size == sizeof(FELEM)); if(compensation_distance == 0 && c->filter_length == 1 && c->phase_shift==0){ - int64_t index2= ((int64_t)index)<<32; + int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index; int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; - dst_size= FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr); + int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; + + dst_size= FFMIN(dst_size, new_size); for(dst_index=0; dst_index < dst_size; dst_index++){ dst[dst_index] = src[index2>>32]; @@ -116,8 +118,8 @@ index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr; frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr; av_assert2(index >= 0); - *consumed= index >> c->phase_shift; - index &= c->phase_mask; + *consumed= index; + index = 0; }else if(compensation_distance == 0 && !c->linear && index >= 0){ int sample_index = 0; for(dst_index=0; dst_index < dst_size; dst_index++){ diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/swscale.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/swscale.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/swscale.c 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/swscale.c 2014-04-23 09:55:21.000000000 +0000 @@ -705,6 +705,31 @@ return dstY - lastDstY; } +av_cold void ff_sws_init_range_convert(SwsContext *c) +{ + c->lumConvertRange = NULL; + c->chrConvertRange = NULL; + if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { + if (c->dstBpc <= 14) { + if (c->srcRange) { + c->lumConvertRange = lumRangeFromJpeg_c; + c->chrConvertRange = chrRangeFromJpeg_c; + } else { + c->lumConvertRange = lumRangeToJpeg_c; + c->chrConvertRange = chrRangeToJpeg_c; + } + } else { + if (c->srcRange) { + c->lumConvertRange = lumRangeFromJpeg16_c; + c->chrConvertRange = chrRangeFromJpeg16_c; + } else { + c->lumConvertRange = lumRangeToJpeg16_c; + c->chrConvertRange = chrRangeToJpeg16_c; + } + } + } +} + static av_cold void sws_init_swscale(SwsContext *c) { enum AVPixelFormat srcFormat = c->srcFormat; @@ -731,25 +756,7 @@ : hScale16To15_c; } - if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) { - if (c->dstBpc <= 14) { - if (c->srcRange) { - c->lumConvertRange = lumRangeFromJpeg_c; - c->chrConvertRange = chrRangeFromJpeg_c; - } else { - c->lumConvertRange = lumRangeToJpeg_c; - c->chrConvertRange = chrRangeToJpeg_c; - } - } else { - if (c->srcRange) { - c->lumConvertRange = lumRangeFromJpeg16_c; - c->chrConvertRange = chrRangeFromJpeg16_c; - } else { - c->lumConvertRange = lumRangeToJpeg16_c; - c->chrConvertRange = chrRangeToJpeg16_c; - } - } - } + ff_sws_init_range_convert(c); if (!(isGray(srcFormat) || isGray(c->dstFormat) || srcFormat == AV_PIX_FMT_MONOBLACK || srcFormat == AV_PIX_FMT_MONOWHITE)) @@ -922,7 +929,7 @@ uint8_t *dst2[4]; uint8_t *rgb0_tmp = NULL; - if (!srcSlice || !dstStride || !dst || !srcSlice) { + if (!srcStride || !dstStride || !dst || !srcSlice) { av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n"); return 0; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/swscale_internal.h ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/swscale_internal.h --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/swscale_internal.h 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/swscale_internal.h 2014-04-23 09:55:21.000000000 +0000 @@ -617,6 +617,8 @@ void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex, int lastInLumBuf, int lastInChrBuf); +av_cold void ff_sws_init_range_convert(SwsContext *c); + SwsFunc ff_yuv2rgb_init_x86(SwsContext *c); SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c); SwsFunc ff_yuv2rgb_init_bfin(SwsContext *c); diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/utils.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/utils.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/utils.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/utils.c 2014-04-23 09:55:21.000000000 +0000 @@ -983,6 +983,7 @@ { const AVPixFmtDescriptor *desc_dst; const AVPixFmtDescriptor *desc_src; + int need_reinit = 0; memmove(c->srcColorspaceTable, inv_table, sizeof(int) * 4); memmove(c->dstColorspaceTable, table, sizeof(int) * 4); @@ -998,9 +999,14 @@ c->brightness = brightness; c->contrast = contrast; c->saturation = saturation; + if (c->srcRange != srcRange || c->dstRange != dstRange) + need_reinit = 1; c->srcRange = srcRange; c->dstRange = dstRange; + if (need_reinit && c->srcBpc == 8) + ff_sws_init_range_convert(c); + if ((isYUV(c->dstFormat) || isGray(c->dstFormat)) && (isYUV(c->srcFormat) || isGray(c->srcFormat))) return -1; @@ -1334,20 +1340,6 @@ FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail); - /* unscaled special cases */ - if (unscaled && !usesHFilter && !usesVFilter && - (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { - ff_get_unscaled_swscale(c); - - if (c->swscale) { - if (flags & SWS_PRINT_INFO) - av_log(c, AV_LOG_INFO, - "using unscaled %s -> %s special converter\n", - av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); - return 0; - } - } - c->srcBpc = 1 + desc_src->comp[0].depth_minus1; if (c->srcBpc < 8) c->srcBpc = 8; @@ -1643,6 +1635,20 @@ c->chrXInc, c->chrYInc); } + /* unscaled special cases */ + if (unscaled && !usesHFilter && !usesVFilter && + (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) { + ff_get_unscaled_swscale(c); + + if (c->swscale) { + if (flags & SWS_PRINT_INFO) + av_log(c, AV_LOG_INFO, + "using unscaled %s -> %s special converter\n", + av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat)); + return 0; + } + } + c->swscale = ff_getSwsFunc(c); return 0; fail: // FIXME replace things by appropriate error codes diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/x86/swscale_template.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/x86/swscale_template.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/x86/swscale_template.c 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/x86/swscale_template.c 2014-04-23 09:55:21.000000000 +0000 @@ -666,6 +666,7 @@ #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX(dst, dstw, index) #endif +#if HAVE_6REGS static void RENAME(yuv2bgr24_X_ar)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrUSrc, @@ -715,6 +716,7 @@ : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S ); } +#endif /* HAVE_6REGS */ #define REAL_WRITEYUY2(dst, dstw, index) \ "packuswb %%mm3, %%mm3 \n\t"\ @@ -1664,7 +1666,9 @@ if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break; +#if HAVE_6REGS case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break; +#endif case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X_ar); break; case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X_ar); break; case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break; @@ -1677,7 +1681,9 @@ if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case AV_PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; +#if HAVE_6REGS case AV_PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break; +#endif case AV_PIX_FMT_RGB555: c->yuv2packedX = RENAME(yuv2rgb555_X); break; case AV_PIX_FMT_RGB565: c->yuv2packedX = RENAME(yuv2rgb565_X); break; case AV_PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break; diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/x86/yuv2rgb.c ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/x86/yuv2rgb.c --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/libswscale/x86/yuv2rgb.c 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/libswscale/x86/yuv2rgb.c 2014-04-23 09:55:21.000000000 +0000 @@ -50,28 +50,28 @@ DECLARE_ASM_CONST(8, uint64_t, pb_07) = 0x0707070707070707ULL; //MMX versions -#if HAVE_MMX_INLINE +#if HAVE_MMX_INLINE && HAVE_6REGS #undef RENAME #undef COMPILE_TEMPLATE_MMXEXT #define COMPILE_TEMPLATE_MMXEXT 0 #define RENAME(a) a ## _mmx #include "yuv2rgb_template.c" -#endif /* HAVE_MMX_INLINE */ +#endif /* HAVE_MMX_INLINE && HAVE_6REGS */ // MMXEXT versions -#if HAVE_MMXEXT_INLINE +#if HAVE_MMXEXT_INLINE && HAVE_6REGS #undef RENAME #undef COMPILE_TEMPLATE_MMXEXT #define COMPILE_TEMPLATE_MMXEXT 1 #define RENAME(a) a ## _mmxext #include "yuv2rgb_template.c" -#endif /* HAVE_MMXEXT_INLINE */ +#endif /* HAVE_MMXEXT_INLINE && HAVE_6REGS */ #endif /* HAVE_INLINE_ASM */ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c) { -#if HAVE_MMX_INLINE +#if HAVE_MMX_INLINE && HAVE_6REGS int cpu_flags = av_get_cpu_flags(); #if HAVE_MMXEXT_INLINE @@ -113,7 +113,7 @@ return yuv420_rgb15_mmx; } } -#endif /* HAVE_MMX_INLINE */ +#endif /* HAVE_MMX_INLINE && HAVE_6REGS */ return NULL; } diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/MAINTAINERS ffmpeg-2.2.1+git~trusty1.1/ffmpeg/MAINTAINERS --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/MAINTAINERS 2014-04-13 13:48:08.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/MAINTAINERS 2014-04-23 09:55:21.000000000 +0000 @@ -168,6 +168,7 @@ exif.c, exif.h Thilo Borgmann ffv1.c Michael Niedermayer ffwavesynth.c Nicolas George + fic.c Derek Buitenhuis flac* Justin Ruggles flashsv* Benjamin Larsson flicvideo.c Mike Melanson diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/RELEASE ffmpeg-2.2.1+git~trusty1.1/ffmpeg/RELEASE --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/RELEASE 2014-04-13 13:53:58.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/RELEASE 2014-04-23 12:00:51.000000000 +0000 @@ -1 +1 @@ -2.2.git-ca6dd53 +2.2.1git-1ba59b1 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/acodec.mak ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/acodec.mak --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/acodec.mak 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/acodec.mak 2014-04-23 09:55:21.000000000 +0000 @@ -67,6 +67,7 @@ FATE_ACODEC-$(call ENCDEC, MP2, MP2 MP3) += fate-acodec-mp2 fate-acodec-mp2: FMT = mp2 fate-acodec-mp2: CMP_SHIFT = -1924 +fate-acodec-mp2: ENCOPTS = -b:a 128k FATE_ACODEC-$(call ENCDEC, MP2FIXED MP2 , MP2 MP3) += fate-acodec-mp2fixed fate-acodec-mp2fixed: FMT = mp2 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/audio.mak ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/audio.mak --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/audio.mak 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/audio.mak 2014-04-23 09:55:21.000000000 +0000 @@ -24,6 +24,11 @@ fate-dts: CMP = oneoff fate-dts: REF = $(SAMPLES)/dts/dts.pcm +FATE_SAMPLES_AUDIO-$(call DEMDEC, DTS, DCA) += fate-dts_es +fate-dts_es: CMD = pcm -i $(TARGET_SAMPLES)/dts/dts_es.dts +fate-dts_es: CMP = oneoff +fate-dts_es: REF = $(SAMPLES)/dts/dts_es.pcm + FATE_SAMPLES_AUDIO-$(call DEMDEC, AVI, IMC) += fate-imc fate-imc: CMD = pcm -i $(TARGET_SAMPLES)/imc/imc.avi fate-imc: CMP = oneoff diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/demux.mak ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/demux.mak --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/demux.mak 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/demux.mak 2014-04-23 09:55:21.000000000 +0000 @@ -46,6 +46,9 @@ FATE_SAMPLES_DEMUX-$(call DEMDEC, MATROSKA, H264) += fate-mkv fate-mkv: CMD = framecrc -i $(TARGET_SAMPLES)/mkv/test7_cut.mkv -c copy +FATE_SAMPLES_DEMUX-$(CONFIG_MLV_DEMUXER) += fate-mlv-demux +fate-mlv-demux: CMD = crc -i $(TARGET_SAMPLES)/mlv/M19-0333-cut.MLV -c copy + FATE_SAMPLES_DEMUX-$(CONFIG_MTV_DEMUXER) += fate-mtv fate-mtv: CMD = framecrc -i $(TARGET_SAMPLES)/mtv/comedian_auto-partial.mtv -c copy diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/libswresample.mak ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/libswresample.mak --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/libswresample.mak 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/libswresample.mak 2014-04-23 09:55:21.000000000 +0000 @@ -9,6 +9,8 @@ SAMPLERATES_LITE = 8000 44100 48000 +SAMPLERATES_NN = 8000 44100 + define ARESAMPLE FATE_SWR_RESAMPLE += fate-swr-resample-$(3)-$(1)-$(2) fate-swr-resample-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav @@ -311,6 +313,29 @@ fate-swr-resample_lin-fltp-48000-44100: SIZE_TOLERANCE = 576000 - 20480 endef +define ARESAMPLE_NN +FATE_SWR_RESAMPLE += fate-swr-resample_nn-$(3)-$(1)-$(2) +fate-swr-resample_nn-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav +fate-swr-resample_nn-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):filter_size=1:phase_shift=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le - + +fate-swr-resample_nn-$(3)-$(1)-$(2): CMP = stddev +fate-swr-resample_nn-$(3)-$(1)-$(2): CMP_UNIT = $(5) +fate-swr-resample_nn-$(3)-$(1)-$(2): FUZZ = 0.1 +fate-swr-resample_nn-$(3)-$(1)-$(2): REF = tests/data/asynth-$(1)-1.wav + +fate-swr-resample_nn-fltp-44100-8000: CMP_TARGET = 590.98 +fate-swr-resample_nn-fltp-44100-8000: SIZE_TOLERANCE = 529200 - 20486 + +fate-swr-resample_nn-fltp-8000-44100: CMP_TARGET = 3163.32 +fate-swr-resample_nn-fltp-8000-44100: SIZE_TOLERANCE = 96000 - 20480 + +fate-swr-resample_nn-s16p-44100-8000: CMP_TARGET = 590.97 +fate-swr-resample_nn-s16p-44100-8000: SIZE_TOLERANCE = 529200 - 20486 + +fate-swr-resample_nn-s16p-8000-44100: CMP_TARGET = 3163.39 +fate-swr-resample_nn-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20480 +endef + $(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE,s16p,s16le,s16) $(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE,s32p,s32le,s16) $(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE,fltp,f32le,s16) @@ -319,6 +344,9 @@ $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_LIN,s16p,s16le,s16) $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_LIN,fltp,f32le,s16) +$(call CROSS_TEST,$(SAMPLERATES_NN),ARESAMPLE_NN,s16p,s16le,s16) +$(call CROSS_TEST,$(SAMPLERATES_NN),ARESAMPLE_NN,fltp,f32le,s16) + FATE_SWR_RESAMPLE-$(call FILTERDEMDECENCMUX, ARESAMPLE, WAV, PCM_S16LE, PCM_S16LE, WAV) += $(FATE_SWR_RESAMPLE) fate-swr-resample: $(FATE_SWR_RESAMPLE-yes) FATE_SWR += $(FATE_SWR_RESAMPLE-yes) diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/video.mak ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/video.mak --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/fate/video.mak 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/fate/video.mak 2014-04-23 09:55:21.000000000 +0000 @@ -189,6 +189,15 @@ FATE_VIDEO-$(call DEMDEC, MPEGTS, MPEG2VIDEO) += fate-mpeg2-field-enc fate-mpeg2-field-enc: CMD = framecrc -flags +bitexact -idct simple -i $(TARGET_SAMPLES)/mpeg2/mpeg2_field_encoding.ts -an -vframes 30 +FATE_VIDEO-$(call DEMDEC, MV, MVC1) += fate-mv-mvc1 +fate-mv-mvc1: CMD = framecrc -i $(TARGET_SAMPLES)/mv/posture.mv -an -frames 25 -pix_fmt rgb555le + +FATE_VIDEO-$(call DEMDEC, MV, MVC2) += fate-mv-mvc2 +fate-mv-mvc2: CMD = framecrc -i $(TARGET_SAMPLES)/mv/12345.mv -an -frames 30 -pix_fmt bgra + +FATE_VIDEO-$(call DEMDEC, MV, SGIRLE) += fate-mv-sgirle +fate-mv-sgirle: CMD = framecrc -i $(TARGET_SAMPLES)/mv/pet-rle.movie -an + FATE_VIDEO-$(call DEMDEC, MXG, MXPEG) += fate-mxpeg fate-mxpeg: CMD = framecrc -idct simple -flags +bitexact -i $(TARGET_SAMPLES)/mxpeg/m1.mxg -an diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/acodec/mp2 ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/acodec/mp2 --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/acodec/mp2 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/acodec/mp2 2014-04-23 09:55:21.000000000 +0000 @@ -1,4 +1,4 @@ -9d3135841ef813fa9c81c41cdc2f1666 *tests/data/fate/acodec-mp2.mp2 -288391 tests/data/fate/acodec-mp2.mp2 -02f0b174b57c2c4b3d848a09e00e106e *tests/data/fate/acodec-mp2.out.wav -stddev: 3653.85 PSNR: 25.07 MAXDIFF:39971 bytes: 1058400/ 1057916 +f6eb0a205350bbd7fb1028a01c7ae8aa *tests/data/fate/acodec-mp2.mp2 +96130 tests/data/fate/acodec-mp2.mp2 +5a669ca7321adc6ab66a3eade4035909 *tests/data/fate/acodec-mp2.out.wav +stddev: 4384.33 PSNR: 23.49 MAXDIFF:52631 bytes: 1058400/ 1057916 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/crc ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/crc --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/crc 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/crc 2014-04-23 09:55:21.000000000 +0000 @@ -1,5 +1,6 @@ crc EDB88320 = 3D5CDD04 crc 04C11DB7 = E0BAF5C0 crc 00864CFB = 326039 +crc 0000A001 = BFD8 crc 00008005 = BB1F crc 00000007 = E3 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/filter-metadata-scenedetect ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/filter-metadata-scenedetect --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/filter-metadata-scenedetect 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/filter-metadata-scenedetect 2014-04-23 09:55:21.000000000 +0000 @@ -1,10 +1,10 @@ pkt_pts=1620|tag:lavfi.scene_score=1.000000 -pkt_pts=4140|tag:lavfi.scene_score=0.880000 +pkt_pts=4140|tag:lavfi.scene_score=0.876043 pkt_pts=5800|tag:lavfi.scene_score=1.000000 -pkt_pts=6720|tag:lavfi.scene_score=0.460000 +pkt_pts=6720|tag:lavfi.scene_score=0.463259 pkt_pts=8160|tag:lavfi.scene_score=1.000000 pkt_pts=9760|tag:lavfi.scene_score=1.000000 -pkt_pts=14080|tag:lavfi.scene_score=0.840000 +pkt_pts=14080|tag:lavfi.scene_score=0.841420 pkt_pts=15700|tag:lavfi.scene_score=1.000000 -pkt_pts=18500|tag:lavfi.scene_score=0.470000 +pkt_pts=18500|tag:lavfi.scene_score=0.471738 pkt_pts=21760|tag:lavfi.scene_score=1.000000 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/filter-pixfmts-rotate ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/filter-pixfmts-rotate --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/filter-pixfmts-rotate 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/filter-pixfmts-rotate 2014-04-23 09:55:21.000000000 +0000 @@ -1,20 +1,20 @@ -0bgr 1040a5c4645582fc271f7be40ea5aaf7 -0rgb 7f21fcf8fd658de854b75dd8c47b0b00 -abgr 24f441d2e6e67cae2d3451aa1dad23a7 -argb 993002f41f621d04cd76278e466c03eb -bgr0 efe11efe2840fa84ee95cdb913463bc1 -bgr24 d0f449e8b38e07c947bd808f441a8ace -bgra 54cebf01881cb63ec3727f7cc23b0a6b -gbrap 6d69c0cd0cba6300065f8d990e35b081 -gbrp db3b6345d2a5c0fb524f93486d97193e -gray 5a896c38449a0fb08129a7394952eb31 -rgb0 c29f92ff5224044c7272c763fa5321e6 -rgb24 739f0eb47e76ce5c87354d5631ac2d5b -rgba f25570a798f24e8174729d978872c272 -yuv410p 22e673170464119cafb1a973c5a8080c -yuv420p afed4567a1b2d54ca9bc87bbdfff9a34 -yuv444p df57aba68928092b54f6b75ab01e3110 -yuva420p ad9bdb4f21855550a6f94e2d96588097 -yuva444p b6a345f46ef75814033f733ccb4da42e -yuvj420p ccc0724c2ff91daa3848db1f4d91d010 -yuvj444p 9165b6e7c647c93cd24011d931890edb +0bgr cdd2136dc74f315020290ebf8b95fb75 +0rgb 55a14614aaa4144928b4e795c3990da8 +abgr 6138620129451d433ed169600476aaad +argb 64ade9d0e67fea30e3e119995df3ffa0 +bgr0 c5cca289d918de99885968ef7be34039 +bgr24 f0132dd813a7d99ca6a412759e55db76 +bgra 9c1e00c6b6baa25ed54660c6ca4f2914 +gbrap f26cdfccf9f1f5da750127a9406005c8 +gbrp 50e955e81205ea20cfd5170830f91e0b +gray f0ef450ff90edc58dc48e790f6c10fcc +rgb0 01e16160f78fa5a171d794b3594bbf5b +rgb24 e445aeb43f0a03c03af571df1dd98914 +rgba 39b3bd5b8af36873d6723b17f16e5fa7 +yuv410p 0b702cab08cb79d07cbd54ad1bfd08ba +yuv420p 4a8c4786b9bd2b0156d719870dc98fbf +yuv444p 85a0a7d0a28d2b9f5239cd2ee06dc0e4 +yuva420p bf368d93ae54ca84235cb482b948229b +yuva444p 6d528668eb4ee9f06aa56b0bd9a8bf34 +yuvj420p 715334a97fcf8b0a911174c45966d90e +yuvj444p f41bd0d4b8f238c518178159613745b4 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mlv-demux ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mlv-demux --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mlv-demux 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mlv-demux 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1 @@ +CRC=0x937f8af3 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-mvc1 ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-mvc1 --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-mvc1 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-mvc1 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,26 @@ +#tb 0: 1/10 +0, 0, 0, 1, 221184, 0x340ab080 +0, 1, 1, 1, 221184, 0xc21105a0 +0, 2, 2, 1, 221184, 0xa7482ab3 +0, 3, 3, 1, 221184, 0x67b0402b +0, 4, 4, 1, 221184, 0xa0b9632a +0, 5, 5, 1, 221184, 0x54e6af93 +0, 6, 6, 1, 221184, 0x90b3f085 +0, 7, 7, 1, 221184, 0x7aea8672 +0, 8, 8, 1, 221184, 0xbf01a23a +0, 9, 9, 1, 221184, 0x1dc692cc +0, 10, 10, 1, 221184, 0xd16bcc43 +0, 11, 11, 1, 221184, 0x103b8c41 +0, 12, 12, 1, 221184, 0xc2c964b6 +0, 13, 13, 1, 221184, 0x2837fbec +0, 14, 14, 1, 221184, 0x16de6390 +0, 15, 15, 1, 221184, 0xbaf0fd33 +0, 16, 16, 1, 221184, 0x7b05cca6 +0, 17, 17, 1, 221184, 0x5b0ae526 +0, 18, 18, 1, 221184, 0xd786f4e2 +0, 19, 19, 1, 221184, 0x21b88d75 +0, 20, 20, 1, 221184, 0xe41e6297 +0, 21, 21, 1, 221184, 0xd075f578 +0, 22, 22, 1, 221184, 0x1eaffc99 +0, 23, 23, 1, 221184, 0xcbd44422 +0, 24, 24, 1, 221184, 0x0e377c8a diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-mvc2 ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-mvc2 --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-mvc2 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-mvc2 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,31 @@ +#tb 0: 1/60 +0, 0, 0, 1, 126336, 0xb50e8bb0 +0, 1, 1, 1, 126336, 0xdc260cfa +0, 2, 2, 1, 126336, 0x2762f0d9 +0, 3, 3, 1, 126336, 0xec87d823 +0, 4, 4, 1, 126336, 0x1b28b47b +0, 5, 5, 1, 126336, 0x65508be0 +0, 6, 6, 1, 126336, 0x175565f0 +0, 7, 7, 1, 126336, 0x483f5138 +0, 8, 8, 1, 126336, 0xaacd2a7c +0, 9, 9, 1, 126336, 0x170c09f5 +0, 10, 10, 1, 126336, 0x27c0e945 +0, 11, 11, 1, 126336, 0x5555d3fd +0, 12, 12, 1, 126336, 0x7749ad6a +0, 13, 13, 1, 126336, 0xee3096de +0, 14, 14, 1, 126336, 0xe2b27655 +0, 15, 15, 1, 126336, 0x580556e5 +0, 16, 16, 1, 126336, 0x6f912baa +0, 17, 17, 1, 126336, 0xb57e0b94 +0, 18, 18, 1, 126336, 0x2032e017 +0, 19, 19, 1, 126336, 0xe08da60f +0, 20, 20, 1, 126336, 0xb8419e26 +0, 21, 21, 1, 126336, 0xaf58b9d1 +0, 22, 22, 1, 126336, 0x3d88e5ba +0, 23, 23, 1, 126336, 0x83d30a85 +0, 24, 24, 1, 126336, 0x8f2c27af +0, 25, 25, 1, 126336, 0x296c3a7e +0, 26, 26, 1, 126336, 0xf6d458ac +0, 27, 27, 1, 126336, 0x2e2172aa +0, 28, 28, 1, 126336, 0x611c8b2f +0, 29, 29, 1, 126336, 0x64b2c607 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-sgirle ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-sgirle --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/mv-sgirle 1970-01-01 00:00:00.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/mv-sgirle 2014-04-23 09:55:21.000000000 +0000 @@ -0,0 +1,32 @@ +#tb 0: 1/4 +0, 0, 0, 1, 187500, 0xf2c26a39 +0, 1, 1, 1, 187500, 0xf65e6ea5 +0, 2, 2, 1, 187500, 0x804f78d0 +0, 3, 3, 1, 187500, 0x47a69f58 +0, 4, 4, 1, 187500, 0x7286207c +0, 5, 5, 1, 187500, 0x8e4111fc +0, 6, 6, 1, 187500, 0x8e2af3ba +0, 7, 7, 1, 187500, 0xdae8b4e3 +0, 8, 8, 1, 187500, 0x43178cdd +0, 9, 9, 1, 187500, 0xcecdf216 +0, 10, 10, 1, 187500, 0x31a4c772 +0, 11, 11, 1, 187500, 0x7e09b58d +0, 12, 12, 1, 187500, 0x92e9a999 +0, 13, 13, 1, 187500, 0x4fdc7c43 +0, 14, 14, 1, 187500, 0xf03945bd +0, 15, 15, 1, 187500, 0xb87d0fa8 +0, 16, 16, 1, 187500, 0xf85a99ac +0, 17, 17, 1, 187500, 0x08bb0d34 +0, 18, 18, 1, 187500, 0x82216d03 +0, 19, 19, 1, 187500, 0xc4ce0a7b +0, 20, 20, 1, 187500, 0x099863c2 +0, 21, 21, 1, 187500, 0xc5e44d02 +0, 22, 22, 1, 187500, 0x2fa8c68a +0, 23, 23, 1, 187500, 0x8ee13c76 +0, 24, 24, 1, 187500, 0xbd6f9e6a +0, 25, 25, 1, 187500, 0x8017e354 +0, 26, 26, 1, 187500, 0x6d471686 +0, 27, 27, 1, 187500, 0xfb675046 +0, 28, 28, 1, 187500, 0x8c6b8e59 +0, 29, 29, 1, 187500, 0x421bb7a6 +0, 30, 30, 1, 187500, 0x09bb7932 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/vc1_sa10143 ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/vc1_sa10143 --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/fate/vc1_sa10143 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/fate/vc1_sa10143 2014-04-23 09:55:21.000000000 +0000 @@ -1,31 +1,31 @@ #tb 0: 1/25 0, 0, 0, 1, 518400, 0x89407f55 -0, 2, 2, 1, 518400, 0x8611849c +0, 2, 2, 1, 518400, 0xaa896afd 0, 3, 3, 1, 518400, 0x0e69ff59 -0, 4, 4, 1, 518400, 0xf31adb03 +0, 4, 4, 1, 518400, 0x0c30bfa0 0, 5, 5, 1, 518400, 0x1a5b6a69 -0, 6, 6, 1, 518400, 0x6ae6232e +0, 6, 6, 1, 518400, 0x23470858 0, 7, 7, 1, 518400, 0x9a4e3c54 -0, 8, 8, 1, 518400, 0xe5852b45 +0, 8, 8, 1, 518400, 0xad63160b 0, 9, 9, 1, 518400, 0x0fcfeebc -0, 10, 10, 1, 518400, 0x06e22dc3 +0, 10, 10, 1, 518400, 0x20b31777 0, 11, 11, 1, 518400, 0x9d79df09 -0, 12, 12, 1, 518400, 0xcb2c716f +0, 12, 12, 1, 518400, 0x3e86766f 0, 13, 13, 1, 518400, 0x638a8746 -0, 14, 14, 1, 518400, 0xf7032efd +0, 14, 14, 1, 518400, 0x7a6c1a0e 0, 15, 15, 1, 518400, 0x306f6cef -0, 16, 16, 1, 518400, 0xe83d2518 +0, 16, 16, 1, 518400, 0x81f81281 0, 17, 17, 1, 518400, 0x49ab5bf5 -0, 18, 18, 1, 518400, 0x6b336b6f +0, 18, 18, 1, 518400, 0x8f316e44 0, 19, 19, 1, 518400, 0x95ae00c9 -0, 20, 20, 1, 518400, 0x68ddb64f +0, 20, 20, 1, 518400, 0xf71bb7f5 0, 21, 21, 1, 518400, 0x5205ea68 -0, 22, 22, 1, 518400, 0xb088e617 +0, 22, 22, 1, 518400, 0x74a1d8b9 0, 23, 23, 1, 518400, 0xa3217616 -0, 24, 24, 1, 518400, 0x1723bc53 +0, 24, 24, 1, 518400, 0x2b28bbf8 0, 25, 25, 1, 518400, 0xf024872a -0, 26, 26, 1, 518400, 0x2e81a8bb +0, 26, 26, 1, 518400, 0x2fdbaaf3 0, 27, 27, 1, 518400, 0xa3a2418e -0, 28, 28, 1, 518400, 0xb7beffed +0, 28, 28, 1, 518400, 0x55bfe435 0, 29, 29, 1, 518400, 0x50fb6c94 0, 30, 30, 1, 518400, 0x5584bb40 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/lavf/ts ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/lavf/ts --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/lavf/ts 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/lavf/ts 2014-04-23 09:55:21.000000000 +0000 @@ -1,3 +1,3 @@ -e0738e00907d371ffbdee5caeab4277d *./tests/data/lavf/lavf.ts +cca6bca512605bbde20b7aa5cccf4850 *./tests/data/lavf/lavf.ts 407020 ./tests/data/lavf/lavf.ts ./tests/data/lavf/lavf.ts CRC=0x71287e25 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/seek/acodec-flac ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/seek/acodec-flac --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/seek/acodec-flac 2014-04-07 23:28:01.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/seek/acodec-flac 2014-04-23 09:55:21.000000000 +0000 @@ -5,14 +5,16 @@ ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 86742 size: 2191 ret: 0 st: 0 flags:0 ts: 0.788345 ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 27366 size: 615 -ret:-1 st: 0 flags:1 ts:-0.317506 +ret: 0 st: 0 flags:1 ts:-0.317506 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 ret: 0 st:-1 flags:0 ts: 2.576668 ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 145606 size: 2384 ret: 0 st:-1 flags:1 ts: 1.470835 ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 53388 size: 1851 ret: 0 st: 0 flags:0 ts: 0.365011 ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 16890 size: 614 -ret:-1 st: 0 flags:1 ts:-0.740839 +ret: 0 st: 0 flags:1 ts:-0.740839 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 ret: 0 st:-1 flags:0 ts: 2.153336 ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 110531 size: 2143 ret: 0 st:-1 flags:1 ts: 1.047503 @@ -39,11 +41,13 @@ ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 95508 size: 2169 ret: 0 st:-1 flags:0 ts: 0.883340 ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 29211 size: 620 -ret:-1 st:-1 flags:1 ts:-0.222493 +ret: 0 st:-1 flags:1 ts:-0.222493 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 ret: 0 st: 0 flags:0 ts: 2.671678 ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 155154 size: 2394 ret: 0 st: 0 flags:1 ts: 1.565850 ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 59082 size: 1974 ret: 0 st:-1 flags:0 ts: 0.460008 ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 19353 size: 608 -ret:-1 st:-1 flags:1 ts:-0.645825 +ret: 0 st:-1 flags:1 ts:-0.645825 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 8256 size: 614 diff -Nru ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/seek/acodec-mp2 ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/seek/acodec-mp2 --- ffmpeg-2.2+gitca6dd53~trusty1/ffmpeg/tests/ref/seek/acodec-mp2 2014-04-11 12:57:46.000000000 +0000 +++ ffmpeg-2.2.1+git~trusty1.1/ffmpeg/tests/ref/seek/acodec-mp2 2014-04-23 09:55:21.000000000 +0000 @@ -1,49 +1,49 @@ -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1253 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 417 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 90279 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.880816 pts: 1.880816 pos: 30093 size: 418 ret: 0 st: 0 flags:0 ts: 0.788334 -ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 38870 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.809796 pts: 0.809796 pos: 12956 size: 418 ret:-1 st: 0 flags:1 ts:-0.317499 ret: 0 st:-1 flags:0 ts: 2.576668 -ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 124133 size: 1254 +ret: 0 st: 0 flags:1 dts: 2.586122 pts: 2.586122 pos: 41377 size: 418 ret: 0 st:-1 flags:1 ts: 1.470835 -ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 70217 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.462857 pts: 1.462857 pos: 23405 size: 418 ret: 0 st: 0 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 17554 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.365714 pts: 0.365714 pos: 5851 size: 418 ret:-1 st: 0 flags:1 ts:-0.740831 ret: 0 st:-1 flags:0 ts: 2.153336 -ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 104071 size: 1254 +ret: 0 st: 0 flags:1 dts: 2.168163 pts: 2.168163 pos: 34690 size: 418 ret: 0 st:-1 flags:1 ts: 1.047503 -ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 50155 size: 1253 +ret: 0 st: 0 flags:1 dts: 1.044898 pts: 1.044898 pos: 16718 size: 418 ret: 0 st: 0 flags:0 ts:-0.058330 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440 ret: 0 st: 0 flags:1 ts: 2.835837 -ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 135418 size: 1254 +ret: 0 st: 0 flags:1 dts: 2.821224 pts: 2.821224 pos: 45139 size: 418 ret: 0 st:-1 flags:0 ts: 1.730004 -ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 84009 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.750204 pts: 1.750204 pos: 28003 size: 418 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 28839 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.600816 pts: 0.600816 pos: 9613 size: 418 ret: 0 st: 0 flags:0 ts:-0.481662 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440 ret: 0 st: 0 flags:1 ts: 2.412505 -ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 115356 size: 1254 +ret: 0 st: 0 flags:1 dts: 2.403265 pts: 2.403265 pos: 38452 size: 418 ret: 0 st:-1 flags:0 ts: 1.306672 -ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 63947 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.332245 pts: 1.332245 pos: 21315 size: 418 ret: 0 st:-1 flags:1 ts: 0.200839 -ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 8777 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.182857 pts: 0.182857 pos: 2925 size: 418 ret: 0 st: 0 flags:0 ts:-0.904994 -ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 1276 +ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: 0 size: 440 ret: 0 st: 0 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 95294 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.985306 pts: 1.985306 pos: 31764 size: 418 ret: 0 st:-1 flags:0 ts: 0.883340 -ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 42631 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.888163 pts: 0.888163 pos: 14210 size: 418 ret:-1 st:-1 flags:1 ts:-0.222493 ret: 0 st: 0 flags:0 ts: 2.671674 -ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 129149 size: 1254 +ret: 0 st: 0 flags:1 dts: 2.690612 pts: 2.690612 pos: 43049 size: 418 ret: 0 st: 0 flags:1 ts: 1.565841 -ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 73978 size: 1254 +ret: 0 st: 0 flags:1 dts: 1.541224 pts: 1.541224 pos: 24659 size: 418 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 22569 size: 1254 +ret: 0 st: 0 flags:1 dts: 0.470204 pts: 0.470204 pos: 7523 size: 418 ret:-1 st:-1 flags:1 ts:-0.645825