Merge branch 'master' into oldabi
* master: mmsh: fixed printf injection bug in mmsh request ac3enc: use correct alignment and length in channel coupling dsp functions. ffmpeg: don't abuse a global for passing framerate from input to output ffmpeg: don't abuse a global for passing channels from input to output ffmpeg: don't abuse a global for passing samplerate from input to output Make buffer size check consistent and avoid a possible overflow. Fix spelling. Full support for sending H.264 in RTP ARM: update ff_h264_idct8_add4_neon for 4:4:4 changes swscale: use SwsContext for av_log when available Support reading chan atoms with empty channel descriptions. Reindent after last commit. Fix multi-channel AAC encoding. Fix "redundant redeclaration" warning. Fix compilation with --disable-everything --enable-encoder=ac3/ac3_fixed. vf_mp: Fix large memleak. swscale: Remove HAVE_MMX from files that are only compiled with MMX enabled. swscale: Fix compilation with --disable-mmx2. mjpegenc: Fix JFIF version swscale: remove misplaced comment. ffmpeg: fix streaming to ffserver. swscale: split out RGB48 output functions from yuv2packed[12X]_c(). build: move vpath directives to main Makefile swscale: fix JPEG-range YUV scaling artifacts. build: move ALLFFLIBS to a more logical place ARM: factor some repetitive code into macros CrystalHD: Use mp4toannexb bitstream filter. CrystalHD: Keep mp4toannexb filter around for entire decoder lifetime. Fix SVQ3 after adding 4:4:4 H.264 support H.264: fix CODEC_FLAG_GRAY 4:4:4 H.264 decoding support matroskadec: properly decode color space in an endian neutral way matroskadec: use a temporary fourcc variable matroskaenc: ensure the written colorspace don't depend on host endianness ac3enc: fix allocation of floating point samples. utils: Drop pointless '#if 1' preprocessor directive. ac3enc: remove empty ac3_float function that is never called ac3enc: split templated float vs. fixed functions into a separate file. ac3enc: dynamically allocate AC3EncodeContext fields windowed_samples and mdct ac3enc: use function pointer to choose between AC-3 and E-AC-3 header output functions. Roll back 4:4:4 H.264 for now Needs some ARM/PPC asm modifications. Fix SVQ3 after adding 4:4:4 H.264 support H.264: fix CODEC_FLAG_GRAY 4:4:4 H.264 decoding support h264_parser: Fix whitespace after previous change. h264_parser: Fix behaviour when PARSER_FLAG_COMPLETE_FRAMES is set. wav: remove an invalid free(). lavf: initialise reference_dts in av_estimate_timings_from_pts. h264: don't be so picky on decoding pps in extradata. avcodec.h: add or elaborate on some documentation comments. h264: change a few comments into error messages ac3dec: fix doxy-style for comment ("///>" should be "///<" instead). img2: add .dpx to the list of supported file extensions. ffv1: fix undefined behavior with insane widths. replace remaining usage of deprecated av_metadata_set2() by av_dict_set() matroskaenc: write colourspace element for rawvideo tracks nsv: simplify probe function nsv: return error code instead of discarding it in read_header() ARM: jrevdct_arm: simplify stack usage ARM: jrevdct_arm: use push/pop mnemonics ARM: jrevdct_arm: misc cleanup ARM: optimised mpadsp_apply_window_fixed Add some (important) changelog entries H264: Reduce pointless diffs to qatar Revert "H264: Split out hl_motion and template it, this seems a bit faster" libavfilter: implement avfilter_fill_frame_from_video_buffer_ref() avfiltergraph: make the AVFilterInOut alloc/free API public avfiltergraph: change the syntax of avfilter_graph_parse() graphparser: prefer void * over AVClass * for log contexts h264: Complexify frame num gap shortening code Update todo mpeg12: replace 2 asserts by av_assert0 cmdutils: add missing NULL check in parse_options() x11grab: remove a memory allocation and the associated memcpy. Fix --disable-everything build: fix "make install" with documentation disabled build: simplify some conditional targets resample: clarify supported resampling. lavfi: fix signature for avfilter_graph_parse() and avfilter_graph_config() avfiltergraph: use meaningful error codes Revert "ac3: there was no libav in 2010 thus this code cannot be from libav." Fix -t option for formats which holds dts and no pts dnxhd: Renama tables Extract rotation in MOV metadata bitstream: Properly promote av_reverse values before shifting. pixfmt: Replace 9/10bit deprecation by a technical explanation. libavutil/swscale: YUV444P10/YUV444P9 support. H.264: Fix high bit depth explicit biweight h264: Fix 10-bit H.264 x86 chroma v loopfilter asm. Replace DEBUG_SEEK/DEBUG_SI + av_log combinations by av_dlog. Update copyright year for ac3enc_opts_template.c. adts: Adjust frame size mask to follow the specification. APIchanges: fill hash for the avfilter_get_audio_buffer_ref_from_arrays addition lavfi: avfilter_merge_formats: handle case where inputs are same lavfi: use avfilter_get_audio_buffer_ref_from_arrays() in defaults.c lavfi: implement avfilter_get_audio_buffer_ref_from_arrays() APIchanges: remove duplicated entry APIchanges: fill in dates and numbers APIchanges: remove duplicated entry APIchanges: correctly interleave entries APIchanges: add entry for av_force_cpu_flags() addition lavf: bump minor after the addition of fps_probe_size to AVFormatContext lavc: bump minor after the addition of AVCodecContext.request_sample_fmt movenc: Add RTP muxer/hinter options movenc: Pass the RTP AVFormatContext to the SDP generation rtspenc: Add RTP muxer options rtspenc: Add an AVClass for setting muxer specific options rtpenc_chain: Pass the rtpflags options through to the chained muxer rtpenc: Declare the rtp flags private AVOptions in rtpenc.h sdp: Reindent after the previous commit rtpenc: MP4A-LATM payload support avoptions: Add an av_opt_flag_is_set function for inspecting flag fields sdp: Allow passing an AVFormatContext to the SDP generation mov: Fix wrong timestamp generation for fragmented movies that have time offset caused by the first edit list entry. mpeg12: more advanced ffmpeg mpeg2 aspect guessing code. ac3: there was no libav in 2010 thus this code cannot be from libav. swscale: split YUYV output out of yuv2packed[12X]_c(). dict: This code was developed in ffmpeg and not libav, nor by libav developers. Correct copyright notices. lavf: make compute_pkt_fields2() return meaningful error values matroskadec: set timestamps for RealAudio packets. intelh263dec: aspect ratio processing fix. intelh263dec: fix "Strict H.263 compliance" file playback oss,sndio: simplify by using FFMIN. swscale: extract monowhite/black output from yuv2packed[12X]_c(). swscale: de-macro'ify RGB15/16/32 input functions. swscale: rearrange code. movdec: Add support for the 'wfex' atom. ffmpeg.c: Add a necessary const qualifier riff: Fix potential memleak. swscale: change 48bit RGB input macros to inline functions. swscale: change 9/10bit YUV input macros to inline functions. swscale: extract gray16 output functions from yuv2packed[12X](). swscale: use standard clipping functions. swscale: merge macros that are used only once. swscale: fix function declarations in swscale.c. swscale: fix function declaration keywords in x86/swscale_template.c. jpegdec: actually search for and parse RSTn crypto: Use av_freep instead of av_free Revert "crypto: fix potential double free" Revert "build: remove empty $(OBJS) target" crypto: Use av_freep instead of av_free aac: fix adts frame size mask, fix demuxer probing for some files. lavf: don't try to free private options if priv_data is NULL. lavfi: handle NULL lists in avfilter_make_format_list swscale: fix types of assembly arguments. swscale: move two macros that are only used once into caller. swscale: remove unused function. Fix "mixed declarations and code" warnings. options: Add missing braces around struct initializer. mov: Remove leftover crufty debug statement with references to a local file. dvbsubdec: Fix compilation of debug code. Remove all uses of now deprecated metadata functions. Move metadata API from lavf to lavu. crypto: fix potential double free libx264: fix double free ffplay: remove -debug option ffplay: remove -vismv option mpegvideo: use av_get_picture_type_char() in ff_print_debug_info() Remove some non-compiling debug messages. ffplay: Fix non-compiling debug printf and replace it by av_dlog. H264: x86 predict init cosmetics. ac3enc: Fix linking of AC-3 encoder without the E-AC-3 encoder. Move E-AC-3 encoder functions to a separate eac3enc.c file. ac3enc: remove convenience macro, #define DEBUG ac3enc: remove unused #define vc1: re-initialize tables after width/height change. APIchanges: fill-in git commit hash for av_get_bytes_per_sample() addition samplefmt: add av_get_bytes_per_sample() libvpxenc: add forgotten AVClass. iirfilter: fix biquad filter coefficients. swscale: remove duplicate conversion routine in swScale(). swscale: add yuv2planar/packed function typedefs. swscale: integrate yuv2nv12X_C into yuv2yuvX() function pointers. swscale: reindent x86 init code. swscale: extract SWS_FULL_CHR_H_INT conditional into init code. swscale: cosmetics. swscale: remove alp/chr/lumSrcOffset. swscale: un-special-case yuv2yuvX16_c(). shorten: Remove stray DEBUG #define and corresponding av_dlog statement. vorbisdec: Restore mistakenly removed debug output. v4l2: set default standard to NULL sws: make dither_scale const configure: Document --enable-vdpau. Replace some av_log/printf + #ifdef combinations by av_dlog. Replace some nonstandard DEBUG_* preprocessor directives by plain DEBUG. svq1dec: Fix debug statements that referenced non-existing context. Replace some printf instances in debug code by av_log. showfiltfmts: use av_get_pix_fmt_name() inverse.c: Replace unnecessary intmath.h header by necessary stdint.h. Drop unnecessary directory prefixes from #include directives. Makefile: critical build fix after the merge. make fate passed locally due to ffmpeg/ffmpeg_g being there from before ffplay: Fix -vismv mem: Trying to workaround posix_memalign() bug on OSX build: remove empty $(OBJS) target build: make rule for linking ff* apply only to these targets eval: add support for pow() function build: rearrange some lines in a more logical way s302m: fix resampling for 16 and 24bits. ARM: remove MUL64 and MAC64 inline asm build: clean up .PHONY lists build: move all (un)install* target aliases to toplevel Makefile flvenc: propagate error properly build: remove stale dependency build: do not add CFLAGS-yes to CFLAGS utils.c: fix crash with threading enabled. configure: simplify source_path setup configure: remove --source-path option pixdesc: remove duplicated header inclusion lavfi: use av_samples_alloc() in avfilter_default_get_audio_buffer() lavfi: prefer nb_samples over size in AVFilterBufferRefAudioProps samplefmt: switch nb_channels/nb_samples params order in av_samples_alloc() samplefmt: change layout for arrays created by av_samples_alloc() and _fill_arrays() lavf: deprecate AVFormatParameters.time_base. img2: add framerate private option. img2: add video_size private option. img2: add pixel_format private option. tty: add framerate private option. Move code for "ffmpeg: fix massive leak occurring when seeking" / e4841a404bdabfeafb917454d510b60d888cb761 elsewhere lavf: remove reference to output-example in Makefile vsrc_buffer: add flags param to av_vsrc_buffer_add_video_buffer_ref Remove some unused scripts from tools/. Add x86 assembly for some 10-bit H.264 intra predict functions. v4l2: do not force NTSC as standard Add const to avfilter_get_video_buffer_ref_from_arrays arguments. Skip tableprint.h during 'make checkheaders'. Remove unnecessary LIBAVFORMAT_BUILD #ifdef. Drop explicit filenames from @file Doxygen tags. Skip generated table headers during 'make checkheaders'. lavf,lavc: free avoptions in a generic way. AVOptions: add av_opt_free convenience function. sdl: align option fields after last commit ffmpeg: fix massive leak occurring when seeking ffprobe: implement -i FILE option tableprint: Restore mistakenly deleted common.h #include for FF_ARRAY_ELEMS. ffplay.texi: document -i FILE option cmdutils: remove unnecessary OPT_DUMMY implementation cmdutils: change the signature of the function argument in parse_options() sdl: use the filename for defining the window title, if not specified tiff: print log in case of unknown / unsupported tag. tiff: fix linesize for mono-white/black formats. Fix build of eval-test program configure: Document --enable-vaapi swscale: override the lack of the accurate rounding flag when needed for dither. swscale: factor should_dither out ac3enc: extract all exponents for the frame at once ARM: remove MULL inline asm mathops: use MUL64 macro where it forms part of other ops tty: factorise returning error codes. rawdec: add framerate private option. x11grab: add framerate private option. fbdev,v4l2: remove some forgotten uses of AVFormatParameters.time_base. bktr: don't error when AVFormatParameters.time_base isn't set. cmdutils: add missing const qualifier Skip headers not designed to work standalone during 'make checkheaders'. Add missing #includes to make headers self-contained. musepack: remove unnecessary #include from mpcdata.h musepack: remove extraneous mpcdata.h inclusions Fix error check in av_file_map() udp: support old, crappy non pthread mode ffmpeg: use opt_acodec when setting audio codec in opt_target. ffmpeg: fix segfault with too many output files ffplay: error out with invalid sample rate or channels. oggdec: fix Ticket185 build: simplify commands for clean target j2kdec: dont fail on non zero cblock style. makefile: fix j2k encoder dependancies udp: fix indention swscale: split swscale.c in unscaled and generic conversion routines. swscale: cosmetics. swscale: integrate (literally) swscale_template.c in swscale.c. swscale: split out x86/swscale_template.c from swscale.c. swscale: enable hScale_altivec_real. swscale: split out ppc _template.c files from main swscale.c. swscale: remove indirections in ppc/swscale_template.c. swscale: split out unscaled altivec YUV converters in their own file. mpegvideoenc: fix multislice fate tests with threading disabled. cmdutils: move "#undef main" from ffplay.c to cmdutils.h wav: update size check for ds64 wav: fix skip size at end of ds64 chunk mpegts: Wrap #ifdef DEBUG and av_hex_dump_log() combination in a macro. build: Simplify texi2html invocation through the --output option. Mark some variables with av_unused Replace avcodec_get_pix_fmt_name() by av_get_pix_fmt_name(). svq3: Check negative mb_type to fix potential crash. svq3: Move svq3-specific fields to their own context. rawdec: initialize return value to 0. Remove unused get_psnr() prototype rawdec: don't leak option strings. bktr: get default framerate from video standard. swscale: remove unused COMPILE_TEMPLATE_ALTIVEC. h264 fill_filter_caches: Dont init chroma nnz_cache. In print_report, print progression time in hours:mins:secs:us ffmpeg: In print_report, use int64_t for pts to check for 0 and avoid inf value for bitrate. In libswscale, use all lines when converting from 422p to rgb with mmx, improve quality. Replace custom DEBUG preprocessor trickery by the standard one. vorbis: Remove non-compiling debug statement. vorbis: Remove pointless DEBUG #ifdef around debug output macros. cook: Remove non-compiling debug output. Remove pointless #ifdefs around function declarations in a header. Replace #ifdef + av_log() combinations by av_dlog(). Replace custom debug output functions by av_dlog(). cook: Remove unused debug functions. lavfi: add avfilter_link_free() function swscale: reintroduce sws_format_name() symbol Remove stray extra arguments from av_dlog() invocations. targa: fix big-endian build v4l2: remove one forgotten use of AVFormatParameters.pix_fmt. vfwcap: add a framerate private option. v4l2: add a framerate private option. libdc1394: add a framerate private option. fbdev: add a framerate private option. bktr: add a framerate private option. oma: check avio_read() return value nutdec: remove unused variable Remove unused variables swscale: dither for planar yuv outputs swscale: Fix use of uninitialized values (bug probably introduced from a marge of libav) cpudetect: add av_force_cpu_flags() swscale: allocate larger buffer to handle altivec overreads. H264/MPEG frame-level multi-threading. vsrc_buffer: propagate error code in av_vsrc_buffer_add_frame() lavfi: reindent after the previous commit lavfi: add braces around the block of an if() expression in avfilter_default_get_video_buffer lavfi: clarify the context of a comment in avfilter_default_get_video_buffer() lavfi: apply misc style fixes Cosmetic changes to h264_idct_10bit.asm. 2x faster h264_idct_add8_10. aacenc: Add stereo_mode option. h264: remove CONFIG_GPL from x86 intra prediction code. doc: cosmetics: libx264 typos postprocess: Remove test for impossible condition (was: Re: postprocess.c: replace check for p==NULL with *p==0) Fix various uninitialized variable warnings Port remove of get_sws_cpuflags from MPlayer's libmpcodecs. Replace "vector const" by "const vector" otherwise gcc 4.6.0 fails. Port recent changes to MPlayer libmpcodecs. Replace non-existent HAVE_SSE2 with HAVE_SSE. Simplify code and avoid compiler warning about incompatible types. Fix type of out[] variable, it should not be const. ARM: ac3dsp: optimised update_bap_counts() mpegaudiodec: Fix av_dlog() invocation. swscale: fix compilation of bfin due to missing pixdesc.h header lavf: tag dump_format() as @deprecated yuv4mpeg: complain and exit if a non-rawvideo stream is selected ffmpeg: handle copy of packets for AVFMT_RAWPICTURE output formats doc/examples: give meaningful names to the example files h264/10bit: add HAVE_ALIGNED_STACK checks. swscale: More accurate rounding in YSCALE_YUV_2_PACKEDX_FULL_C() Update 8-bit H.264 IDCT function names to reflect bit-depth. Add IDCT functions for 10-bit H.264. mpegaudioenc: Fix broken av_dlog statement. Employ correct printf format specifiers, mostly in debug output. ARM: fix MUL64 inline asm for pre-armv6 doc: add libvpx encoder section vf_drawtext: Replace FFmpeg by Libav in license boilerplate. mpegaudiodec: remove unusued code and variables postprocess.c: filter name needs to be double 0 terminated improved 'edts' atom writing support mpegaudio: clean up compute_antialias() definition vp8: fix segmentation race during frame-threading. Port libmpcodec fixes from MPlayer. Merge remote-tracking branch 'ffmpeg-mt/master' swscale: Remove unused variable. ARM: simplify inline asm with 64-bit operands Add "const" to avoid "initialization discards qualifiers" warning. Add const to fix "cast discards qualifiers" warnings. Include pixdesc.h for av_get_pix_fmt_name. wav: Don't avio_seek() if we know we'll run into EOF api-example: uppercase first letter in "copyright" output-example: create @file doxy from text in the copyright header examples: move API examples to a dedicated dir in doc ffmpeg: simplify opt_*_codec() options v4l2: rewrite code iterating the supported standards v4l2: perform minor style fixes v4l2: replace memset() with explicit struct initialization rawdec: fail in case of unknow pixel format swscale: remove sws_format_name() error.c: fix compile flags TCP: change default timeout to 5sec Revert "Timeout TCP open() after 5 seconds." Fix various unused variable warnings Fix various bad printf format warnings ARM: enable UAL syntax in asm.S Remove now unused nb_istreams variable. Add const to vector types for input in altivec code. Remove unused variable, avoiding compiler warning. Cast pointers to uintptr_t rather than unsigned int. v4l2: don't leak video standard string on error. swscale: Remove disabled code. avfilter: Surround function only used in debug mode by appropriate #ifdef. vf_crop: Replace #ifdef DEBUG + av_log() by av_dlog(). build: remove BUILD_ROOT variable vp8: use av_clip_uintp2() where possible swscale: Commits that could not be pulled earlier due to bugs #2 Commits that could not be pulled earlier due to bugs. Revert 1a5e4fd8c5b99478b4e08a69261930bb12aa948b for postproc. This broke the code doc: correct AC-3 option subsection placement ac3enc: fix LOCAL_ALIGNED usage in count_mantissa_bits() ac3dsp: do not use the ff_* prefix when referencing ff_ac3_bap_bits. swscale: use av_clip_uint8() in yuv2yuv1_c(). swscale: replace formatConvBuffer[VOF] by allocated array. v4l2: create file @doxy from text in the copyright header v4l2: remove pointless empty lines v4l2: set default standard to NULL v4l2: use OFFSET macro when setting options ac3dsp: fix loop condition in ac3_update_bap_counts_c() ARM: unbreak build lavdev: add SDL output device ac3enc: modify mantissa bit counting to keep bap counts for all values of bap instead of just 0 to 4. ac3enc: split mantissa bit counting into a separate function. ac3enc: store per-block/channel bap pointers by reference block in a 2D array rather than in the AC3Block struct. lavu: add av_get_pix_fmt_name() convenience function iff: remove duplicated file description cmdutils: remove OPT_FUNC2 get_bits: add av_unused tag to cache variable sws: replace all long with int. ARM: aacdec: fix constraints on inline asm ARM: remove unnecessary volatile from inline asm ARM: add "cc" clobbers to inline asm where needed ARM: improve FASTDIV asm ac3enc: use LOCAL_ALIGNED macro APIchanges: fill in git hash for av_get_pix_fmt_name (0420bd7). lavu: add av_get_pix_fmt_name() convenience function cmdutils: remove OPT_FUNC2 swscale: fix crash in bilinear scaling. vpxenc: add VP8E_SET_STATIC_THRESHOLD mapping webm: support stereo videos in matroska/webm muxer rgb2rgb: remove duplicate mmx/mmx2/3dnow/sse2 functions. swscale: reindent h[cy]scale_fast() and updateDitherTables(). swscale: reformat x86/swscale_template.c. swscale: remove duplicate mmx/mmx2 functions if they are identical. swscale: remove if (c->dstFormat) branch from yuv2packed[12X](). swscale: remove if(full_chr_int) from yuv2packed1(). swscale: remove if(accurate_rnd) branch from functions. swscale: revive SWS_CPU_CAPS until next major bump. swscale: Remove commented-out printf cruft. Export PCR pid Export more transport stream information. Output MPEG-TS stream identifiers. lavf: deprecate AVFormatParameters.pix_fmt. rawdec: add a pixel_format private option. v4l2: add a pixel_format private option. libdc1394: add a pixel_format private option. cosmetics: indentation and alignment after previous commit ac3enc: add support for E-AC-3 encoding. ac3enc: Move AC-3 AVOptions array to a separate file to make it easier to use only selected options for the different AC-3 encoder types. ARM: disable ff_vector_fmul_vfp on VFPv3 systems ARM: check for VFPv3 swscale: Remove unused variables in x86 code. doc: Drop DJGPP section, Libav now compiles out-of-the-box on FreeDOS. x86: Add appropriate ifdefs around certain AVX functions. cmdutils: use sws_freeContext() instead of av_freep(). swscale: delay allocation of formatConvBuffer(). swscale: fix build with --disable-swscale-alpha. movenc: Deprecate the global RTP hinting flag, use a private AVOption instead movenc: Add an AVClass for setting muxer specific options libdc1394: choose best video mode and rate based on camera capabilities. Remove support for libdc1394 < 2.0. avopt: fix segfault swscale: fix non-bitexact yuv2yuv[X2]() MMX/MMX2 functions. swscale: dont loose precission on RGB/BGR48 input, that is dont drop half the bits. patch checklist: suggest --disable-yasm test. lavdev: prefer the inclusion of avdevice.h over that of libavformat/avformat.h lavdev: include libavformat/avformat.h in avdevice.h fate.txt: replace FATE rsync command with a make command configure: report yasm/nasm presence properly tcp: make connect() timeout properly rawdec: factor video demuxer definitions into a macro. rtspdec: add initial_pause private option. lavf: deprecate AVFormatParameters.width/height. tty: add video_size private option. rawdec: add video_size private option. x11grab: add video_size private option. x11grab: factorize returning error codes. vfwcap: add video_size private option. v4l2: add video_size private option. v4l2: factorize returning error codes. libdc1394: add video_size private option. libdc1394: return meaninful error codes. bktr: add video_size private option. bktr: factorize returning error codes. Fix memleak Fix typo Remove specific note when not specific Minor cleanup in libx264.c Add metadata conversion table to the wav demuxer Fix 32bit rawvideo in avi on big-endian. id3v2: Check malloc result. ID3v2 tags can be very large. id3v2: Initialize tflags for version 2.2. webm: Additional options/presets for VP8 encodes under FFmpeg muxers: Add a flag to mark muxers that allow (non strict) monotone timestamps. swscale: Do not loose precission on yuv values after rgb->yuv. libx264: support aspect Ratio Switch ARM: add ARMv6 optimised av_clip_uintp2 ARM: remove volatile from asm statements in libavutil/intmath ARM: fix av_clipl_int32_arm() v4l: include avdevice.h ffserver: move close_connection() call to avoid a temporary string and copy. lavf: initialize demuxer private options. AVOptions: set string default values. Fix compilation with YASM/NASM versions not supporting AVX. lavdevice: mark v4l for removal on next major bump. swscale: fix compile on ppc. swscale: fix compile on x86-32. build: Remove generated .version file on distclean. configure: Add -D_GNU_SOURCE to CPPFLAGS on OS/2. doc: Drop hint at --enable-memalign-hack for MinGW, it is now autodetected. ffplay: Remove disabled code. Mark parameterless function declarations as 'void'. swscale: use av_clip_uint8() in yuv2yuv1_c(). swscale: remove VOF/VOFW. swscale: split chroma buffers into separate U/V planes. swscale: replace formatConvBuffer[VOF] by allocated array. rgb2rgb: remove duplicate mmx/mmx2/3dnow/sse2 functions. swscale: reindent h[cy]scale_fast() and updateDitherTables(). swscale: reformat x86/swscale_template.c. swscale: remove duplicate mmx/mmx2 functions if they are identical. swscale: remove if (c->dstFormat) branch from yuv2packed[12X](). swscale: remove if(full_chr_int) from yuv2packed1(). swscale: remove if(accurate_rnd) branch from functions. ffserver: Fix a null pointer dereference as a result of the FF_API_MAX_STREAMS cleanup. libdc1394: fix compilation. swscale: revive SWS_CPU_CAPS until next major bump. swscale: Remove commented-out printf cruft. ac3enc: initialize all coefficients to zero. ffv1: fix 16bits multithreading doc: create separate section for audio encoders swscale: Remove orphaned, commented-out function declaration. swscale: Eliminate rgb24toyv12_c() duplication. mpegvideo_enc: use AV_LOG_ERROR instead of AV_LOG_INFO for two error messages Fail when lowres value is lower than 0 Remove h263_msmpeg4 from MpegEncContext. APIchanges: Fill in git hash for fps_probe_size (30315a8) avformat: Add fpsprobesize as an AVOption. swscale: document SWS_CPU_CAPS* Revert removial of SWS flags from e66149e714006d099d1ebfcca3f22ca74fc7dcf4 avoptions: Return explicitly NAN or {0,0} if the option isn't found rtmp: Reindent rtmp: Don't try to do av_malloc(0) swscale: remove duplicatiopn of rgb24toyv12_c() Return -1 on invalid input instead of crashing. vf_mp: fix name of the remove-logo filter referenced in filters.texi tty: replace AVFormatParameters.sample_rate abuse with a private option. Fix end time of last chapter in compute_chapters_end ffmpeg: get rid of useless AVInputStream.nb_streams. ffmpeg: simplify managing input files and streams ffmpeg: purge redundant AVInputStream.index. lavf: deprecate AVFormatParameters.channel. libdc1394: add a private option for channel. dv1394: add a private option for channel. v4l2: reindent. v4l2: add a private option for channel. lavf: deprecate AVFormatParameters.standard. v4l2: add a private option for video standard. v4l: add a private option for video standard. dv1394: add a private option for video standard. bktr: add a private option for video standard. lavf: deprecate AVFormatParameters.{channels,sample_rate}. rawdec: add sample_rate/channels private options. ALSA: add channels and sample_rate private options. oss: add channels and sample_rate private options. sndio: add channels and sample_rate private options. lavf: deprecate AVFormatParameters.mpeg2ts_raw. mpegts: add compute_pcr option. lavf: add priv_class field to AVInputFormat. lavfi: add select filter eval: implement not() expression vsrc_buffer: return an error code if no frames are available ffmpeg: handle the case when get_filtered_frame() fails indeo3: add out-of-buffer write check Add reading of disc number to mov.c Fix end time of last chapter in compute_chapters_end(). Do not reset channel_layout to 0. vsrc_buffer: remove duplicated file description Merge swscale bloatup This will be cleaned up in the next merge swscale: MMX optim of hscale16() swscale: dont loose bits on planar >8bit yuv ind gray nput. swscale: Switch to ronalds yuv2yuvX16inC_template() its very similar to baptsites and supports alpha configure: enable memalign_hack automatically when needed rawdec: fix decoding of QT WRAW files matroska: improve declaration of video_stereo_* constant tables matroskadec: fix reverted condition to accept combine_plane operation Fix register types for LOAD_AB arguments, fixes compilation with NASM. swscale: unbreak the build on non-x86 systems. swscale: remove if(bitexact) branch from functions. swscale: remove if(canMMX2BeUsed) conditional. swscale: remove swScale_{c,MMX,MMX2} duplication. swscale: use emms_c(). Move emms_c() from libavcodec to libavutil. tiff: set palette in the context when specified in TIFF_PAL tag rtsp: use strtoul to parse rtptime and seq values. pgssubdec: fix incorrect colors. dvdsubdec: fix incorrect colors. ape: Allow demuxing of files with metadata tags. swscale: remove dead macro WRITEBGR24OLD. swscale: remove AMD3DNOW "optimizations". swscale: remove duplicate code in ppc/ subdirectory. swscale: remove duplicated x86/ functions. swscale: force --enable-runtime-cpudetect and remove SWS_CPU_CAPS_*. vsrc_buffer.h: add file doxy vsrc_buffer: tweak error message in init() wav: fix various printf warnings related to wrong argument type wav: propagate ff_get_wav_header() error code in w64_read_header() msmpeg4: reindent. lavc: remove msmpeg4v1 encoder. Remove avconfig.h and INCINSTDIRs on uninstall. ac3enc: add channel coupling support partial revert of 01d3ebaf219d83c0a70cdf9696ecb6b868e8a165 fate: reenable frext-pph10i4_panasonic_a after the bitstream has been fixed avcodec_find_decoder: prefer non experimental decoders. j2kdec: mark as CODEC_CAP_EXPERIMENTAL j2k[c/h] j2kdec.c: Implement 2 code block styles j2k: Add void as the parameter of function ff_j2k_init_tier1_luts Add Kamil Nowosads j2k code. matroska: cleanup handling of video stereo mode oggdec: use av_dlog() mem: define the MAX_MALLOC_SIZE constant and use it in place of INT_MAX configure: Add -U__STRICT_ANSI__ to CPPFLAGS on Cygwin and DOS. muxers.texi changes for mkv/webm options aacdec: fix typo in scalefactor clipping check mpegaudio: Correct license header add 5.1 to stereo downmix to resample.c this is based on previous 6to2channel-resample.patch from ffmpeg2theora but updated to work with trunk and using av_clip_int16. fate: fix fate-h264-conformance-frext-pph10i4-panasonic-a crcs. fate: update 9/10bit refs. h264: Properly set coded_{width, height} when parsing H.264. x86 asm: Add SECTION_TEXT to dct32_sse.asm. Fix 9/10 bit in swscale. Do not ask for samples if a specific channel layout was requested. libx264: specify field for default union values in options movdec: dont divide by zero when stts_data[0].duration = 0. Fix ticket127 dct32: Replacing libav by ffmpeg in the license header with the authors permission. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> ffmpeg: Don't trigger url_interrupt_cb on the first signal avoptions: Check the return value from av_get_number lavf: fix style for avformat_alloc_output_context2() lavf: deprecate avformat_alloc_output_context() in favor of avformat_alloc_output_context2() lavfi: make vsrc_buffer.h header public dct32_sse: eliminate some spills Fix compilation with --disable-yasm. Fix dct32() compilation with --disable-yasm mpeg2dec: Fix lowres 3 lavfi: bump minor and add changelog entry after the split filter addition vf_split: add documentation to filters.texi vf_split: give more meaningful names to the output pads vf_split: define draw_slice() before end_frame() vf_split: add description vf_split: fix various nits wmadec: avoid infinit loop. DirectShow capture: Fix build ffmpeg: get rid of the -vglobal option. dct32: Add AVX implementation of 32-point DCT dct32: Change pass 6 permutation to allow for AVX implementation dct32: port SSE 32-point DCT to YASM matroska: switch stereo mode from int to string and add support in the demuxer too matroska: cosmetics Create a stereo_mode metadata tag to specify the stereo 3d video layout using the StereoMode tag in a matroska/webm video track. libavfilter: vf_split from soc. DirectShow capture support Signed-off-by: Michael Niedermayer <michaelni@gmx.at> multiple inclusion guard cleanup avio: document buffer must created with av_malloc() and friends avio: check AVIOContext malloc failure swscale: point out an alternative to sws_getContext svq3: Do initialization after parsing the extradata Fix channel_layout documentation. add changelog entries for 0.7_beta2 ffserver: dont just crash fix ffserver's SIGSEGV avoptions: Support getting flag values using av_get_int preset dir for win32 Merge remote-tracking branch 'ffmpeg-mt/master' Add a flag to disable side data merging. Merge/split side data. Encoding alac with more than two channels is not supported. mp3lame: add #include required for AV_RB32 macro. configure: make executable again LATM/AAC: Free previously initialized context on reinit. configure: Do not unconditionally add -Wall to host CFLAGS. configure: Set OS/2 objformat to a.out. Add support for a.out object format to assembler macros. fate: disable threading for encoding fate: add comment field fate: allow overriding default build and install dirs mpegtsenc: Add an AVClass pointer to the private data mpegaudio: clean up #includes mpegaudio: move all header parsing to mpegaudiodecheader.[ch] vf_libopencv: prefer opencv/cxcore.h over cxtypes.h decoders.texi: fix typos in rawvideo section cmdutils: use const AVClass * when senseful encoders.texi: add documentation for the libx264 encoder decoders.texi: add documentation for rawvideo decoder and options doc: add decoders.texi file encoders.texi: decrease level for audio encoders section ffprobe.texi: remove inclusion of muxers section indeo3: release buffer in indeo3_decode_end() indeo3: remove unnecessary includes indeo3: add @file doxy and a link to multimedia wiki documentation cmdutils: reset *picref_ptr to NULL in get_filtered_frame() ffmpeg: remove useless NULL-check on avfilter_unref_buffer libmp3lame: include "libavutil/intreadwrite.h" header qdm2: Use floating point synthesis filter. h264: correct border check. h264: fix loopfilter with threading at slice boundaries. Fix ff_mpa_synth_filter_fixed() prototype Reindent rtpenc_chain: Pass the MP4A_LATM flag to chained muxers rtpenc: MP4A-LATM payload support movenc: Pass AVFormatContext flags to the SDP generation sdp: Allow passing AVFormatContext flags to the SDP generation vsrc_buffer: document av_vsrc_buffer_add_video_buffer_ref() vsrc_buffer: add av_vsrc_buffer_add_frame() vsrc_buffer: fix example in docs, add mandatory parameters vsrc_buffer: make the source accept sws_param in init vsrc_buffer: propagate avfilter_open() error code vsrc_buffer: fix style lavfi: add avfilter_get_video_buffer_ref_from_frame to avcodec.h vsrc_buffer: remove dependency on AVFrame Rename costablegen.c ---> cos_tablegen.c. Collapse tableprint.c into tableprint.h. Simplify trig table rules Remove potentially unstable filenames from comments in generated files. Ignore generated tables and generated table generator programs. Simplify CLEANFILES make variable by using wildcards. Remove silly insults from avformat_version() Doxygen documentation. mpegaudiodsp: fix x86 and ppc makefiles configure: Adjust AVX assembler check. mpegaudio: remove unused version of SAME_HEADER_MASK mpegaudio: remove useless #undef at end of file asfdec: add missing #include for av_bswap32() mpegaudio: merge two #if CONFIG_FLOAT blocks mpegaudio: move some struct definitions from mpegaudio.h Move some mpegaudio functions to new mpegaudiodsp subsystem Clean up #includes in cmdutils.h. g729: Merge g729.h into g729dec.c. av_find_stream_info: Print more details about max anaylize duration failures. 10l: wrap float_interleave functions in HAVE_YASM. Add little description for -rc_override APIchanges: fill in date and commit for request_sample_fmt Add floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders. Add support for request_sample_format in ffmpeg and ffplay. Add APIchanges entry for request_sample_fmt. Add request_sample_fmt field to AVCodecContext. Add float_interleave() to FmtConvertContext with x86-optimized versions. Remove unused make variable SEEK_REFFILE fate: remove redundant aref and vref references Parse 'bext' metadata in the wav demuxer Cosmetics: indent Keep parsing wav until EOF if the input is seekable and we know the size of the data tag Refactor the tag checking into a switch statement Use avio_tell() instead of url_ftell() add x264opts entry to docs cleaned up the udp.c, removed some variables and an av_log configure: favor pkg_config over sdl_config libx264: support passing arbitrary parameters. ffmpeg: dont show_banner() on verbose<0 fate: remove do_ffmpeg_nocheck function fate: do not collect -benchmark output mpegaudiodec: remove decode_end() function fate: run aref and vref as regular tests mpegaudio: sanitise compute_antialias_* names mpeg12: add slice-threading checks to slice-threading initializers. h264: copy pixel_shift between slice threading contexts. mdec: enable frame-level multithreading. mdec.c: fix overread. id3v2: prevent unsigned integer overflow in ff_id3v2_parse() id3v2: add @file doxy and link to format documentation configure: opensolaris install is not compatible with ffmpeg, allow overriding it. Fix compilation of iirfilter-test. eval: opensolaris strtod() cannot handle 0x1234 libx264: handle closed GOP codec flag lavf: remove duplicate assignment in avformat_alloc_context. lavf: use designated initializers for AVClasses. Make sure neither data_size nor sample_count is negative Refactor the 'fmt ' tag search and parsing flvdec: clenup debug code asfdec: fix possible overread on broken files. asfdec: do not fall back to binary/generic search asfdec: reindent after previous commit c7bd5ed asfdec: fallback to binary search internally mpegaudio: add _fixed suffix to some names Modify x86util.asm to ease transitioning to 10-bit H.264 assembly. ffmpeg: reset top_field_first in opt_input_file(). dct: build dct32 as separate object files qdm2: include correct header for rdft Ogg demuxer: give meaningful error codes and warnings. update changelog with 9/10 bit H264 and FFV1 changes Add some forgotten const to function arguments in libavfilter & libavformat. Write channel_layout for multichannel aif files. Fix ff_mov_write_chan() so it can be used by other muxers. Fix some mov files with little endian audio (tickets 201 - 203). iff/8svx: redesign 8SVX demuxing and decoding for handling stereo samples correctly iff: compact code setting metadata tags iff: fix bitrate computation for compressed audio stream iff: distinguish fields for audio and video compression imgutils: introduce internal image_get_linesize() and use it imgutils: make av_image_get_linesize() return AVERROR(EINVAL) for invalid pixel formats drawtext: specify union type for setting default options drawtext: reindent after the previous commit drawtext: fix strftime() text expansion ffmpeg: fix -aspect cli option Restructure video filter implementation in ffmpeg.c. ffplay: remove audio_write_get_buf_size() forward declaration lavfi: print key-frame and picture type information in ff_dlog_ref() mathops: remove ancient confusing comment rawdec: Allow overriding top field first. ffmpeg: initialize input_codec array earlier. cmdutils: Allocate private decoder context if its not allocated yet. cws2fws: Improve error message wording. tools: Check the return value of write(). mpegaudio: move OUT_FMT macro to mpegaudiodec.c mpegaudio: remove OUT_MIN/MAX macros Add missing #includes to mp3_header_(de)compress bsf dct: fix indentation dct: bypass table allocation for DCT_II of size 32 pngdec: relax condition for setting monoblack pixel format h264dsp_mmx: Add #ifdefs around some mmxext functions on x86_64. Remove unused header mpegaudio3.h. Support decoding of 1bpp rawvideo in avi (ticket 205). Support decoding of 2bpp rawvideo in avi (ticket 206). Bump minor after adding a caf muxer. configure: another try on fixing osx/mingw SDL aacdec: Use float instead of int16_t for ltp_state to avoid needless rounding. av_picture_crop(): Support simple cases with packed pixels too. acelp: Remove unused gray_decode table. dfa: Remove unused variable. configure: Include AVX availability in summary output. rawdec: propagate pict_type information to the output frame showinfo: replace "CRC" by "checksum" showinfo: fix vertical align nit showinfo: fix computation of Adler checksum imgutils: generalize linesize computation for bitstream formats configure: use same CPPFLAGS in kFreeBSD as Linux Conflicts: ffserver.c libavcodec/avcodec.h libavcodec/opt.h libavcodec/version.h libavdevice/avdevice.h libavfilter/avfilter.h libavformat/avformat.h libavformat/metadata.c libavformat/metadata.h libavformat/utils.c libavformat/version.h libavutil/avutil.h libavutil/mem.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
56629aa012
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,6 +16,9 @@ ffmpeg
|
||||
ffplay
|
||||
ffprobe
|
||||
ffserver
|
||||
libavcodec/*_tablegen
|
||||
libavcodec/*_tables.c
|
||||
libavcodec/*_tables.h
|
||||
libavcodec/libavcodec*
|
||||
libavcore/libavcore*
|
||||
libavdevice/libavdevice*
|
||||
|
14
Changelog
14
Changelog
@ -9,12 +9,26 @@ version <next>:
|
||||
- mpeg2 aspect ratio dection fixed
|
||||
- libxvid aspect pickiness fixed
|
||||
- Frame multithreaded decoding
|
||||
- E-AC-3 audio encoder
|
||||
- ac3enc: add channel coupling support
|
||||
- floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders.
|
||||
- H264/MPEG frame-level multi-threading
|
||||
- All av_metadata_* functions renamed to av_dict_* and moved to libavutil
|
||||
|
||||
|
||||
version 0.7_beta2:
|
||||
|
||||
- Lots of deprecated API cruft removed
|
||||
- fft and imdct optimizations for AVX (Sandy Bridge) processors
|
||||
- showinfo filter added
|
||||
- DPX image encoder
|
||||
- SMPTE 302M AES3 audio decoder
|
||||
- Apple Core Audio Format muxer
|
||||
- 9bit and 10bit H.264 decoding
|
||||
- 9bit and 10bit FFV1 encoding / decoding
|
||||
- split filter added
|
||||
- select filter added
|
||||
- sdl output device added
|
||||
|
||||
|
||||
version 0.7_beta1:
|
||||
|
68
Makefile
68
Makefile
@ -2,6 +2,11 @@ include config.mak
|
||||
|
||||
SRC_DIR = $(SRC_PATH_BARE)
|
||||
|
||||
vpath %.c $(SRC_DIR)
|
||||
vpath %.h $(SRC_DIR)
|
||||
vpath %.S $(SRC_DIR)
|
||||
vpath %.asm $(SRC_DIR)
|
||||
vpath %.v $(SRC_DIR)
|
||||
vpath %.texi $(SRC_PATH_BARE)
|
||||
|
||||
PROGS-$(CONFIG_FFMPEG) += ffmpeg
|
||||
@ -24,6 +29,8 @@ ALLPROGS = $(BASENAMES:%=%$(EXESUF))
|
||||
ALLPROGS_G = $(BASENAMES:%=%_g$(EXESUF))
|
||||
ALLMANPAGES = $(BASENAMES:%=%.1)
|
||||
|
||||
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
||||
|
||||
FFLIBS-$(CONFIG_AVDEVICE) += avdevice
|
||||
FFLIBS-$(CONFIG_AVFILTER) += avfilter
|
||||
FFLIBS-$(CONFIG_AVFORMAT) += avformat
|
||||
@ -43,15 +50,9 @@ FF_LDFLAGS := $(FFLDFLAGS)
|
||||
FF_EXTRALIBS := $(FFEXTRALIBS)
|
||||
FF_DEP_LIBS := $(DEP_LIBS)
|
||||
|
||||
ALL_TARGETS-$(CONFIG_DOC) += documentation
|
||||
all-$(CONFIG_DOC): documentation
|
||||
|
||||
ifdef PROGS
|
||||
INSTALL_TARGETS-yes += install-progs install-data
|
||||
INSTALL_TARGETS-$(CONFIG_DOC) += install-man
|
||||
endif
|
||||
INSTALL_PROGS_TARGETS-$(CONFIG_SHARED) = install-libs
|
||||
|
||||
all: $(FF_DEP_LIBS) $(PROGS) $(ALL_TARGETS-yes)
|
||||
all: $(FF_DEP_LIBS) $(PROGS)
|
||||
|
||||
$(PROGS): %$(EXESUF): %_g$(EXESUF)
|
||||
$(CP) $< $@
|
||||
@ -80,12 +81,15 @@ endef
|
||||
|
||||
$(foreach D,$(FFLIBS),$(eval $(call DOSUBDIR,lib$(D))))
|
||||
|
||||
ffplay.o: CFLAGS += $(SDL_CFLAGS)
|
||||
ffplay_g$(EXESUF): FF_EXTRALIBS += $(SDL_LIBS)
|
||||
ffserver_g$(EXESUF): FF_LDFLAGS += $(FFSERVERLDFLAGS)
|
||||
|
||||
%_g$(EXESUF): %.o cmdutils.o $(FF_DEP_LIBS)
|
||||
$(LD) $(FF_LDFLAGS) -o $@ $< cmdutils.o $(FF_EXTRALIBS)
|
||||
|
||||
alltools: $(TOOLS)
|
||||
|
||||
tools/%$(EXESUF): tools/%.o
|
||||
$(LD) $(FF_LDFLAGS) -o $@ $< $(FF_EXTRALIBS)
|
||||
|
||||
@ -95,8 +99,6 @@ tools/%.o: tools/%.c
|
||||
-include $(wildcard tools/*.d)
|
||||
-include $(wildcard tests/*.d)
|
||||
|
||||
ffplay.o: CFLAGS += $(SDL_CFLAGS)
|
||||
|
||||
VERSION_SH = $(SRC_PATH_BARE)/version.sh
|
||||
GIT_LOG = $(SRC_PATH_BARE)/.git/logs/HEAD
|
||||
|
||||
@ -110,8 +112,6 @@ version.h .version:
|
||||
# force version.sh to run whenever version might have changed
|
||||
-include .version
|
||||
|
||||
alltools: $(TOOLS)
|
||||
|
||||
DOCS = $(addprefix doc/, developer.html faq.html general.html libavfilter.html) $(HTMLPAGES) $(MANPAGES) $(PODPAGES)
|
||||
|
||||
documentation: $(DOCS)
|
||||
@ -123,7 +123,7 @@ TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)
|
||||
doc/%.html: TAG = HTML
|
||||
doc/%.html: doc/%.texi $(SRC_PATH_BARE)/doc/t2h.init
|
||||
$(Q)$(TEXIDEP)
|
||||
$(M)cd doc && texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init $(<:doc/%=%)
|
||||
$(M)texi2html -monolithic --init-file $(SRC_PATH_BARE)/doc/t2h.init --output $@ $<
|
||||
|
||||
doc/%.pod: TAG = POD
|
||||
doc/%.pod: doc/%.texi
|
||||
@ -134,9 +134,19 @@ doc/%.1: TAG = MAN
|
||||
doc/%.1: doc/%.pod
|
||||
$(M)pod2man --section=1 --center=" " --release=" " $< > $@
|
||||
|
||||
install: $(INSTALL_TARGETS-yes)
|
||||
ifdef PROGS
|
||||
install: install-progs install-data
|
||||
endif
|
||||
|
||||
install-progs: $(PROGS) $(INSTALL_PROGS_TARGETS-yes)
|
||||
install: install-libs install-headers
|
||||
|
||||
install-libs: install-libs-yes
|
||||
|
||||
install-progs-yes:
|
||||
install-progs-$(CONFIG_DOC): install-man
|
||||
install-progs-$(CONFIG_SHARED): install-libs
|
||||
|
||||
install-progs: install-progs-yes $(PROGS)
|
||||
$(Q)mkdir -p "$(BINDIR)"
|
||||
$(INSTALL) -c -m 755 $(PROGS) "$(BINDIR)"
|
||||
|
||||
@ -148,7 +158,7 @@ install-man: $(MANPAGES)
|
||||
$(Q)mkdir -p "$(MANDIR)/man1"
|
||||
$(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"
|
||||
|
||||
uninstall: uninstall-progs uninstall-data uninstall-man
|
||||
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall-man
|
||||
|
||||
uninstall-progs:
|
||||
$(RM) $(addprefix "$(BINDIR)/", $(ALLPROGS))
|
||||
@ -174,7 +184,7 @@ clean:: testclean
|
||||
|
||||
distclean::
|
||||
$(RM) $(DISTCLEANSUFFIXES)
|
||||
$(RM) version.h config.* libavutil/avconfig.h
|
||||
$(RM) config.* .version version.h libavutil/avconfig.h
|
||||
|
||||
config:
|
||||
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
|
||||
@ -186,25 +196,18 @@ check: test
|
||||
fulltest test: codectest lavftest lavfitest seektest
|
||||
|
||||
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
|
||||
SEEK_REFFILE = $(SRC_PATH)/tests/seek.regression.ref
|
||||
|
||||
codectest: fate-codec
|
||||
lavftest: fate-lavf
|
||||
lavfitest: fate-lavfi
|
||||
seektest: fate-seek
|
||||
|
||||
AREF = tests/data/acodec.ref.wav
|
||||
VREF = tests/data/vsynth1.ref.yuv
|
||||
AREF = fate-acodec-aref
|
||||
VREF = fate-vsynth1-vref fate-vsynth2-vref
|
||||
REFS = $(AREF) $(VREF)
|
||||
|
||||
$(REFS): TAG = GEN
|
||||
|
||||
$(VREF): ffmpeg$(EXESUF) tests/vsynth1/00.pgm tests/vsynth2/00.pgm
|
||||
$(M)$(SRC_PATH)/tests/codec-regression.sh vref vsynth1 tests/vsynth1 "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
$(Q)$(SRC_PATH)/tests/codec-regression.sh vref vsynth2 tests/vsynth2 "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
|
||||
$(AREF): ffmpeg$(EXESUF) tests/data/asynth1.sw
|
||||
$(M)$(SRC_PATH)/tests/codec-regression.sh aref acodec tests/acodec "$(TARGET_EXEC)" "$(TARGET_PATH)"
|
||||
|
||||
ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
|
||||
@echo
|
||||
@ -215,15 +218,15 @@ ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
|
||||
|
||||
tests/vsynth1/00.pgm: tests/videogen$(HOSTEXESUF)
|
||||
@mkdir -p tests/vsynth1
|
||||
$(M)$(BUILD_ROOT)/$< 'tests/vsynth1/'
|
||||
$(M)./$< 'tests/vsynth1/'
|
||||
|
||||
tests/vsynth2/00.pgm: tests/rotozoom$(HOSTEXESUF)
|
||||
@mkdir -p tests/vsynth2
|
||||
$(M)$(BUILD_ROOT)/$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
|
||||
$(M)./$< 'tests/vsynth2/' $(SRC_PATH)/tests/lena.pnm
|
||||
|
||||
tests/data/asynth1.sw: tests/audiogen$(HOSTEXESUF)
|
||||
@mkdir -p tests/data
|
||||
$(M)$(BUILD_ROOT)/$< $@
|
||||
$(M)./$< $@
|
||||
|
||||
tests/data/asynth1.sw tests/vsynth%/00.pgm: TAG = GEN
|
||||
|
||||
@ -258,8 +261,8 @@ FATE = $(FATE_ACODEC) \
|
||||
$(FATE_LAVFI) \
|
||||
$(FATE_SEEK) \
|
||||
|
||||
$(FATE_ACODEC): $(AREF)
|
||||
$(FATE_VCODEC): $(VREF)
|
||||
$(filter-out %-aref,$(FATE_ACODEC)): $(AREF)
|
||||
$(filter-out %-vref,$(FATE_VCODEC)): $(VREF)
|
||||
$(FATE_LAVF): $(REFS)
|
||||
$(FATE_LAVFI): $(REFS) tools/lavfi-showfiltfmts$(EXESUF)
|
||||
$(FATE_SEEK): fate-codec fate-lavf tests/seek_test$(EXESUF)
|
||||
@ -300,4 +303,5 @@ $(FATE): ffmpeg$(EXESUF) $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
|
||||
fate-list:
|
||||
@printf '%s\n' $(sort $(FATE))
|
||||
|
||||
.PHONY: documentation *test regtest-* alltools check config
|
||||
.PHONY: all alltools *clean check config documentation examples install*
|
||||
.PHONY: *test testprogs uninstall*
|
||||
|
53
cmdutils.c
53
cmdutils.c
@ -76,7 +76,8 @@ void uninit_opts(void)
|
||||
av_freep(&avformat_opts->key);
|
||||
av_freep(&avformat_opts);
|
||||
#if CONFIG_SWSCALE
|
||||
av_freep(&sws_opts);
|
||||
sws_freeContext(sws_opts);
|
||||
sws_opts = NULL;
|
||||
#endif
|
||||
for (i = 0; i < opt_name_count; i++) {
|
||||
av_freep(&opt_names[i]);
|
||||
@ -216,7 +217,7 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
|
||||
#endif /* WIN32 && !__MINGW32CE__ */
|
||||
|
||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||
void (* parse_arg_function)(const char*))
|
||||
int (* parse_arg_function)(const char *opt, const char *arg))
|
||||
{
|
||||
const char *opt, *arg;
|
||||
int optindex, handleoptions=1;
|
||||
@ -272,21 +273,19 @@ unknown_opt:
|
||||
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
|
||||
} else if (po->flags & OPT_FLOAT) {
|
||||
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
|
||||
} else if (po->flags & OPT_FUNC2) {
|
||||
if (po->u.func2_arg(opt, arg) < 0) {
|
||||
} else if (po->u.func_arg) {
|
||||
if (po->u.func_arg(opt, arg) < 0) {
|
||||
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg, opt);
|
||||
exit(1);
|
||||
}
|
||||
} else if (po->flags & OPT_DUMMY) {
|
||||
/* Do nothing for this option */
|
||||
} else {
|
||||
po->u.func_arg(arg);
|
||||
}
|
||||
if(po->flags & OPT_EXIT)
|
||||
exit(0);
|
||||
} else {
|
||||
if (parse_arg_function)
|
||||
parse_arg_function(opt);
|
||||
if (parse_arg_function) {
|
||||
if (parse_arg_function(NULL, opt) < 0)
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -301,7 +300,7 @@ int opt_default(const char *opt, const char *arg){
|
||||
AVInputFormat *iformat = NULL;
|
||||
|
||||
while ((p = av_codec_next(p))) {
|
||||
AVClass *c = p->priv_class;
|
||||
const AVClass *c = p->priv_class;
|
||||
if (c && av_find_opt(&c, opt, NULL, 0, 0))
|
||||
break;
|
||||
}
|
||||
@ -411,13 +410,25 @@ int opt_timelimit(const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void *alloc_priv_context(int size, const AVClass *class)
|
||||
{
|
||||
void *p = av_mallocz(size);
|
||||
if (p) {
|
||||
*(const AVClass **)p = class;
|
||||
av_opt_set_defaults(p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
|
||||
{
|
||||
int i;
|
||||
void *priv_ctx=NULL;
|
||||
if(!strcmp("AVCodecContext", (*(AVClass**)ctx)->class_name)){
|
||||
AVCodecContext *avctx= ctx;
|
||||
if(codec && codec->priv_class && avctx->priv_data){
|
||||
if(codec && codec->priv_class){
|
||||
if(!avctx->priv_data && codec->priv_data_size)
|
||||
avctx->priv_data= alloc_priv_context(codec->priv_data_size, codec->priv_class);
|
||||
priv_ctx= avctx->priv_data;
|
||||
}
|
||||
} else if (!strcmp("AVFormatContext", (*(AVClass**)ctx)->class_name)) {
|
||||
@ -837,6 +848,23 @@ FILE *get_preset_file(char *filename, size_t filename_size,
|
||||
av_strlcpy(filename, preset_name, filename_size);
|
||||
f = fopen(filename, "r");
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
char datadir[MAX_PATH], *ls;
|
||||
base[2] = NULL;
|
||||
|
||||
if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1))
|
||||
{
|
||||
for (ls = datadir; ls < datadir + strlen(datadir); ls++)
|
||||
if (*ls == '\\') *ls = '/';
|
||||
|
||||
if (ls = strrchr(datadir, '/'))
|
||||
{
|
||||
*ls = 0;
|
||||
strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir));
|
||||
base[2] = datadir;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
for (i = 0; i < 3 && !f; i++) {
|
||||
if (!base[i])
|
||||
continue;
|
||||
@ -897,6 +925,7 @@ int get_filtered_video_frame(AVFilterContext *ctx, AVFrame *frame,
|
||||
{
|
||||
int ret;
|
||||
AVFilterBufferRef *picref;
|
||||
*picref_ptr = NULL;
|
||||
|
||||
if ((ret = avfilter_request_frame(ctx->inputs[0])) < 0)
|
||||
return ret;
|
||||
|
29
cmdutils.h
29
cmdutils.h
@ -22,11 +22,17 @@
|
||||
#ifndef FFMPEG_CMDUTILS_H
|
||||
#define FFMPEG_CMDUTILS_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libswscale/swscale.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#undef main /* We don't want SDL to override our main() */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* program name, defined by the program for show_version().
|
||||
*/
|
||||
@ -119,17 +125,14 @@ typedef struct {
|
||||
#define OPT_INT 0x0080
|
||||
#define OPT_FLOAT 0x0100
|
||||
#define OPT_SUBTITLE 0x0200
|
||||
#define OPT_FUNC2 0x0400
|
||||
#define OPT_INT64 0x0800
|
||||
#define OPT_EXIT 0x1000
|
||||
#define OPT_DATA 0x2000
|
||||
#define OPT_DUMMY 0x4000
|
||||
#define OPT_INT64 0x0400
|
||||
#define OPT_EXIT 0x0800
|
||||
#define OPT_DATA 0x1000
|
||||
union {
|
||||
void (*func_arg)(const char *); //FIXME passing error code as int return would be nicer then exit() in the func
|
||||
int *int_arg;
|
||||
char **str_arg;
|
||||
float *float_arg;
|
||||
int (*func2_arg)(const char *, const char *);
|
||||
int (*func_arg)(const char *, const char *);
|
||||
int64_t *int64_arg;
|
||||
} u;
|
||||
const char *help;
|
||||
@ -147,7 +150,7 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
|
||||
* not have to be processed.
|
||||
*/
|
||||
void parse_options(int argc, char **argv, const OptionDef *options,
|
||||
void (* parse_arg_function)(const char*));
|
||||
int (* parse_arg_function)(const char *opt, const char *arg));
|
||||
|
||||
void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec);
|
||||
|
||||
@ -241,7 +244,8 @@ int read_file(const char *filename, char **bufptr, size_t *size);
|
||||
* If is_path is non-zero, look for the file in the path preset_name.
|
||||
* Otherwise search for a file named arg.ffpreset in the directories
|
||||
* $FFMPEG_DATADIR (if set), $HOME/.ffmpeg, and in the datadir defined
|
||||
* at configuration time, in that order. If no such file is found and
|
||||
* at configuration time or in a "ffpresets" folder along the executable
|
||||
* on win32, in that order. If no such file is found and
|
||||
* codec_name is defined, then search for a file named
|
||||
* codec_name-preset_name.ffpreset in the above-mentioned directories.
|
||||
*
|
||||
@ -255,9 +259,6 @@ int read_file(const char *filename, char **bufptr, size_t *size);
|
||||
FILE *get_preset_file(char *filename, size_t filename_size,
|
||||
const char *preset_name, int is_path, const char *codec_name);
|
||||
|
||||
#if CONFIG_AVFILTER
|
||||
#include "libavfilter/avfilter.h"
|
||||
|
||||
typedef struct {
|
||||
enum PixelFormat pix_fmt;
|
||||
} FFSinkContext;
|
||||
@ -273,6 +274,4 @@ extern AVFilter ffsink;
|
||||
int get_filtered_video_frame(AVFilterContext *sink, AVFrame *frame,
|
||||
AVFilterBufferRef **picref, AVRational *pts_tb);
|
||||
|
||||
#endif /* CONFIG_AVFILTER */
|
||||
|
||||
#endif /* FFMPEG_CMDUTILS_H */
|
||||
|
@ -10,4 +10,4 @@
|
||||
{ "protocols", OPT_EXIT, {(void*)show_protocols}, "show available protocols" },
|
||||
{ "filters", OPT_EXIT, {(void*)show_filters }, "show available filters" },
|
||||
{ "pix_fmts" , OPT_EXIT, {(void*)show_pix_fmts }, "show available pixel formats" },
|
||||
{ "loglevel", HAS_ARG | OPT_FUNC2, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
|
||||
{ "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
|
||||
|
29
common.mak
29
common.mak
@ -6,17 +6,6 @@
|
||||
all: all-yes
|
||||
|
||||
ifndef SUBDIR
|
||||
vpath %.c $(SRC_DIR)
|
||||
vpath %.h $(SRC_DIR)
|
||||
vpath %.S $(SRC_DIR)
|
||||
vpath %.asm $(SRC_DIR)
|
||||
vpath %.v $(SRC_DIR)
|
||||
|
||||
ifeq ($(SRC_DIR),$(SRC_PATH_BARE))
|
||||
BUILD_ROOT_REL = .
|
||||
else
|
||||
BUILD_ROOT_REL = ..
|
||||
endif
|
||||
|
||||
ifndef V
|
||||
Q = @
|
||||
@ -31,9 +20,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
|
||||
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
|
||||
endif
|
||||
|
||||
ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale
|
||||
|
||||
IFLAGS := -I$(BUILD_ROOT_REL) -I$(SRC_PATH)
|
||||
IFLAGS := -I. -I$(SRC_PATH)
|
||||
CPPFLAGS := $(IFLAGS) $(CPPFLAGS)
|
||||
CFLAGS += $(ECFLAGS)
|
||||
YASMFLAGS += $(IFLAGS) -Pconfig.asm
|
||||
@ -51,8 +38,6 @@ HOSTCFLAGS += $(IFLAGS)
|
||||
%.ho: %.h
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -Wno-unused -c -o $@ -x c $<
|
||||
|
||||
%$(EXESUF): %.c
|
||||
|
||||
%.ver: %.v
|
||||
$(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@
|
||||
|
||||
@ -62,13 +47,6 @@ HOSTCFLAGS += $(IFLAGS)
|
||||
%.h:
|
||||
@:
|
||||
|
||||
install: install-libs install-headers
|
||||
install-libs: install-libs-yes
|
||||
|
||||
uninstall: uninstall-libs uninstall-headers
|
||||
|
||||
.PHONY: all depend dep *clean install* uninstall* examples testprogs
|
||||
|
||||
# Disable suffix rules. Most of the builtin rules are suffix rules,
|
||||
# so this saves some time on slow systems.
|
||||
.SUFFIXES:
|
||||
@ -79,13 +57,12 @@ endif
|
||||
|
||||
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
|
||||
|
||||
CFLAGS += $(CFLAGS-yes)
|
||||
OBJS += $(OBJS-yes)
|
||||
FFLIBS := $(FFLIBS-yes) $(FFLIBS)
|
||||
TESTPROGS += $(TESTPROGS-yes)
|
||||
|
||||
FFEXTRALIBS := $(addprefix -l,$(addsuffix $(BUILDSUF),$(FFLIBS))) $(EXTRALIBS)
|
||||
FFLDFLAGS := $(addprefix -L$(BUILD_ROOT)/lib,$(ALLFFLIBS)) $(LDFLAGS)
|
||||
FFLDFLAGS := $(addprefix -Llib,$(ALLFFLIBS)) $(LDFLAGS)
|
||||
|
||||
EXAMPLES := $(addprefix $(SUBDIR),$(addsuffix -example$(EXESUF),$(EXAMPLES)))
|
||||
OBJS := $(addprefix $(SUBDIR),$(sort $(OBJS)))
|
||||
@ -94,7 +71,7 @@ TESTPROGS := $(addprefix $(SUBDIR),$(addsuffix -test$(EXESUF),$(TESTPROGS)))
|
||||
HOSTOBJS := $(addprefix $(SUBDIR),$(addsuffix .o,$(HOSTPROGS)))
|
||||
HOSTPROGS := $(addprefix $(SUBDIR),$(addsuffix $(HOSTEXESUF),$(HOSTPROGS)))
|
||||
|
||||
DEP_LIBS := $(foreach NAME,$(FFLIBS),$(BUILD_ROOT_REL)/lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
||||
DEP_LIBS := $(foreach NAME,$(FFLIBS),lib$(NAME)/$($(CONFIG_SHARED:yes=S)LIBNAME))
|
||||
|
||||
ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)/$(ARCH)/*.h))
|
||||
SKIPHEADERS += $(addprefix $(ARCH)/,$(ARCH_HEADERS))
|
||||
|
106
configure
vendored
106
configure
vendored
@ -106,8 +106,8 @@ Configuration options:
|
||||
--disable-lpc disable LPC code
|
||||
--disable-mdct disable MDCT code
|
||||
--disable-rdft disable RDFT code
|
||||
--disable-vaapi disable VAAPI code
|
||||
--disable-vdpau disable VDPAU code
|
||||
--enable-vaapi enable VAAPI code
|
||||
--enable-vdpau enable VDPAU code
|
||||
--disable-dxva2 disable DXVA2 code
|
||||
--enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
|
||||
--enable-hardcoded-tables use hardcoded tables instead of runtime generation
|
||||
@ -192,7 +192,6 @@ External library support:
|
||||
--enable-zlib enable zlib [autodetect]
|
||||
|
||||
Advanced options (experts only):
|
||||
--source-path=PATH path to source code [$source_path]
|
||||
--cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
|
||||
--enable-cross-compile assume a cross-compiler is used
|
||||
--sysroot=PATH root of cross-build tree
|
||||
@ -956,6 +955,7 @@ CONFIG_LIST="
|
||||
mdct
|
||||
memalign_hack
|
||||
mlib
|
||||
mpegaudiodsp
|
||||
network
|
||||
nonfree
|
||||
pic
|
||||
@ -1023,6 +1023,7 @@ ARCH_EXT_LIST='
|
||||
ppc4xx
|
||||
sse
|
||||
ssse3
|
||||
vfpv3
|
||||
vis
|
||||
'
|
||||
|
||||
@ -1075,8 +1076,6 @@ HAVE_LIST="
|
||||
isatty
|
||||
kbhit
|
||||
ldbrx
|
||||
libdc1394_1
|
||||
libdc1394_2
|
||||
llrint
|
||||
llrintf
|
||||
local_aligned_16
|
||||
@ -1183,13 +1182,13 @@ CMDLINE_SET="
|
||||
host_ldflags
|
||||
host_libs
|
||||
host_os
|
||||
install
|
||||
ld
|
||||
logfile
|
||||
malloc_prefix
|
||||
nm
|
||||
pkg_config
|
||||
samples
|
||||
source_path
|
||||
strip
|
||||
sysinclude
|
||||
sysroot
|
||||
@ -1212,6 +1211,7 @@ armv6t2_deps="arm"
|
||||
armvfp_deps="arm"
|
||||
iwmmxt_deps="arm"
|
||||
neon_deps="arm"
|
||||
vfpv3_deps="armvfp"
|
||||
|
||||
mmi_deps="mips"
|
||||
|
||||
@ -1243,6 +1243,7 @@ symver_if_any="symver_asm_label symver_gnu_asm"
|
||||
dct_select="rdft"
|
||||
mdct_select="fft"
|
||||
rdft_select="fft"
|
||||
mpegaudiodsp_select="dct"
|
||||
|
||||
# decoders / encoders / hardware accelerators
|
||||
aac_decoder_select="mdct sinewin"
|
||||
@ -1265,6 +1266,7 @@ dca_decoder_select="mdct"
|
||||
dnxhd_encoder_select="aandct"
|
||||
dxa_decoder_select="zlib"
|
||||
eac3_decoder_select="ac3_decoder"
|
||||
eac3_encoder_select="mdct ac3dsp"
|
||||
eamad_decoder_select="aandct"
|
||||
eatgq_decoder_select="aandct"
|
||||
eatqi_decoder_select="aandct"
|
||||
@ -1296,11 +1298,16 @@ ljpeg_encoder_select="aandct"
|
||||
loco_decoder_select="golomb"
|
||||
mjpeg_encoder_select="aandct"
|
||||
mlp_decoder_select="mlp_parser"
|
||||
mp1float_decoder_select="dct"
|
||||
mp2float_decoder_select="dct"
|
||||
mp3adufloat_decoder_select="dct"
|
||||
mp3float_decoder_select="dct"
|
||||
mp3on4float_decoder_select="dct"
|
||||
mp1_decoder_select="mpegaudiodsp"
|
||||
mp2_decoder_select="mpegaudiodsp"
|
||||
mp3adu_decoder_select="mpegaudiodsp"
|
||||
mp3_decoder_select="mpegaudiodsp"
|
||||
mp3on4_decoder_select="mpegaudiodsp"
|
||||
mp1float_decoder_select="mpegaudiodsp"
|
||||
mp2float_decoder_select="mpegaudiodsp"
|
||||
mp3adufloat_decoder_select="mpegaudiodsp"
|
||||
mp3float_decoder_select="mpegaudiodsp"
|
||||
mp3on4float_decoder_select="mpegaudiodsp"
|
||||
mpeg1video_encoder_select="aandct"
|
||||
mpeg2video_encoder_select="aandct"
|
||||
mpeg4_decoder_select="h263_decoder mpeg4video_parser"
|
||||
@ -1330,7 +1337,7 @@ nellymoser_encoder_select="mdct sinewin"
|
||||
png_decoder_select="zlib"
|
||||
png_encoder_select="zlib"
|
||||
qcelp_decoder_select="lsp"
|
||||
qdm2_decoder_select="mdct rdft"
|
||||
qdm2_decoder_select="mdct rdft mpegaudiodsp"
|
||||
ra_144_encoder_select="lpc"
|
||||
rv10_decoder_select="h263_decoder"
|
||||
rv10_encoder_select="h263_encoder"
|
||||
@ -1455,12 +1462,15 @@ w64_demuxer_deps="wav_demuxer"
|
||||
alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
|
||||
alsa_outdev_deps="alsa_asoundlib_h"
|
||||
bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
|
||||
dshow_indev_deps="IBaseFilter"
|
||||
dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
|
||||
dv1394_indev_deps="dv1394 dv_demuxer"
|
||||
fbdev_indev_deps="linux_fb_h"
|
||||
jack_indev_deps="jack_jack_h sem_timedwait"
|
||||
libdc1394_indev_deps="libdc1394"
|
||||
oss_indev_deps_any="soundcard_h sys_soundcard_h"
|
||||
oss_outdev_deps_any="soundcard_h sys_soundcard_h"
|
||||
sdl_outdev_deps="sdl"
|
||||
sndio_indev_deps="sndio_h"
|
||||
sndio_outdev_deps="sndio_h"
|
||||
v4l_indev_deps="linux_videodev_h"
|
||||
@ -1479,7 +1489,7 @@ mmst_protocol_deps="network"
|
||||
rtmp_protocol_select="tcp_protocol"
|
||||
rtp_protocol_select="udp_protocol"
|
||||
tcp_protocol_deps="network"
|
||||
udp_protocol_deps="network pthreads"
|
||||
udp_protocol_deps="network"
|
||||
|
||||
# filters
|
||||
blackframe_filter_deps="gpl"
|
||||
@ -1633,6 +1643,7 @@ ar_default="ar"
|
||||
cc_default="gcc"
|
||||
cc_version=\"unknown\"
|
||||
host_cc_default="gcc"
|
||||
install="install"
|
||||
ln_s="ln -sf"
|
||||
nm_default="nm"
|
||||
objformat="elf"
|
||||
@ -1691,7 +1702,7 @@ LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
|
||||
|
||||
CC_O='-o $@'
|
||||
|
||||
host_cflags='-D_ISOC99_SOURCE -O3 -g -Wall'
|
||||
host_cflags='-D_ISOC99_SOURCE -O3 -g'
|
||||
host_libs='-lm'
|
||||
|
||||
target_path='$(CURDIR)'
|
||||
@ -1702,13 +1713,12 @@ DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)
|
||||
DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
|
||||
|
||||
# find source path
|
||||
source_path="$(dirname "$0")"
|
||||
enable source_path_used
|
||||
if test -f configure; then
|
||||
source_path="$(pwd)"
|
||||
disable source_path_used
|
||||
else
|
||||
source_path="$(cd "$source_path"; pwd)"
|
||||
source_path=$(cd $(dirname "$0"); pwd)
|
||||
enable source_path_used
|
||||
echo "$source_path" | grep -q '[[:blank:]]' &&
|
||||
die "Out of tree builds are impossible with whitespace in source path."
|
||||
test -e "$source_path/config.h" &&
|
||||
@ -2354,6 +2364,7 @@ check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
|
||||
EOF
|
||||
|
||||
check_host_cflags -std=c99
|
||||
check_host_cflags -Wall
|
||||
|
||||
case "$arch" in
|
||||
alpha|ia64|mips|parisc|sparc)
|
||||
@ -2478,11 +2489,13 @@ case $target_os in
|
||||
objformat="win32"
|
||||
enable dos_paths
|
||||
check_cflags -fno-common
|
||||
add_cppflags -U__STRICT_ANSI__
|
||||
;;
|
||||
*-dos|freedos|opendos)
|
||||
network_extralibs="-lsocket"
|
||||
objformat="coff"
|
||||
enable dos_paths
|
||||
add_cppflags -U__STRICT_ANSI__
|
||||
;;
|
||||
linux)
|
||||
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
|
||||
@ -2495,6 +2508,8 @@ case $target_os in
|
||||
os/2*)
|
||||
strip="lxlite -CS"
|
||||
ln_s="cp -f"
|
||||
objformat="aout"
|
||||
add_cppflags -D_GNU_SOURCE
|
||||
add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
|
||||
SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
|
||||
FFSERVERLDFLAGS=""
|
||||
@ -2516,6 +2531,7 @@ case $target_os in
|
||||
enable dos_paths
|
||||
;;
|
||||
gnu/kfreebsd)
|
||||
add_cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
|
||||
;;
|
||||
gnu)
|
||||
;;
|
||||
@ -2644,6 +2660,7 @@ EOF
|
||||
enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
|
||||
enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
|
||||
enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
|
||||
enabled vfpv3 && check_asm vfpv3 '"vmov.f32 s0, #1.0"'
|
||||
|
||||
enabled_all armv6t2 shared !pic && enable_pic
|
||||
|
||||
@ -2750,7 +2767,7 @@ EOF
|
||||
|
||||
check_yasm "pextrd [eax], xmm0, 1" && enable yasm ||
|
||||
die "yasm not found, use --disable-yasm for a crippled build"
|
||||
check_yasm "vpaddw xmm0, xmm0, xmm0" || disable avx
|
||||
check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx
|
||||
fi
|
||||
|
||||
case "$cpu" in
|
||||
@ -2843,11 +2860,6 @@ check_header X11/extensions/XvMClib.h
|
||||
|
||||
check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex
|
||||
|
||||
if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
|
||||
enabled_any $need_memalign ; then
|
||||
die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
|
||||
fi
|
||||
|
||||
disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
|
||||
disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
|
||||
|
||||
@ -2899,6 +2911,7 @@ check_mathfunc truncf
|
||||
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32
|
||||
enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0
|
||||
enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
|
||||
enabled libdc1394 && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
|
||||
enabled libdirac && require_pkg_config dirac \
|
||||
"libdirac_decoder/dirac_parser.h libdirac_encoder/dirac_encoder.h" \
|
||||
"dirac_decoder_init dirac_encoder_init"
|
||||
@ -2909,7 +2922,7 @@ enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_q
|
||||
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
|
||||
enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
|
||||
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
|
||||
enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
|
||||
enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
|
||||
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
|
||||
enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
|
||||
enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
|
||||
@ -2924,36 +2937,28 @@ enabled libvpx && {
|
||||
enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx ||
|
||||
die "ERROR: libvpx encoder version must be >=0.9.6"; } }
|
||||
enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
|
||||
{ check_cpp_condition x264.h "X264_BUILD >= 99" ||
|
||||
die "ERROR: libx264 version must be >= 0.99."; }
|
||||
{ check_cpp_condition x264.h "X264_BUILD >= 115" ||
|
||||
die "ERROR: libx264 version must be >= 0.115."; }
|
||||
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
|
||||
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
|
||||
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
|
||||
|
||||
# libdc1394 check
|
||||
if enabled libdc1394; then
|
||||
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
|
||||
enable libdc1394_2; } ||
|
||||
{ check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
|
||||
enable libdc1394_1; } ||
|
||||
die "ERROR: No version of libdc1394 found "
|
||||
fi
|
||||
|
||||
SDL_CONFIG="${cross_prefix}sdl-config"
|
||||
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
|
||||
sdl_cflags=$("${SDL_CONFIG}" --cflags)
|
||||
sdl_libs=$("${SDL_CONFIG}" --libs)
|
||||
check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs &&
|
||||
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
enable sdl &&
|
||||
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
|
||||
else
|
||||
if check_pkg_config sdl SDL_version.h SDL_Linked_Version; then
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
enable sdl &&
|
||||
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
|
||||
fi
|
||||
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
|
||||
sdl_cflags=$("${SDL_CONFIG}" --cflags)
|
||||
sdl_libs=$("${SDL_CONFIG}" --libs)
|
||||
check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
|
||||
check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
|
||||
enable sdl &&
|
||||
check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size
|
||||
fi
|
||||
fi
|
||||
enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
|
||||
|
||||
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
|
||||
|
||||
@ -2967,6 +2972,8 @@ check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extra
|
||||
# w32api 3.12 had it defined wrong
|
||||
check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
|
||||
|
||||
check_type "dshow.h" IBaseFilter
|
||||
|
||||
# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
|
||||
{ check_header dev/bktr/ioctl_meteor.h &&
|
||||
check_header dev/bktr/ioctl_bt848.h; } ||
|
||||
@ -3036,7 +3043,7 @@ enabled extra_warnings && check_cflags -Winline
|
||||
|
||||
# add some linker flags
|
||||
check_ldflags -Wl,--warn-common
|
||||
check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
|
||||
check_ldflags -Wl,-rpath-link,libpostproc -Wl,-rpath-link,libswscale -Wl,-rpath-link,libavfilter -Wl,-rpath-link,libavdevice -Wl,-rpath-link,libavformat -Wl,-rpath-link,libavcodec -Wl,-rpath-link,libavutil
|
||||
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
|
||||
|
||||
echo "X{};" > $TMPV
|
||||
@ -3138,6 +3145,9 @@ check_deps $CONFIG_LIST \
|
||||
|
||||
enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
|
||||
|
||||
! enabled_any memalign posix_memalign malloc_aligned &&
|
||||
enabled_any $need_memalign && enable memalign_hack
|
||||
|
||||
echo "install prefix $prefix"
|
||||
echo "source path $source_path"
|
||||
echo "C compiler $cc"
|
||||
@ -3151,13 +3161,14 @@ fi
|
||||
echo "big-endian ${bigendian-no}"
|
||||
echo "runtime cpu detection ${runtime_cpudetect-no}"
|
||||
if enabled x86; then
|
||||
echo "yasm ${yasm-no}"
|
||||
echo "${yasmexe} ${yasm-no}"
|
||||
echo "MMX enabled ${mmx-no}"
|
||||
echo "MMX2 enabled ${mmx2-no}"
|
||||
echo "3DNow! enabled ${amd3dnow-no}"
|
||||
echo "3DNow! extended enabled ${amd3dnowext-no}"
|
||||
echo "SSE enabled ${sse-no}"
|
||||
echo "SSSE3 enabled ${ssse3-no}"
|
||||
echo "AVX enabled ${avx-no}"
|
||||
echo "CMOV enabled ${cmov-no}"
|
||||
echo "CMOV is fast ${fast_cmov-no}"
|
||||
echo "EBX available ${ebx_available-no}"
|
||||
@ -3302,7 +3313,6 @@ DATADIR=\$(DESTDIR)$datadir
|
||||
MANDIR=\$(DESTDIR)$mandir
|
||||
SRC_PATH="$source_path"
|
||||
SRC_PATH_BARE=$source_path
|
||||
BUILD_ROOT="$PWD"
|
||||
CC_IDENT=$cc_ident
|
||||
ARCH=$arch
|
||||
CC=$cc
|
||||
@ -3349,7 +3359,7 @@ SDL_LIBS=$sdl_libs
|
||||
SDL_CFLAGS=$sdl_cflags
|
||||
LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
|
||||
EXTRALIBS=$extralibs
|
||||
INSTALL=install
|
||||
INSTALL=$install
|
||||
LIBTARGET=${LIBTARGET}
|
||||
SLIBNAME=${SLIBNAME}
|
||||
SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
|
||||
|
@ -13,33 +13,107 @@ libavutil: 2011-04-18
|
||||
|
||||
API changes, most recent first:
|
||||
|
||||
2011-05-10 - 188dea1 - lavc 53.3.0 - avcodec.h
|
||||
2011-06-12 - xxxxxxx - lavfi 2.18.0 - avcodec.h
|
||||
Add avfilter_get_video_buffer_ref_from_frame() function in
|
||||
libavfilter/avcodec.h.
|
||||
|
||||
2011-06-12 - xxxxxxx - lavfi 2.17.0 - avfiltergraph.h
|
||||
Add avfilter_inout_alloc() and avfilter_inout_free() functions.
|
||||
|
||||
2011-06-12 - xxxxxxx - lavfi 2.16.0 - avfilter_graph_parse()
|
||||
Change avfilter_graph_parse() signature.
|
||||
|
||||
2011-06-xx - xxxxxxx - lavu 51.6.0 - opt.h
|
||||
Add av_opt_flag_is_set().
|
||||
|
||||
2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays
|
||||
Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h.
|
||||
|
||||
2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata
|
||||
Move AVMetadata from lavf to lavu and rename it to
|
||||
AVDictionary -- new installed header dict.h.
|
||||
All av_metadata_* functions renamed to av_dict_*.
|
||||
|
||||
2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample()
|
||||
Add av_get_bytes_per_sample() in libavutil/samplefmt.h.
|
||||
Deprecate av_get_bits_per_sample_fmt().
|
||||
|
||||
2011-06-xx - b39b062 - lavu 51.8.0 - opt.h
|
||||
Add av_opt_free convenience function.
|
||||
|
||||
2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps
|
||||
Remove AVFilterBufferRefAudioProps.size, and use nb_samples in
|
||||
avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in
|
||||
place of size.
|
||||
|
||||
2011-06-06 - 0bc2cca - lavu 51.6.0 - av_samples_alloc()
|
||||
Switch nb_channels and nb_samples parameters order in
|
||||
av_samples_alloc().
|
||||
|
||||
2011-06-06 - e1c7414 - lavu 51.5.0 - av_samples_*
|
||||
Change the data layout created by av_samples_fill_arrays() and
|
||||
av_samples_alloc().
|
||||
|
||||
2011-06-06 - 27bcf55 - lavfi 2.13.0 - vsrc_buffer.h
|
||||
Make av_vsrc_buffer_add_video_buffer_ref() accepts an additional
|
||||
flags parameter in input.
|
||||
|
||||
2011-06-03 - e977ca2 - lavfi 2.12.0 - avfilter_link_free()
|
||||
Add avfilter_link_free() function.
|
||||
|
||||
2011-06-02 - 5ad38d9 - lavu 51.4.0 - av_force_cpu_flags()
|
||||
Add av_cpu_flags() in libavutil/cpu.h.
|
||||
|
||||
2011-05-28 - e71f260 - lavu 51.3.0 - pixdesc.h
|
||||
Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
|
||||
avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
|
||||
|
||||
2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h
|
||||
Add fps_probe_size to AVFormatContext.
|
||||
|
||||
2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h
|
||||
Introduce avformat_alloc_output_context2() and deprecate
|
||||
avformat_alloc_output_context().
|
||||
|
||||
2011-05-22 - 83db719 - lavfi 2.10.0 - vsrc_buffer.h
|
||||
Make libavfilter/vsrc_buffer.h public.
|
||||
|
||||
2011-05-19 - c000a9f - lavfi 2.8.0 - avcodec.h
|
||||
Add av_vsrc_buffer_add_frame() to libavfilter/avcodec.h.
|
||||
|
||||
2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h
|
||||
Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
|
||||
|
||||
2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt
|
||||
Add request_sample_fmt field to AVCodecContext.
|
||||
|
||||
2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h
|
||||
Deprecate AVLPCType and the following fields in
|
||||
AVCodecContext: lpc_coeff_precision, prediction_order_method,
|
||||
min_partition_order, max_partition_order, lpc_type, lpc_passes.
|
||||
Corresponding FLAC encoder options should be used instead.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavfi 2.5.0 - avcodec.h
|
||||
2011-05-07 - 9fdf772 - lavfi 2.5.0 - avcodec.h
|
||||
Add libavfilter/avcodec.h header and avfilter_copy_frame_props()
|
||||
function.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavc 53.5.0 - AVFrame
|
||||
2011-05-07 - 18ded93 - lavc 53.5.0 - AVFrame
|
||||
Add format field to AVFrame.
|
||||
|
||||
2011-05-07 - xxxxxxx - lavc 53.4.0 - AVFrame
|
||||
2011-05-07 - 22333a6 - lavc 53.4.0 - AVFrame
|
||||
Add width and height fields to AVFrame.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavfi 2.4.0 - avfilter.h
|
||||
2011-05-01 - 35fe66a - lavfi 2.4.0 - avfilter.h
|
||||
Rename AVFilterBufferRefVideoProps.pixel_aspect to
|
||||
sample_aspect_ratio.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavc 53.3.0 - AVFrame
|
||||
2011-05-01 - 77e9dee - lavc 53.3.0 - AVFrame
|
||||
Add a sample_aspect_ratio field to AVFrame.
|
||||
|
||||
2011-05-01 - xxxxxxx - lavc 53.2.0 - AVFrame
|
||||
2011-05-01 - 1ba5727 - lavc 53.2.0 - AVFrame
|
||||
Add a pkt_pos field to AVFrame.
|
||||
|
||||
2011-04-xx - xxxxxxx - lavu 51.2.0 - mem.h
|
||||
2011-04-29 - 35ceaa7 - lavu 51.2.0 - mem.h
|
||||
Add av_dynarray_add function for adding
|
||||
an element to a dynamic array.
|
||||
|
||||
@ -94,9 +168,6 @@ API changes, most recent first:
|
||||
333e894 deprecate url_open_protocol
|
||||
e230705 deprecate url_poll and URLPollEntry
|
||||
|
||||
2011-04-10 - lavu 50.40.0 - pixfmt.h
|
||||
Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats
|
||||
|
||||
2011-04-08 - lavf 52.106.0 - avformat.h
|
||||
Minor avformat.h cleanup:
|
||||
a9bf9d8 deprecate av_guess_image2_codec
|
||||
@ -145,7 +216,7 @@ API changes, most recent first:
|
||||
2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type
|
||||
Add audio_service_type field to AVCodecContext.
|
||||
|
||||
2011-XX-XX - XXXXXXX - lavu XX.XXX.X - pixfmt.h
|
||||
2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h
|
||||
Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats
|
||||
|
||||
2011-03-02 - 863c471 - lavf 52.103.0 - av_pkt_dump2, av_pkt_dump_log2
|
||||
@ -214,10 +285,10 @@ API changes, most recent first:
|
||||
2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h
|
||||
Make av_dlog public.
|
||||
|
||||
2011-01-31 - X - lavfi 1.76.0 - vsrc_buffer
|
||||
2011-01-31 - 7b3ea55 - lavfi 1.76.0 - vsrc_buffer
|
||||
Add sample_aspect_ratio fields to vsrc_buffer arguments
|
||||
|
||||
2011-01-31 - X - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio
|
||||
2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio
|
||||
Add sample_aspect_ratio field to AVFilterLink.
|
||||
|
||||
2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
|
||||
|
50
doc/decoders.texi
Normal file
50
doc/decoders.texi
Normal file
@ -0,0 +1,50 @@
|
||||
@chapter Decoders
|
||||
@c man begin DECODERS
|
||||
|
||||
Decoders are configured elements in FFmpeg which allow the decoding of
|
||||
multimedia streams.
|
||||
|
||||
When you configure your FFmpeg build, all the supported native decoders
|
||||
are enabled by default. Decoders requiring an external library must be enabled
|
||||
manually via the corresponding @code{--enable-lib} option. You can list all
|
||||
available decoders using the configure option @code{--list-decoders}.
|
||||
|
||||
You can disable all the decoders with the configure option
|
||||
@code{--disable-decoders} and selectively enable / disable single decoders
|
||||
with the options @code{--enable-decoder=@var{DECODER}} /
|
||||
@code{--disable-decoder=@var{DECODER}}.
|
||||
|
||||
The option @code{-codecs} of the ff* tools will display the list of
|
||||
enabled decoders.
|
||||
|
||||
@c man end DECODERS
|
||||
|
||||
@chapter Video Decoders
|
||||
@c man begin VIDEO DECODERS
|
||||
|
||||
A description of some of the currently available video decoders
|
||||
follows.
|
||||
|
||||
@section rawvideo
|
||||
|
||||
Rawvideo decoder.
|
||||
|
||||
This decoder decodes rawvideo streams.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
@item top @var{top_field_first}
|
||||
Specify the assumed field type of the input video.
|
||||
@table @option
|
||||
@item -1
|
||||
the video is assumed to be progressive (default)
|
||||
@item 0
|
||||
bottom-field-first is assumed
|
||||
@item 1
|
||||
top-field-first is assumed
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@c man end VIDEO DECODERS
|
@ -392,6 +392,8 @@ send a reminder by email. Your patch should eventually be dealt with.
|
||||
improves readability.
|
||||
@item
|
||||
Consider to add a regression test for your code.
|
||||
@item
|
||||
If you added YASM code please check that things still work with --disable-yasm
|
||||
@end enumerate
|
||||
|
||||
@section Patch review process
|
||||
|
@ -17,11 +17,15 @@ with the options @code{--enable-encoder=@var{ENCODER}} /
|
||||
The option @code{-codecs} of the ff* tools will display the list of
|
||||
enabled encoders.
|
||||
|
||||
A description of some of the currently available encoders follows.
|
||||
@c man end ENCODERS
|
||||
|
||||
@section Audio Encoders
|
||||
@chapter Audio Encoders
|
||||
@c man begin AUDIO ENCODERS
|
||||
|
||||
@subsection ac3 and ac3_fixed
|
||||
A description of some of the currently available audio encoders
|
||||
follows.
|
||||
|
||||
@section ac3 and ac3_fixed
|
||||
|
||||
AC-3 audio encoders.
|
||||
|
||||
@ -36,7 +40,7 @@ quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
|
||||
default codec for any of the output formats, so it must be specified explicitly
|
||||
using the option @code{-acodec ac3_fixed} in order to use it.
|
||||
|
||||
@subheading AC-3 Metadata
|
||||
@subsection AC-3 Metadata
|
||||
|
||||
The AC-3 metadata options are used to set parameters that describe the audio,
|
||||
but in most cases do not affect the audio encoding itself. Some of the options
|
||||
@ -55,7 +59,7 @@ documents.
|
||||
@item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
|
||||
@end itemize
|
||||
|
||||
@subsubheading Metadata Control Options
|
||||
@subsubsection Metadata Control Options
|
||||
|
||||
@table @option
|
||||
|
||||
@ -72,7 +76,7 @@ Metadata values can be changed before encoding each frame.
|
||||
|
||||
@end table
|
||||
|
||||
@subsubheading Downmix Levels
|
||||
@subsubsection Downmix Levels
|
||||
|
||||
@table @option
|
||||
|
||||
@ -106,7 +110,7 @@ Silence Surround Channel(s)
|
||||
|
||||
@end table
|
||||
|
||||
@subsubheading Audio Production Information
|
||||
@subsubsection Audio Production Information
|
||||
Audio Production Information is optional information describing the mixing
|
||||
environment. Either none or both of the fields are written to the bitstream.
|
||||
|
||||
@ -140,7 +144,7 @@ Small Room
|
||||
|
||||
@end table
|
||||
|
||||
@subsubheading Other Metadata Options
|
||||
@subsubsection Other Metadata Options
|
||||
|
||||
@table @option
|
||||
|
||||
@ -195,7 +199,7 @@ Original Source (default)
|
||||
|
||||
@end table
|
||||
|
||||
@subsubheading Extended Bitstream Information
|
||||
@subsection Extended Bitstream Information
|
||||
The extended bitstream options are part of the Alternate Bit Stream Syntax as
|
||||
specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
|
||||
If any one parameter in a group is specified, all values in that group will be
|
||||
@ -205,7 +209,7 @@ will use these values instead of the ones specified in the @code{center_mixlev}
|
||||
and @code{surround_mixlev} options if it supports the Alternate Bit Stream
|
||||
Syntax.
|
||||
|
||||
@subsubheading Extended Bitstream Information - Part 1
|
||||
@subsubsection Extended Bitstream Information - Part 1
|
||||
|
||||
@table @option
|
||||
|
||||
@ -302,7 +306,7 @@ Silence Surround Channel(s)
|
||||
|
||||
@end table
|
||||
|
||||
@subsubheading Extended Bitstream Information - Part 2
|
||||
@subsubsection Extended Bitstream Information - Part 2
|
||||
|
||||
@table @option
|
||||
|
||||
@ -353,7 +357,7 @@ HDCD A/D Converter
|
||||
|
||||
@end table
|
||||
|
||||
@subheading Other AC-3 Encoding Options
|
||||
@subsection Other AC-3 Encoding Options
|
||||
|
||||
@table @option
|
||||
|
||||
@ -365,4 +369,223 @@ is highly recommended that it be left as enabled except for testing purposes.
|
||||
|
||||
@end table
|
||||
|
||||
@c man end ENCODERS
|
||||
@subsection Floating-Point-Only AC-3 Encoding Options
|
||||
|
||||
These options are only valid for the floating-point encoder and do not exist
|
||||
for the fixed-point encoder due to the corresponding features not being
|
||||
implemented in fixed-point.
|
||||
|
||||
@table @option
|
||||
|
||||
@item -channel_coupling @var{boolean}
|
||||
Enables/Disables use of channel coupling, which is an optional AC-3 feature
|
||||
that increases quality by combining high frequency information from multiple
|
||||
channels into a single channel. The per-channel high frequency information is
|
||||
sent with less accuracy in both the frequency and time domains. This allows
|
||||
more bits to be used for lower frequencies while preserving enough information
|
||||
to reconstruct the high frequencies. This option is enabled by default for the
|
||||
floating-point encoder and should generally be left as enabled except for
|
||||
testing purposes or to increase encoding speed.
|
||||
@table @option
|
||||
@item -1
|
||||
@itemx auto
|
||||
Selected by Encoder (default)
|
||||
@item 0
|
||||
@itemx off
|
||||
Disable Channel Coupling
|
||||
@item 1
|
||||
@itemx on
|
||||
Enable Channel Coupling
|
||||
@end table
|
||||
|
||||
@item -cpl_start_band @var{number}
|
||||
Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
|
||||
value higher than the bandwidth is used, it will be reduced to 1 less than the
|
||||
coupling end band. If @var{auto} is used, the start band will be determined by
|
||||
the encoder based on the bit rate, sample rate, and channel layout. This option
|
||||
has no effect if channel coupling is disabled.
|
||||
@table @option
|
||||
@item -1
|
||||
@itemx auto
|
||||
Selected by Encoder (default)
|
||||
@end table
|
||||
|
||||
@end table
|
||||
|
||||
@c man end AUDIO ENCODERS
|
||||
|
||||
@chapter Video Encoders
|
||||
@c man begin VIDEO ENCODERS
|
||||
|
||||
A description of some of the currently available video encoders
|
||||
follows.
|
||||
|
||||
@section libvpx
|
||||
|
||||
VP8 format supported through libvpx.
|
||||
|
||||
Requires the presence of the libvpx headers and library during configuration.
|
||||
You need to explicitly configure the build with @code{--enable-libvpx}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
Mapping from FFmpeg to libvpx options with conversion notes in parentheses.
|
||||
|
||||
@table @option
|
||||
|
||||
@item threads
|
||||
g_threads
|
||||
|
||||
@item profile
|
||||
g_profile
|
||||
|
||||
@item vb
|
||||
rc_target_bitrate
|
||||
|
||||
@item g
|
||||
kf_max_dist
|
||||
|
||||
@item keyint_min
|
||||
kf_min_dist
|
||||
|
||||
@item qmin
|
||||
rc_min_quantizer
|
||||
|
||||
@item qmax
|
||||
rc_max_quantizer
|
||||
|
||||
@item bufsize, vb
|
||||
rc_buf_sz
|
||||
@code{(bufsize * 1000 / vb)}
|
||||
|
||||
rc_buf_optimal_sz
|
||||
@code{(bufsize * 1000 / vb * 5 / 6)}
|
||||
|
||||
@item rc_init_occupancy, vb
|
||||
rc_buf_initial_sz
|
||||
@code{(rc_init_occupancy * 1000 / vb)}
|
||||
|
||||
@item rc_buffer_aggressivity
|
||||
rc_undershoot_pct
|
||||
|
||||
@item skip_threshold
|
||||
rc_dropframe_thresh
|
||||
|
||||
@item qcomp
|
||||
rc_2pass_vbr_bias_pct
|
||||
|
||||
@item maxrate, vb
|
||||
rc_2pass_vbr_maxsection_pct
|
||||
@code{(maxrate * 100 / vb)}
|
||||
|
||||
@item minrate, vb
|
||||
rc_2pass_vbr_minsection_pct
|
||||
@code{(minrate * 100 / vb)}
|
||||
|
||||
@item minrate, maxrate, vb
|
||||
@code{VPX_CBR}
|
||||
@code{(minrate == maxrate == vb)}
|
||||
|
||||
@item crf
|
||||
@code{VPX_CQ}, @code{VP8E_SET_CQ_LEVEL}
|
||||
|
||||
@item quality
|
||||
@table @option
|
||||
@item @var{best}
|
||||
@code{VPX_DL_BEST_QUALITY}
|
||||
@item @var{good}
|
||||
@code{VPX_DL_GOOD_QUALITY}
|
||||
@item @var{realtime}
|
||||
@code{VPX_DL_REALTIME}
|
||||
@end table
|
||||
|
||||
@item speed
|
||||
@code{VP8E_SET_CPUUSED}
|
||||
|
||||
@item nr
|
||||
@code{VP8E_SET_NOISE_SENSITIVITY}
|
||||
|
||||
@item mb_threshold
|
||||
@code{VP8E_SET_STATIC_THRESHOLD}
|
||||
|
||||
@item slices
|
||||
@code{VP8E_SET_TOKEN_PARTITIONS}
|
||||
|
||||
@item Alternate reference frame related
|
||||
@table @option
|
||||
@item vp8flags altref
|
||||
@code{VP8E_SET_ENABLEAUTOALTREF}
|
||||
@item @var{arnr_max_frames}
|
||||
@code{VP8E_SET_ARNR_MAXFRAMES}
|
||||
@item @var{arnr_type}
|
||||
@code{VP8E_SET_ARNR_TYPE}
|
||||
@item @var{arnr_strength}
|
||||
@code{VP8E_SET_ARNR_STRENGTH}
|
||||
@item @var{rc_lookahead}
|
||||
g_lag_in_frames
|
||||
@end table
|
||||
|
||||
@item vp8flags error_resilient
|
||||
g_error_resilient
|
||||
|
||||
@end table
|
||||
|
||||
For more information about libvpx see:
|
||||
@url{http://www.webmproject.org/}
|
||||
|
||||
@section libx264
|
||||
|
||||
H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 format supported through
|
||||
libx264.
|
||||
|
||||
Requires the presence of the libx264 headers and library during
|
||||
configuration. You need to explicitly configure the build with
|
||||
@code{--enable-libx264}.
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item preset @var{preset_name}
|
||||
Set the encoding preset.
|
||||
|
||||
@item tune @var{tune_name}
|
||||
Tune the encoding params.
|
||||
Deprecated in favor of @var{x264_opts}
|
||||
|
||||
@item fastfirstpass @var{bool}
|
||||
Use fast settings when encoding first pass, default value is 1.
|
||||
Deprecated in favor of @var{x264_opts}.
|
||||
|
||||
@item profile @var{profile_name}
|
||||
Set profile restrictions.
|
||||
Deprecated in favor of @var{x264_opts}.
|
||||
|
||||
@item level @var{level}
|
||||
Specify level (as defined by Annex A).
|
||||
Deprecated in favor of @var{x264_opts}.
|
||||
|
||||
@item passlogfile @var{filename}
|
||||
Specify filename for 2 pass stats.
|
||||
Deprecated in favor of @var{x264_opts}.
|
||||
|
||||
@item wpredp @var{wpred_type}
|
||||
Specify Weighted prediction for P-frames.
|
||||
Deprecated in favor of @var{x264_opts}.
|
||||
|
||||
@item x264opts @var{options}
|
||||
Allow to set any x264 option, see x264 manual for a list.
|
||||
|
||||
@var{options} is a list of @var{key}=@var{value} couples separated by
|
||||
":".
|
||||
@end table
|
||||
|
||||
For example to specify libx264 encoding options with @file{ffmpeg}:
|
||||
@example
|
||||
ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
|
||||
@end example
|
||||
|
||||
For more information about libx264 and the supported options see:
|
||||
@url{http://www.videolan.org/developers/x264.html}
|
||||
|
||||
@c man end VIDEO ENCODERS
|
||||
|
@ -76,6 +76,13 @@ integer. For example, "trunc(-1.5)" is "-1.0".
|
||||
@item sqrt(expr)
|
||||
Compute the square root of @var{expr}. This is equivalent to
|
||||
"(@var{expr})^.5".
|
||||
|
||||
@item not(expr)
|
||||
Return 1.0 if @var{expr} is zero, 0.0 otherwise.
|
||||
|
||||
@item pow(x, y)
|
||||
Compute the power of @var{x} elevated @var{y}, it is equivalent to
|
||||
"(@var{x})^(@var{y})".
|
||||
@end table
|
||||
|
||||
Note that:
|
||||
@ -93,11 +100,6 @@ is equivalent to
|
||||
A*B + not(A)*C
|
||||
@end example
|
||||
|
||||
When A evaluates to either 1 or 0, that is the same as
|
||||
@example
|
||||
A*B + eq(A,0)*C
|
||||
@end example
|
||||
|
||||
In your C code, you can extend the list of unary and binary functions,
|
||||
and define recognized constants, so that they are available for your
|
||||
expressions.
|
||||
|
21
doc/examples/Makefile
Normal file
21
doc/examples/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
# use pkg-config for getting CFLAGS abd LDFLAGS
|
||||
FFMPEG_LIBS=libavdevice libavformat libavfilter libavcodec libswscale libavutil
|
||||
CFLAGS+=$(shell pkg-config --cflags $(FFMPEG_LIBS))
|
||||
LDFLAGS+=$(shell pkg-config --libs $(FFMPEG_LIBS))
|
||||
|
||||
EXAMPLES=encoding-example muxing-example
|
||||
|
||||
OBJS=$(addsuffix .o,$(EXAMPLES))
|
||||
|
||||
%: %.o
|
||||
$(CC) $< $(LDFLAGS) -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $< $(CFLAGS) -c -o $@
|
||||
|
||||
.phony: all clean
|
||||
|
||||
all: $(OBJS) $(EXAMPLES)
|
||||
|
||||
clean:
|
||||
rm -rf $(EXAMPLES) $(OBJS)
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* copyright (c) 2001 Fabrice Bellard
|
||||
* Copyright (c) 2001 Fabrice Bellard
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
@ -1,7 +1,4 @@
|
||||
/*
|
||||
* Libavformat API example: Output a media file in any supported
|
||||
* libavformat format. The default codecs are used.
|
||||
*
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@ -22,6 +19,13 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Libavformat API example: Output a media file in any supported
|
||||
* libavformat format. The default codecs are used.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -443,10 +447,10 @@ int main(int argc, char **argv)
|
||||
filename = argv[1];
|
||||
|
||||
/* allocate the output media context */
|
||||
oc = avformat_alloc_output_context(NULL, NULL, filename);
|
||||
avformat_alloc_output_context2(&oc, NULL, NULL, filename);
|
||||
if (!oc) {
|
||||
printf("Could not deduce output format from file extension: using MPEG.\n");
|
||||
oc = avformat_alloc_output_context("mpeg", NULL, filename);
|
||||
avformat_alloc_output_context2(&oc, NULL, "mpeg", filename);
|
||||
}
|
||||
if (!oc) {
|
||||
exit(1);
|
@ -7,8 +7,7 @@ that is provided separately from the actual source distribution.
|
||||
|
||||
Use the following command to get the fate test samples
|
||||
|
||||
# rsync -aL rsync://rsync.mplayerhq.hu:/samples/fate-suite/ fate/fate-suite
|
||||
# rsync -aL rsync://fate-suite.libav.org:/fate-suite/ fate-suite
|
||||
# make fate-rsync SAMPLES=fate-suite/
|
||||
|
||||
To inform the build system about the testsuite location, pass
|
||||
`--samples=<path to the samples>` to configure or set the SAMPLES Make
|
||||
|
@ -402,7 +402,10 @@ and the following constants are available:
|
||||
@end table
|
||||
|
||||
@item -rc_override @var{override}
|
||||
rate control override for specific intervals
|
||||
Rate control override for specific intervals, formated as "int,int,int"
|
||||
list separated with slashes. Two first values are the beginning and
|
||||
end frame numbers, last one is quantizer to use if positive, or quality
|
||||
factor if negative.
|
||||
@item -me_method @var{method}
|
||||
Set motion estimation method to @var{method}.
|
||||
Available methods are (from lowest to best quality):
|
||||
@ -813,6 +816,7 @@ following rules:
|
||||
First ffmpeg searches for a file named @var{arg}.ffpreset in the
|
||||
directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in
|
||||
the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg})
|
||||
or in a @file{ffpresets} folder along the executable on win32,
|
||||
in that order. For example, if the argument is @code{libx264-max}, it will
|
||||
search for the file @file{libx264-max.ffpreset}.
|
||||
|
||||
@ -1042,6 +1046,7 @@ file to which you want to add them.
|
||||
@c man end EXAMPLES
|
||||
|
||||
@include eval.texi
|
||||
@include decoders.texi
|
||||
@include encoders.texi
|
||||
@include demuxers.texi
|
||||
@include muxers.texi
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
@example
|
||||
@c man begin SYNOPSIS
|
||||
ffplay [options] @file{input_file}
|
||||
ffplay [options] [@file{input_file}]
|
||||
@c man end
|
||||
@end example
|
||||
|
||||
@ -82,6 +82,8 @@ the input video.
|
||||
Use the option "-filters" to show all the available filters (including
|
||||
also sources and sinks).
|
||||
|
||||
@item -i @var{input_file}
|
||||
Read @var{input_file}.
|
||||
@end table
|
||||
|
||||
@section Advanced options
|
||||
@ -91,12 +93,8 @@ Set pixel format.
|
||||
@item -stats
|
||||
Show the stream duration, the codec parameters, the current position in
|
||||
the stream and the audio/video synchronisation drift.
|
||||
@item -debug
|
||||
Print specific debug info.
|
||||
@item -bug
|
||||
Work around bugs.
|
||||
@item -vismv
|
||||
Visualize motion vectors.
|
||||
@item -fast
|
||||
Non-spec-compliant optimizations.
|
||||
@item -genpts
|
||||
@ -174,6 +172,7 @@ Seek to percentage in file corresponding to fraction of width.
|
||||
@c man end
|
||||
|
||||
@include eval.texi
|
||||
@include decoders.texi
|
||||
@include demuxers.texi
|
||||
@include muxers.texi
|
||||
@include indevs.texi
|
||||
|
@ -108,11 +108,14 @@ multimedia stream.
|
||||
Each media stream information is printed within a dedicated section
|
||||
with name "STREAM".
|
||||
|
||||
@item -i @var{input_file}
|
||||
Read @var{input_file}.
|
||||
|
||||
@end table
|
||||
@c man end
|
||||
|
||||
@include decoders.texi
|
||||
@include demuxers.texi
|
||||
@include muxers.texi
|
||||
@include protocols.texi
|
||||
@include indevs.texi
|
||||
|
||||
|
155
doc/filters.texi
155
doc/filters.texi
@ -761,7 +761,7 @@ The list of the currently supported filters follows:
|
||||
@item pullup
|
||||
@item qp
|
||||
@item rectangle
|
||||
@item remove_logo
|
||||
@item remove-logo
|
||||
@item rgbtest
|
||||
@item rotate
|
||||
@item sab
|
||||
@ -1163,6 +1163,122 @@ scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
|
||||
scale='min(500\, iw*3/2):-1'
|
||||
@end example
|
||||
|
||||
@section select
|
||||
Select frames to pass in output.
|
||||
|
||||
It accepts in input an expression, which is evaluated for each input
|
||||
frame. If the expression is evaluated to a non-zero value, the frame
|
||||
is selected and passed to the output, otherwise it is discarded.
|
||||
|
||||
The expression can contain the following constants:
|
||||
|
||||
@table @option
|
||||
@item PI
|
||||
Greek PI
|
||||
|
||||
@item PHI
|
||||
golden ratio
|
||||
|
||||
@item E
|
||||
Euler number
|
||||
|
||||
@item n
|
||||
the sequential number of the filtered frame, starting from 0
|
||||
|
||||
@item selected_n
|
||||
the sequential number of the selected frame, starting from 0
|
||||
|
||||
@item prev_selected_n
|
||||
the sequential number of the last selected frame, NAN if undefined
|
||||
|
||||
@item TB
|
||||
timebase of the input timestamps
|
||||
|
||||
@item pts
|
||||
the PTS (Presentation TimeStamp) of the filtered video frame,
|
||||
expressed in @var{TB} units, NAN if undefined
|
||||
|
||||
@item t
|
||||
the PTS (Presentation TimeStamp) of the filtered video frame,
|
||||
expressed in seconds, NAN if undefined
|
||||
|
||||
@item prev_pts
|
||||
the PTS of the previously filtered video frame, NAN if undefined
|
||||
|
||||
@item prev_selected_pts
|
||||
the PTS of the last previously filtered video frame, NAN if undefined
|
||||
|
||||
@item prev_selected_t
|
||||
the PTS of the last previously selected video frame, NAN if undefined
|
||||
|
||||
@item start_pts
|
||||
the PTS of the first video frame in the video, NAN if undefined
|
||||
|
||||
@item start_t
|
||||
the time of the first video frame in the video, NAN if undefined
|
||||
|
||||
@item pict_type
|
||||
the picture type of the filtered frame, can assume one of the following
|
||||
values:
|
||||
@table @option
|
||||
@item PICT_TYPE_I
|
||||
@item PICT_TYPE_P
|
||||
@item PICT_TYPE_B
|
||||
@item PICT_TYPE_S
|
||||
@item PICT_TYPE_SI
|
||||
@item PICT_TYPE_SP
|
||||
@item PICT_TYPE_BI
|
||||
@end table
|
||||
|
||||
@item interlace_type
|
||||
the frame interlace type, can assume one of the following values:
|
||||
@table @option
|
||||
@item INTERLACE_TYPE_P
|
||||
the frame is progressive (not interlaced)
|
||||
@item INTERLACE_TYPE_T
|
||||
the frame is top-field-first
|
||||
@item INTERLACE_TYPE_B
|
||||
the frame is bottom-field-first
|
||||
@end table
|
||||
|
||||
@item key
|
||||
1 if the filtered frame is a key-frame, 0 otherwise
|
||||
|
||||
@item pos
|
||||
the position in the file of the filtered frame, -1 if the information
|
||||
is not available (e.g. for synthetic video)
|
||||
@end table
|
||||
|
||||
The default value of the select expression is "1".
|
||||
|
||||
Some examples follow:
|
||||
|
||||
@example
|
||||
# select all frames in input
|
||||
select
|
||||
|
||||
# the above is the same as:
|
||||
select=1
|
||||
|
||||
# skip all frames:
|
||||
select=0
|
||||
|
||||
# select only I-frames
|
||||
select='eq(pict_type\,PICT_TYPE_I)'
|
||||
|
||||
# select one frame every 100
|
||||
select='not(mod(n\,100))'
|
||||
|
||||
# select only frames contained in the 10-20 time interval
|
||||
select='gte(t\,10)*lte(t\,20)'
|
||||
|
||||
# select only I frames contained in the 10-20 time interval
|
||||
select='gte(t\,10)*lte(t\,20)*eq(pict_type\,PICT_TYPE_I)'
|
||||
|
||||
# select frames with a minimum distance of 10 seconds
|
||||
select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
|
||||
@end example
|
||||
|
||||
@anchor{setdar}
|
||||
@section setdar
|
||||
|
||||
@ -1360,12 +1476,12 @@ Check also the documentation of the @code{AVPictureType} enum and of
|
||||
the @code{av_get_picture_type_char} function defined in
|
||||
@file{libavutil/avutil.h}.
|
||||
|
||||
@item crc
|
||||
Adler-32 CRC of the input frame
|
||||
@item checksum
|
||||
Adler-32 checksum of all the planes of the input frame
|
||||
|
||||
@item plane_crc
|
||||
Adler-32 CRC of each plane of the input frame, expressed in the form
|
||||
"[@var{crc0} @var{crc1} @var{crc2} @var{crc3}]"
|
||||
@item plane_checksum
|
||||
Adler-32 checksum of each plane of the input frame, expressed in the form
|
||||
"[@var{c0} @var{c1} @var{c2} @var{c3}]"
|
||||
@end table
|
||||
|
||||
@section slicify
|
||||
@ -1383,6 +1499,21 @@ not specified it will use the default value of 16.
|
||||
Adding this in the beginning of filter chains should make filtering
|
||||
faster due to better use of the memory cache.
|
||||
|
||||
@section split
|
||||
|
||||
Pass on the input video to two outputs. Both outputs are identical to
|
||||
the input video.
|
||||
|
||||
For example:
|
||||
@example
|
||||
[in] split [splitout1][splitout2];
|
||||
[splitout1] crop=100:100:0:0 [cropout];
|
||||
[splitout2] pad=200:200:100:100 [padout];
|
||||
@end example
|
||||
|
||||
will create two separate outputs from the same input, one cropped and
|
||||
one padded.
|
||||
|
||||
@section transpose
|
||||
|
||||
Transpose rows with columns in the input video and optionally flip it.
|
||||
@ -1536,9 +1667,10 @@ This source is mainly intended for a programmatic use, in particular
|
||||
through the interface defined in @file{libavfilter/vsrc_buffer.h}.
|
||||
|
||||
It accepts the following parameters:
|
||||
@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}
|
||||
@var{width}:@var{height}:@var{pix_fmt_string}:@var{timebase_num}:@var{timebase_den}:@var{sample_aspect_ratio_num}:@var{sample_aspect_ratio.den}:@var{scale_params}
|
||||
|
||||
All the parameters need to be explicitely defined.
|
||||
All the parameters but @var{scale_params} need to be explicitely
|
||||
defined.
|
||||
|
||||
Follows the list of the accepted parameters.
|
||||
|
||||
@ -1559,6 +1691,11 @@ timestamps of the buffered frames.
|
||||
@item sample_aspect_ratio.num, sample_aspect_ratio.den
|
||||
Specify numerator and denominator of the sample aspect ratio assumed
|
||||
by the video frames.
|
||||
|
||||
@item scale_params
|
||||
Specify the optional parameters to be used for the scale filter which
|
||||
is automatically inserted when an input change is detected in the
|
||||
input size or format.
|
||||
@end table
|
||||
|
||||
For example:
|
||||
@ -1573,7 +1710,7 @@ Since the pixel format with name "yuv410p" corresponds to the number 6
|
||||
(check the enum PixelFormat definition in @file{libavutil/pixfmt.h}),
|
||||
this example corresponds to:
|
||||
@example
|
||||
buffer=320:240:6:1:24
|
||||
buffer=320:240:6:1:24:1:1
|
||||
@end example
|
||||
|
||||
@section color
|
||||
|
@ -284,8 +284,7 @@ following image formats are supported:
|
||||
@tab Digital Picture Exchange
|
||||
@item JPEG @tab X @tab X
|
||||
@tab Progressive JPEG is not supported.
|
||||
@item JPEG 2000 @tab @tab E
|
||||
@tab decoding supported through external library libopenjpeg
|
||||
@item JPEG 2000 @tab X @tab X
|
||||
@item JPEG-LS @tab X @tab X
|
||||
@item LJPEG @tab X @tab
|
||||
@tab Lossless JPEG
|
||||
@ -618,7 +617,7 @@ following image formats are supported:
|
||||
@tab Used in Origin's Wing Commander IV AVI files.
|
||||
@item DSP Group TrueSpeech @tab @tab X
|
||||
@item DV audio @tab @tab X
|
||||
@item Enhanced AC-3 @tab @tab X
|
||||
@item Enhanced AC-3 @tab X @tab X
|
||||
@item FLAC (Free Lossless Audio Codec) @tab X @tab IX
|
||||
@item GSM @tab E @tab X
|
||||
@tab encoding supported through external library libgsm
|
||||
@ -763,12 +762,6 @@ performance on systems without hardware floating point support).
|
||||
|
||||
Using a cross-compiler is preferred for various reasons.
|
||||
|
||||
@subsection DJGPP
|
||||
|
||||
FFmpeg cannot be compiled because of broken system headers, add
|
||||
@code{--extra-cflags=-U__STRICT_ANSI__} to the configure options as a
|
||||
workaround.
|
||||
|
||||
@section OS/2
|
||||
|
||||
For information about compiling FFmpeg on OS/2 see
|
||||
@ -844,18 +837,6 @@ are listed below:
|
||||
FFmpeg automatically passes @code{-fno-common} to the compiler to work around
|
||||
a GCC bug (see @url{http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37216}).
|
||||
|
||||
Within the MSYS shell, configure and make with:
|
||||
|
||||
@example
|
||||
./configure --enable-memalign-hack
|
||||
make
|
||||
make install
|
||||
@end example
|
||||
|
||||
This will install @file{ffmpeg.exe} along with many other development files
|
||||
to @file{/usr/local}. You may specify another install path using the
|
||||
@code{--prefix} option in @file{configure}.
|
||||
|
||||
Notes:
|
||||
|
||||
@itemize
|
||||
|
@ -210,4 +210,67 @@ Alternatively you can write the command as:
|
||||
ffmpeg -benchmark -i INPUT -f null -
|
||||
@end example
|
||||
|
||||
@section matroska
|
||||
|
||||
Matroska container muxer.
|
||||
|
||||
This muxer implements the matroska and webm container specs.
|
||||
|
||||
The recognized metadata settings in this muxer are:
|
||||
|
||||
@table @option
|
||||
|
||||
@item title=@var{title name}
|
||||
Name provided to a single track
|
||||
@end table
|
||||
|
||||
@table @option
|
||||
|
||||
@item language=@var{language name}
|
||||
Specifies the language of the track in the Matroska languages form
|
||||
@end table
|
||||
|
||||
@table @option
|
||||
|
||||
@item stereo_mode=@var{mode}
|
||||
Stereo 3D video layout of two views in a single video track
|
||||
@table @option
|
||||
@item mono
|
||||
video is not stereo
|
||||
@item left_right
|
||||
Both views are arranged side by side, Left-eye view is on the left
|
||||
@item bottom_top
|
||||
Both views are arranged in top-bottom orientation, Left-eye view is at bottom
|
||||
@item top_bottom
|
||||
Both views are arranged in top-bottom orientation, Left-eye view is on top
|
||||
@item checkerboard_rl
|
||||
Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
|
||||
@item checkerboard_lr
|
||||
Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
|
||||
@item row_interleaved_rl
|
||||
Each view is constituted by a row based interleaving, Right-eye view is first row
|
||||
@item row_interleaved_lr
|
||||
Each view is constituted by a row based interleaving, Left-eye view is first row
|
||||
@item col_interleaved_rl
|
||||
Both views are arranged in a column based interleaving manner, Right-eye view is first column
|
||||
@item col_interleaved_lr
|
||||
Both views are arranged in a column based interleaving manner, Left-eye view is first column
|
||||
@item anaglyph_cyan_red
|
||||
All frames are in anaglyph format viewable through red-cyan filters
|
||||
@item right_left
|
||||
Both views are arranged side by side, Right-eye view is on the left
|
||||
@item anaglyph_green_magenta
|
||||
All frames are in anaglyph format viewable through green-magenta filters
|
||||
@item block_lr
|
||||
Both eyes laced in one Block, Left-eye view is first
|
||||
@item block_rl
|
||||
Both eyes laced in one Block, Right-eye view is first
|
||||
@end table
|
||||
@end table
|
||||
|
||||
For example a 3D WebM clip can be created using the following command line:
|
||||
@example
|
||||
ffmpeg -i sample_left_right_clip.mpg -an -vcodec libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
|
||||
@end example
|
||||
|
||||
@c man end MUXERS
|
||||
|
@ -26,6 +26,46 @@ ALSA (Advanced Linux Sound Architecture) output device.
|
||||
|
||||
OSS (Open Sound System) output device.
|
||||
|
||||
@section sdl
|
||||
|
||||
SDL (Simple Directmedia Layer) output device.
|
||||
|
||||
This output devices allows to show a video stream in an SDL
|
||||
window. Only one SDL window is allowed per application, so you can
|
||||
have only one instance of this output device in an application.
|
||||
|
||||
To enable this output device you need libsdl installed on your system
|
||||
when configuring your build.
|
||||
|
||||
For more information about SDL, check:
|
||||
@url{http://www.libsdl.org/}
|
||||
|
||||
@subsection Options
|
||||
|
||||
@table @option
|
||||
|
||||
@item window_title
|
||||
Set the SDL window title, if not specified default to the filename
|
||||
specified for the output device.
|
||||
|
||||
@item icon_title
|
||||
Set the name of the iconified SDL window, if not specified it is set
|
||||
to the same value of @var{window_title}.
|
||||
|
||||
@item window_size
|
||||
Set the SDL 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.
|
||||
@end table
|
||||
|
||||
@subsection Examples
|
||||
|
||||
The following command shows the @file{ffmpeg} output is an
|
||||
SDL window, forcing its size to the qcif format:
|
||||
@example
|
||||
ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl "SDL output"
|
||||
@end example
|
||||
|
||||
@section sndio
|
||||
|
||||
sndio audio output device.
|
||||
|
175
ffplay.c
175
ffplay.c
@ -43,14 +43,10 @@
|
||||
# include "libavfilter/avfiltergraph.h"
|
||||
#endif
|
||||
|
||||
#include "cmdutils.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_thread.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#undef main /* We don't want SDL to override our main() */
|
||||
#endif
|
||||
#include "cmdutils.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <assert.h>
|
||||
@ -58,9 +54,6 @@
|
||||
const char program_name[] = "ffplay";
|
||||
const int program_birth_year = 2003;
|
||||
|
||||
//#define DEBUG
|
||||
//#define DEBUG_SYNC
|
||||
|
||||
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
|
||||
#define MIN_AUDIOQ_SIZE (20 * 16 * 1024)
|
||||
#define MIN_FRAMES 5
|
||||
@ -243,8 +236,6 @@ static int show_status = 1;
|
||||
static int av_sync_type = AV_SYNC_AUDIO_MASTER;
|
||||
static int64_t start_time = AV_NOPTS_VALUE;
|
||||
static int64_t duration = AV_NOPTS_VALUE;
|
||||
static int debug = 0;
|
||||
static int debug_mv = 0;
|
||||
static int step = 0;
|
||||
static int thread_count = 1;
|
||||
static int workaround_bugs = 1;
|
||||
@ -406,44 +397,6 @@ static inline void fill_rectangle(SDL_Surface *screen,
|
||||
SDL_FillRect(screen, &rect, color);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* draw only the border of a rectangle */
|
||||
void fill_border(VideoState *s, int x, int y, int w, int h, int color)
|
||||
{
|
||||
int w1, w2, h1, h2;
|
||||
|
||||
/* fill the background */
|
||||
w1 = x;
|
||||
if (w1 < 0)
|
||||
w1 = 0;
|
||||
w2 = s->width - (x + w);
|
||||
if (w2 < 0)
|
||||
w2 = 0;
|
||||
h1 = y;
|
||||
if (h1 < 0)
|
||||
h1 = 0;
|
||||
h2 = s->height - (y + h);
|
||||
if (h2 < 0)
|
||||
h2 = 0;
|
||||
fill_rectangle(screen,
|
||||
s->xleft, s->ytop,
|
||||
w1, s->height,
|
||||
color);
|
||||
fill_rectangle(screen,
|
||||
s->xleft + s->width - w2, s->ytop,
|
||||
w2, s->height,
|
||||
color);
|
||||
fill_rectangle(screen,
|
||||
s->xleft + w1, s->ytop,
|
||||
s->width - w1 - w2, h1,
|
||||
color);
|
||||
fill_rectangle(screen,
|
||||
s->xleft + w1, s->ytop + s->height - h2,
|
||||
s->width - w1 - w2, h2,
|
||||
color);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define ALPHA_BLEND(a, oldp, newp, s)\
|
||||
((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s))
|
||||
|
||||
@ -743,23 +696,12 @@ static void video_image_display(VideoState *is)
|
||||
}
|
||||
x = (is->width - width) / 2;
|
||||
y = (is->height - height) / 2;
|
||||
if (!is->no_background) {
|
||||
/* fill the background */
|
||||
// fill_border(is, x, y, width, height, QERGB(0x00, 0x00, 0x00));
|
||||
} else {
|
||||
is->no_background = 0;
|
||||
}
|
||||
is->no_background = 0;
|
||||
rect.x = is->xleft + x;
|
||||
rect.y = is->ytop + y;
|
||||
rect.w = FFMAX(width, 1);
|
||||
rect.h = FFMAX(height, 1);
|
||||
SDL_DisplayYUVOverlay(vp->bmp, &rect);
|
||||
} else {
|
||||
#if 0
|
||||
fill_rectangle(screen,
|
||||
is->xleft, is->ytop, is->width, is->height,
|
||||
QERGB(0x00, 0x00, 0x00));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1107,10 +1049,9 @@ static double compute_target_time(double frame_current_pts, VideoState *is)
|
||||
}
|
||||
}
|
||||
is->frame_timer += delay;
|
||||
#if defined(DEBUG_SYNC)
|
||||
printf("video: delay=%0.3f actual_delay=%0.3f pts=%0.3f A-V=%f\n",
|
||||
delay, actual_delay, frame_current_pts, -diff);
|
||||
#endif
|
||||
|
||||
av_dlog(NULL, "video: delay=%0.3f pts=%0.3f A-V=%f\n",
|
||||
delay, frame_current_pts, -diff);
|
||||
|
||||
return is->frame_timer;
|
||||
}
|
||||
@ -1487,7 +1428,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
|
||||
|
||||
static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt)
|
||||
{
|
||||
int len1, got_picture, i;
|
||||
int len1 av_unused, got_picture, i;
|
||||
|
||||
if (packet_queue_get(&is->videoq, pkt, 1) < 0)
|
||||
return -1;
|
||||
@ -1675,7 +1616,7 @@ static int input_request_frame(AVFilterLink *link)
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
if(priv->use_dr1) {
|
||||
if(priv->use_dr1 && priv->frame->opaque) {
|
||||
picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
|
||||
} else {
|
||||
picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
|
||||
@ -1754,8 +1695,8 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
goto the_end;
|
||||
|
||||
if(vfilters) {
|
||||
AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
|
||||
AVFilterInOut *inputs = av_malloc(sizeof(AVFilterInOut));
|
||||
AVFilterInOut *outputs = avfilter_inout_alloc();
|
||||
AVFilterInOut *inputs = avfilter_inout_alloc();
|
||||
|
||||
outputs->name = av_strdup("in");
|
||||
outputs->filter_ctx = filt_src;
|
||||
@ -1767,7 +1708,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
|
||||
inputs->pad_idx = 0;
|
||||
inputs->next = NULL;
|
||||
|
||||
if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0)
|
||||
if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0)
|
||||
goto the_end;
|
||||
av_freep(&vfilters);
|
||||
} else {
|
||||
@ -1789,7 +1730,7 @@ static int video_thread(void *arg)
|
||||
{
|
||||
VideoState *is = arg;
|
||||
AVFrame *frame= avcodec_alloc_frame();
|
||||
int64_t pts_int, pos;
|
||||
int64_t pts_int = AV_NOPTS_VALUE, pos = -1;
|
||||
double pts;
|
||||
int ret;
|
||||
|
||||
@ -1862,7 +1803,7 @@ static int subtitle_thread(void *arg)
|
||||
VideoState *is = arg;
|
||||
SubPicture *sp;
|
||||
AVPacket pkt1, *pkt = &pkt1;
|
||||
int len1, got_subtitle;
|
||||
int len1 av_unused, got_subtitle;
|
||||
double pts;
|
||||
int i, j;
|
||||
int r, g, b, y, u, v, a;
|
||||
@ -1899,8 +1840,6 @@ static int subtitle_thread(void *arg)
|
||||
len1 = avcodec_decode_subtitle2(is->subtitle_st->codec,
|
||||
&sp->sub, &got_subtitle,
|
||||
pkt);
|
||||
// if (len1 < 0)
|
||||
// break;
|
||||
if (got_subtitle && sp->sub.format == 0) {
|
||||
sp->pts = pts;
|
||||
|
||||
@ -1924,9 +1863,6 @@ static int subtitle_thread(void *arg)
|
||||
SDL_UnlockMutex(is->subpq_mutex);
|
||||
}
|
||||
av_free_packet(pkt);
|
||||
// if (step)
|
||||
// if (cur_stream)
|
||||
// stream_toggle_pause(cur_stream);
|
||||
}
|
||||
the_end:
|
||||
return 0;
|
||||
@ -2093,7 +2029,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
|
||||
n = 2 * dec->channels;
|
||||
is->audio_clock += (double)data_size /
|
||||
(double)(n * dec->sample_rate);
|
||||
#if defined(DEBUG_SYNC)
|
||||
#ifdef DEBUG
|
||||
{
|
||||
static double last_clock;
|
||||
printf("audio: delay=%0.3f clock=%0.3f pts=%0.3f\n",
|
||||
@ -2192,8 +2128,6 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
if (!codec)
|
||||
return -1;
|
||||
|
||||
avctx->debug_mv = debug_mv;
|
||||
avctx->debug = debug;
|
||||
avctx->workaround_bugs = workaround_bugs;
|
||||
avctx->lowres = lowres;
|
||||
if(lowres) avctx->flags |= CODEC_FLAG_EMU_EDGE;
|
||||
@ -2216,6 +2150,10 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
|
||||
/* prepare audio output */
|
||||
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
|
||||
if(avctx->sample_rate <= 0 || avctx->channels <= 0){
|
||||
fprintf(stderr, "Invalid sample rate or channel count\n");
|
||||
return -1;
|
||||
}
|
||||
wanted_spec.freq = avctx->sample_rate;
|
||||
wanted_spec.format = AUDIO_S16SYS;
|
||||
wanted_spec.channels = avctx->channels;
|
||||
@ -2254,8 +2192,6 @@ static int stream_component_open(VideoState *is, int stream_index)
|
||||
is->video_stream = stream_index;
|
||||
is->video_st = ic->streams[stream_index];
|
||||
|
||||
// is->video_current_pts_time = av_gettime();
|
||||
|
||||
packet_queue_init(&is->videoq);
|
||||
is->video_tid = SDL_CreateThread(video_thread, is);
|
||||
break;
|
||||
@ -2694,10 +2630,6 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
|
||||
static void toggle_full_screen(void)
|
||||
{
|
||||
is_full_screen = !is_full_screen;
|
||||
if (!fs_screen_width) {
|
||||
/* use default SDL method */
|
||||
// SDL_WM_ToggleFullScreen(screen);
|
||||
}
|
||||
video_open(cur_stream);
|
||||
}
|
||||
|
||||
@ -2877,16 +2809,17 @@ static void event_loop(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void opt_frame_size(const char *arg)
|
||||
static int opt_frame_size(const char *opt, const char *arg)
|
||||
{
|
||||
if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) {
|
||||
fprintf(stderr, "Incorrect frame size\n");
|
||||
exit(1);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if ((frame_width % 2) != 0 || (frame_height % 2) != 0) {
|
||||
fprintf(stderr, "Frame size must be a multiple of 2\n");
|
||||
exit(1);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_width(const char *opt, const char *arg)
|
||||
@ -2901,18 +2834,20 @@ static int opt_height(const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void opt_format(const char *arg)
|
||||
static int opt_format(const char *opt, const char *arg)
|
||||
{
|
||||
file_iformat = av_find_input_format(arg);
|
||||
if (!file_iformat) {
|
||||
fprintf(stderr, "Unknown input format: %s\n", arg);
|
||||
exit(1);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void opt_frame_pix_fmt(const char *arg)
|
||||
static int opt_frame_pix_fmt(const char *opt, const char *arg)
|
||||
{
|
||||
frame_pix_fmt = av_get_pix_fmt(arg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_sync(const char *opt, const char *arg)
|
||||
@ -2942,19 +2877,6 @@ static int opt_duration(const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_debug(const char *opt, const char *arg)
|
||||
{
|
||||
av_log_set_level(99);
|
||||
debug = parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_vismv(const char *opt, const char *arg)
|
||||
{
|
||||
debug_mv = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_thread_count(const char *opt, const char *arg)
|
||||
{
|
||||
thread_count= parse_number_or_die(opt, arg, OPT_INT64, 0, INT_MAX);
|
||||
@ -2973,10 +2895,23 @@ static int opt_show_mode(const char *opt, const char *arg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int opt_input_file(const char *opt, const char *filename)
|
||||
{
|
||||
if (input_filename) {
|
||||
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||
filename, input_filename);
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(filename, "-"))
|
||||
filename = "pipe:";
|
||||
input_filename = filename;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const OptionDef options[] = {
|
||||
#include "cmdutils_common_opts.h"
|
||||
{ "x", HAS_ARG | OPT_FUNC2, {(void*)opt_width}, "force displayed width", "width" },
|
||||
{ "y", HAS_ARG | OPT_FUNC2, {(void*)opt_height}, "force displayed height", "height" },
|
||||
{ "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
|
||||
{ "y", HAS_ARG, {(void*)opt_height}, "force displayed height", "height" },
|
||||
{ "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
|
||||
{ "fs", OPT_BOOL, {(void*)&is_full_screen}, "force full screen" },
|
||||
{ "an", OPT_BOOL, {(void*)&audio_disable}, "disable audio" },
|
||||
@ -2984,16 +2919,14 @@ static const OptionDef options[] = {
|
||||
{ "ast", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_AUDIO]}, "select desired audio stream", "stream_number" },
|
||||
{ "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_VIDEO]}, "select desired video stream", "stream_number" },
|
||||
{ "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_stream[AVMEDIA_TYPE_SUBTITLE]}, "select desired subtitle stream", "stream_number" },
|
||||
{ "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
|
||||
{ "t", HAS_ARG | OPT_FUNC2, {(void*)&opt_duration}, "play \"duration\" seconds of audio/video", "duration" },
|
||||
{ "ss", HAS_ARG, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
|
||||
{ "t", HAS_ARG, {(void*)&opt_duration}, "play \"duration\" seconds of audio/video", "duration" },
|
||||
{ "bytes", OPT_INT | HAS_ARG, {(void*)&seek_by_bytes}, "seek by bytes 0=off 1=on -1=auto", "val" },
|
||||
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
|
||||
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
|
||||
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
|
||||
{ "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
|
||||
{ "debug", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
|
||||
{ "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
|
||||
{ "vismv", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_vismv}, "visualize motion vectors", "" },
|
||||
{ "fast", OPT_BOOL | OPT_EXPERT, {(void*)&fast}, "non spec compliant optimizations", "" },
|
||||
{ "genpts", OPT_BOOL | OPT_EXPERT, {(void*)&genpts}, "generate pts", "" },
|
||||
{ "drp", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&decoder_reorder_pts}, "let decoder reorder pts 0=off 1=on -1=auto", ""},
|
||||
@ -3004,8 +2937,8 @@ static const OptionDef options[] = {
|
||||
{ "idct", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&idct}, "set idct algo", "algo" },
|
||||
{ "er", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_recognition}, "set error detection threshold (0-4)", "threshold" },
|
||||
{ "ec", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&error_concealment}, "set error concealment options", "bit_mask" },
|
||||
{ "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
|
||||
{ "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
|
||||
{ "sync", HAS_ARG | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
|
||||
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
|
||||
{ "autoexit", OPT_BOOL | OPT_EXPERT, {(void*)&autoexit}, "exit at the end", "" },
|
||||
{ "exitonkeydown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_keydown}, "exit on key down", "" },
|
||||
{ "exitonmousedown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_mousedown}, "exit on mouse down", "" },
|
||||
@ -3016,9 +2949,9 @@ static const OptionDef options[] = {
|
||||
{ "vf", OPT_STRING | HAS_ARG, {(void*)&vfilters}, "video filters", "filter list" },
|
||||
#endif
|
||||
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
|
||||
{ "showmode", HAS_ARG | OPT_FUNC2, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
|
||||
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
||||
{ "i", OPT_DUMMY, {NULL}, "ffmpeg compatibility dummy option", ""},
|
||||
{ "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
|
||||
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
||||
{ "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"},
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
@ -3063,18 +2996,6 @@ static void show_help(void)
|
||||
);
|
||||
}
|
||||
|
||||
static void opt_input_file(const char *filename)
|
||||
{
|
||||
if (input_filename) {
|
||||
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||
filename, input_filename);
|
||||
exit(1);
|
||||
}
|
||||
if (!strcmp(filename, "-"))
|
||||
filename = "pipe:";
|
||||
input_filename = filename;
|
||||
}
|
||||
|
||||
/* Called from the main */
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=0
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8
|
||||
me_method=hex
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=esa
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=hex
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=umh
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=1
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8
|
||||
me_method=umh
|
||||
|
@ -1,5 +1,5 @@
|
||||
coder=0
|
||||
flags=+loop
|
||||
flags=+loop+cgop
|
||||
cmp=+chroma
|
||||
partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8
|
||||
me_method=dia
|
||||
|
20
ffprobe.c
20
ffprobe.c
@ -25,6 +25,7 @@
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/opt.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "cmdutils.h"
|
||||
|
||||
@ -160,7 +161,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
|
||||
AVCodecContext *dec_ctx;
|
||||
AVCodec *dec;
|
||||
char val_str[128];
|
||||
AVMetadataTag *tag = NULL;
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
AVRational display_aspect_ratio;
|
||||
|
||||
printf("[STREAM]\n");
|
||||
@ -226,7 +227,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
|
||||
if (stream->nb_frames)
|
||||
printf("nb_frames=%"PRId64"\n", stream->nb_frames);
|
||||
|
||||
while ((tag = av_metadata_get(stream->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
|
||||
while ((tag = av_dict_get(stream->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
printf("TAG:%s=%s\n", tag->key, tag->value);
|
||||
|
||||
printf("[/STREAM]\n");
|
||||
@ -234,7 +235,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
|
||||
|
||||
static void show_format(AVFormatContext *fmt_ctx)
|
||||
{
|
||||
AVMetadataTag *tag = NULL;
|
||||
AVDictionaryEntry *tag = NULL;
|
||||
char val_str[128];
|
||||
|
||||
printf("[FORMAT]\n");
|
||||
@ -252,7 +253,7 @@ static void show_format(AVFormatContext *fmt_ctx)
|
||||
printf("bit_rate=%s\n", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate,
|
||||
unit_bit_per_second_str));
|
||||
|
||||
while ((tag = av_metadata_get(fmt_ctx->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX)))
|
||||
while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
printf("TAG:%s=%s\n", tag->key, tag->value);
|
||||
|
||||
printf("[/FORMAT]\n");
|
||||
@ -329,16 +330,17 @@ static void show_usage(void)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void opt_format(const char *arg)
|
||||
static int opt_format(const char *opt, const char *arg)
|
||||
{
|
||||
iformat = av_find_input_format(arg);
|
||||
if (!iformat) {
|
||||
fprintf(stderr, "Unknown input format: %s\n", arg);
|
||||
exit(1);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void opt_input_file(const char *arg)
|
||||
static int opt_input_file(const char *opt, const char *arg)
|
||||
{
|
||||
if (input_filename) {
|
||||
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
|
||||
@ -348,6 +350,7 @@ static void opt_input_file(const char *arg)
|
||||
if (!strcmp(arg, "-"))
|
||||
arg = "pipe:";
|
||||
input_filename = arg;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void show_help(void)
|
||||
@ -382,7 +385,8 @@ static const OptionDef options[] = {
|
||||
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
|
||||
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
|
||||
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
|
||||
{ "default", OPT_FUNC2 | HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
||||
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
|
||||
{ "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"},
|
||||
{ NULL, },
|
||||
};
|
||||
|
||||
|
32
ffserver.c
32
ffserver.c
@ -36,6 +36,7 @@
|
||||
#include "libavformat/avio_internal.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/random_seed.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "libavcodec/opt.h"
|
||||
@ -856,7 +857,7 @@ static void close_connection(HTTPContext *c)
|
||||
ctx = c->rtp_ctx[i];
|
||||
if (ctx) {
|
||||
av_write_trailer(ctx);
|
||||
av_metadata_free(&ctx->metadata);
|
||||
av_dict_free(&ctx->metadata);
|
||||
av_free(ctx->streams[0]);
|
||||
av_free(ctx);
|
||||
}
|
||||
@ -1762,7 +1763,7 @@ static int http_parse_request(HTTPContext *c)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WMP
|
||||
#ifdef DEBUG
|
||||
http_log("\nGot request:\n%s\n", c->buffer);
|
||||
#endif
|
||||
|
||||
@ -1792,7 +1793,7 @@ static int http_parse_request(HTTPContext *c)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_WMP
|
||||
#ifdef DEBUG
|
||||
if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
|
||||
http_log("\nGot request:\n%s\n", c->buffer);
|
||||
#endif
|
||||
@ -2226,10 +2227,10 @@ static int http_prepare_data(HTTPContext *c)
|
||||
switch(c->state) {
|
||||
case HTTPSTATE_SEND_DATA_HEADER:
|
||||
memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx));
|
||||
av_metadata_set2(&c->fmt_ctx.metadata, "author" , c->stream->author , 0);
|
||||
av_metadata_set2(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0);
|
||||
av_metadata_set2(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
|
||||
av_metadata_set2(&c->fmt_ctx.metadata, "title" , c->stream->title , 0);
|
||||
av_dict_set(&c->fmt_ctx.metadata, "author" , c->stream->author , 0);
|
||||
av_dict_set(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0);
|
||||
av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0);
|
||||
av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0);
|
||||
|
||||
for(i=0;i<c->stream->nb_streams;i++) {
|
||||
AVStream *st;
|
||||
@ -2274,7 +2275,7 @@ static int http_prepare_data(HTTPContext *c)
|
||||
http_log("Error writing output header\n");
|
||||
return -1;
|
||||
}
|
||||
av_metadata_free(&c->fmt_ctx.metadata);
|
||||
av_dict_free(&c->fmt_ctx.metadata);
|
||||
|
||||
len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
|
||||
c->buffer_ptr = c->pb_buffer;
|
||||
@ -2929,8 +2930,8 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer,
|
||||
if (avc == NULL) {
|
||||
return -1;
|
||||
}
|
||||
av_metadata_set2(&avc->metadata, "title",
|
||||
stream->title[0] ? stream->title : "No Title", 0);
|
||||
av_dict_set(&avc->metadata, "title",
|
||||
stream->title[0] ? stream->title : "No Title", 0);
|
||||
avc->nb_streams = stream->nb_streams;
|
||||
if (stream->is_multicast) {
|
||||
snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d",
|
||||
@ -3280,7 +3281,6 @@ static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h
|
||||
static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h)
|
||||
{
|
||||
HTTPContext *rtp_c;
|
||||
char session_id[32];
|
||||
|
||||
rtp_c = find_rtp_session_with_url(url, h->session_id);
|
||||
if (!rtp_c) {
|
||||
@ -3288,16 +3288,14 @@ static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader
|
||||
return;
|
||||
}
|
||||
|
||||
av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id));
|
||||
|
||||
/* abort the session */
|
||||
close_connection(rtp_c);
|
||||
|
||||
/* now everything is OK, so we can send the connection parameters */
|
||||
rtsp_reply_header(c, RTSP_STATUS_OK);
|
||||
/* session ID */
|
||||
avio_printf(c->pb, "Session: %s\r\n", session_id);
|
||||
avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id);
|
||||
avio_printf(c->pb, "\r\n");
|
||||
|
||||
/* abort the session */
|
||||
close_connection(rtp_c);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Jaikrishnan Menon
|
||||
* Copyright (C) 2011 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
@ -38,62 +39,155 @@
|
||||
|
||||
/** decoder context */
|
||||
typedef struct EightSvxContext {
|
||||
int16_t fib_acc;
|
||||
const int16_t *table;
|
||||
const int8_t *table;
|
||||
|
||||
/* buffer used to store the whole audio decoded/interleaved chunk,
|
||||
* which is sent with the first packet */
|
||||
uint8_t *samples;
|
||||
size_t samples_size;
|
||||
int samples_idx;
|
||||
} EightSvxContext;
|
||||
|
||||
static const int16_t fibonacci[16] = { -34<<8, -21<<8, -13<<8, -8<<8, -5<<8, -3<<8, -2<<8, -1<<8,
|
||||
0, 1<<8, 2<<8, 3<<8, 5<<8, 8<<8, 13<<8, 21<<8 };
|
||||
static const int16_t exponential[16] = { -128<<8, -64<<8, -32<<8, -16<<8, -8<<8, -4<<8, -2<<8, -1<<8,
|
||||
0, 1<<8, 2<<8, 4<<8, 8<<8, 16<<8, 32<<8, 64<<8 };
|
||||
static const int8_t fibonacci[16] = { -34, -21, -13, -8, -5, -3, -2, -1, 0, 1, 2, 3, 5, 8, 13, 21 };
|
||||
static const int8_t exponential[16] = { -128, -64, -32, -16, -8, -4, -2, -1, 0, 1, 2, 4, 8, 16, 32, 64 };
|
||||
|
||||
#define MAX_FRAME_SIZE 2048
|
||||
|
||||
/**
|
||||
* Interleave samples in buffer containing all left channel samples
|
||||
* at the beginning, and right channel samples at the end.
|
||||
* Each sample is assumed to be in signed 8-bit format.
|
||||
*
|
||||
* @param size the size in bytes of the dst and src buffer
|
||||
*/
|
||||
static void interleave_stereo(uint8_t *dst, const uint8_t *src, int size)
|
||||
{
|
||||
uint8_t *dst_end = dst + size;
|
||||
size = size>>1;
|
||||
|
||||
while (dst < dst_end) {
|
||||
*dst++ = *src;
|
||||
*dst++ = *(src+size);
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delta decode the compressed values in src, and put the resulting
|
||||
* decoded n samples in dst.
|
||||
*
|
||||
* @param val starting value assumed by the delta sequence
|
||||
* @param table delta sequence table
|
||||
* @return size in bytes of the decoded data, must be src_size*2
|
||||
*/
|
||||
static int delta_decode(int8_t *dst, const uint8_t *src, int src_size,
|
||||
int8_t val, const int8_t *table)
|
||||
{
|
||||
int n = src_size;
|
||||
int8_t *dst0 = dst;
|
||||
|
||||
while (n--) {
|
||||
uint8_t d = *src++;
|
||||
val = av_clip(val + table[d & 0x0f], -127, 128);
|
||||
*dst++ = val;
|
||||
val = av_clip(val + table[d >> 4] , -127, 128);
|
||||
*dst++ = val;
|
||||
}
|
||||
|
||||
return dst-dst0;
|
||||
}
|
||||
|
||||
static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||
AVPacket *avpkt)
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
int16_t *out_data = data;
|
||||
int consumed = buf_size;
|
||||
const uint8_t *buf_end = buf + buf_size;
|
||||
int out_data_size, n;
|
||||
uint8_t *src, *dst;
|
||||
|
||||
if((*data_size >> 2) < buf_size)
|
||||
return -1;
|
||||
/* decode and interleave the first packet */
|
||||
if (!esc->samples && avpkt) {
|
||||
uint8_t *deinterleaved_samples;
|
||||
|
||||
if(avctx->frame_number == 0) {
|
||||
esc->fib_acc = buf[1] << 8;
|
||||
buf_size -= 2;
|
||||
buf += 2;
|
||||
esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW ?
|
||||
avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2;
|
||||
if (!(esc->samples = av_malloc(esc->samples_size)))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* decompress */
|
||||
if (avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP) {
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
int n = esc->samples_size;
|
||||
|
||||
if (!(deinterleaved_samples = av_mallocz(n)))
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* the uncompressed starting value is contained in the first byte */
|
||||
if (avctx->channels == 2) {
|
||||
delta_decode(deinterleaved_samples , buf+1, buf_size/2-1, buf[0], esc->table);
|
||||
buf += buf_size/2;
|
||||
delta_decode(deinterleaved_samples+n/2-1, buf+1, buf_size/2-1, buf[0], esc->table);
|
||||
} else
|
||||
delta_decode(deinterleaved_samples , buf+1, buf_size-1 , buf[0], esc->table);
|
||||
} else {
|
||||
deinterleaved_samples = avpkt->data;
|
||||
}
|
||||
|
||||
if (avctx->channels == 2)
|
||||
interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size);
|
||||
else
|
||||
memcpy(esc->samples, deinterleaved_samples, esc->samples_size);
|
||||
}
|
||||
|
||||
*data_size = buf_size << 2;
|
||||
|
||||
while(buf < buf_end) {
|
||||
uint8_t d = *buf++;
|
||||
esc->fib_acc += esc->table[d & 0x0f];
|
||||
*out_data++ = esc->fib_acc;
|
||||
esc->fib_acc += esc->table[d >> 4];
|
||||
*out_data++ = esc->fib_acc;
|
||||
/* return single packed with fixed size */
|
||||
out_data_size = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx);
|
||||
if (*data_size < out_data_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Provided buffer with size %d is too small.\n", *data_size);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return consumed;
|
||||
*data_size = out_data_size;
|
||||
dst = data;
|
||||
src = esc->samples + esc->samples_idx;
|
||||
for (n = out_data_size; n > 0; n--)
|
||||
*dst++ = *src++ + 128;
|
||||
esc->samples_idx += *data_size;
|
||||
|
||||
return avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP ?
|
||||
(avctx->frame_number == 0)*2 + out_data_size / 2 :
|
||||
out_data_size;
|
||||
}
|
||||
|
||||
static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
|
||||
switch(avctx->codec->id) {
|
||||
case CODEC_ID_8SVX_FIB:
|
||||
esc->table = fibonacci;
|
||||
break;
|
||||
case CODEC_ID_8SVX_EXP:
|
||||
esc->table = exponential;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
if (avctx->channels > 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
|
||||
switch (avctx->codec->id) {
|
||||
case CODEC_ID_8SVX_FIB: esc->table = fibonacci; break;
|
||||
case CODEC_ID_8SVX_EXP: esc->table = exponential; break;
|
||||
case CODEC_ID_8SVX_RAW: esc->table = NULL; break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_U8;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static av_cold int eightsvx_decode_close(AVCodecContext *avctx)
|
||||
{
|
||||
EightSvxContext *esc = avctx->priv_data;
|
||||
|
||||
av_freep(&esc->samples);
|
||||
esc->samples_size = 0;
|
||||
esc->samples_idx = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -104,6 +198,7 @@ AVCodec ff_eightsvx_fib_decoder = {
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
.close = eightsvx_decode_close,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
|
||||
};
|
||||
|
||||
@ -114,5 +209,17 @@ AVCodec ff_eightsvx_exp_decoder = {
|
||||
.priv_data_size = sizeof (EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
.close = eightsvx_decode_close,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"),
|
||||
};
|
||||
|
||||
AVCodec ff_eightsvx_raw_decoder = {
|
||||
.name = "8svx_raw",
|
||||
.type = AVMEDIA_TYPE_AUDIO,
|
||||
.id = CODEC_ID_8SVX_RAW,
|
||||
.priv_data_size = sizeof(EightSvxContext),
|
||||
.init = eightsvx_decode_init,
|
||||
.decode = eightsvx_decode_frame,
|
||||
.close = eightsvx_decode_close,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("8SVX rawaudio"),
|
||||
};
|
||||
|
@ -19,6 +19,7 @@ OBJS = allcodecs.o \
|
||||
options.o \
|
||||
parser.o \
|
||||
raw.o \
|
||||
rawdec.o \
|
||||
resample.o \
|
||||
resample2.o \
|
||||
simple_idct.o \
|
||||
@ -29,7 +30,7 @@ OBJS-$(CONFIG_AANDCT) += aandcttab.o
|
||||
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
|
||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
|
||||
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o
|
||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
|
||||
OBJS-$(CONFIG_DWT) += dwt.o
|
||||
OBJS-$(CONFIG_DXVA2) += dxva2.o
|
||||
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o
|
||||
@ -42,6 +43,9 @@ OBJS-$(CONFIG_HUFFMAN) += huffman.o
|
||||
OBJS-$(CONFIG_LPC) += lpc.o
|
||||
OBJS-$(CONFIG_LSP) += lsp.o
|
||||
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o
|
||||
OBJS-$(CONFIG_MPEGAUDIODSP) += mpegaudiodsp.o \
|
||||
mpegaudiodsp_fixed.o \
|
||||
mpegaudiodsp_float.o
|
||||
RDFT-OBJS-$(CONFIG_HARDCODED_TABLES) += sin_tables.o
|
||||
OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
|
||||
OBJS-$(CONFIG_SINEWIN) += sinewin.o
|
||||
@ -59,9 +63,9 @@ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
|
||||
mpeg4audio.o kbdwin.o
|
||||
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
|
||||
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_combined.o ac3enc_fixed.o ac3enc_float.o ac3tab.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FLOAT_ENCODER) += ac3enc_float.o ac3tab.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3.o
|
||||
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_combined.o ac3enc_fixed.o ac3enc_float.o ac3tab.o ac3.o kbdwin.o ac3enc.o
|
||||
OBJS-$(CONFIG_AC3_FLOAT_ENCODER) += ac3enc_float.o ac3tab.o ac3tab.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_AC3_FIXED_ENCODER) += ac3enc_fixed.o ac3tab.o ac3tab.o ac3.o ac3enc.o
|
||||
OBJS-$(CONFIG_ALAC_DECODER) += alac.o
|
||||
OBJS-$(CONFIG_ALAC_ENCODER) += alacenc.o
|
||||
OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o
|
||||
@ -125,6 +129,8 @@ OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o
|
||||
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o
|
||||
OBJS-$(CONFIG_DXA_DECODER) += dxa.o
|
||||
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3dec_data.o
|
||||
OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o ac3enc.o ac3enc_float.o \
|
||||
ac3tab.o ac3.o kbdwin.o
|
||||
OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o
|
||||
OBJS-$(CONFIG_EAMAD_DECODER) += eamad.o eaidct.o mpeg12.o \
|
||||
mpeg12data.o mpegvideo.o \
|
||||
@ -137,6 +143,7 @@ OBJS-$(CONFIG_EATQI_DECODER) += eatqi.o eaidct.o mpeg12.o \
|
||||
OBJS-$(CONFIG_EIGHTBPS_DECODER) += 8bps.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_EXP_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_EIGHTSVX_RAW_DECODER) += 8svx.o
|
||||
OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o
|
||||
OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o
|
||||
OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o
|
||||
@ -171,7 +178,7 @@ OBJS-$(CONFIG_H263_ENCODER) += mpegvideo_enc.o mpeg4video.o \
|
||||
ratecontrol.o h263.o ituh263enc.o \
|
||||
flvenc.o mpeg12data.o \
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_H264_DECODER) += h264.o h264_hl_motion.o \
|
||||
OBJS-$(CONFIG_H264_DECODER) += h264.o \
|
||||
h264_loopfilter.o h264_direct.o \
|
||||
cabac.o h264_sei.o h264_ps.o \
|
||||
h264_refs.o h264_cavlc.o h264_cabac.o\
|
||||
@ -189,6 +196,8 @@ OBJS-$(CONFIG_INDEO3_DECODER) += indeo3.o
|
||||
OBJS-$(CONFIG_INDEO5_DECODER) += indeo5.o ivi_common.o ivi_dsp.o
|
||||
OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER) += dpcm.o
|
||||
OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
|
||||
OBJS-$(CONFIG_JPEG2000_DECODER) += j2kdec.o mqcdec.o mqc.o j2k.o j2k_dwt.o
|
||||
#OBJS-$(CONFIG_JPEG2000_ENCODER) += j2kenc.o mqcenc.o mqc.o j2k.o j2k_dwt.o
|
||||
OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \
|
||||
mjpegdec.o mjpeg.o
|
||||
OBJS-$(CONFIG_JPEGLS_ENCODER) += jpeglsenc.o jpegls.o
|
||||
@ -264,8 +273,6 @@ OBJS-$(CONFIG_MPEG2VIDEO_ENCODER) += mpeg12enc.o mpegvideo_enc.o \
|
||||
mpegvideo.o error_resilience.o
|
||||
OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
|
||||
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o
|
||||
OBJS-$(CONFIG_MSMPEG4V1_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
|
||||
h263.o ituh263dec.o mpeg4videodec.o
|
||||
OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \
|
||||
h263.o ituh263dec.o mpeg4videodec.o
|
||||
OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
|
||||
@ -362,7 +369,7 @@ OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
|
||||
mpegvideo.o error_resilience.o \
|
||||
ituh263enc.o mpegvideo_enc.o \
|
||||
ratecontrol.o mpeg12data.o
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o h264_hl_motion.o \
|
||||
OBJS-$(CONFIG_SVQ3_DECODER) += h264.o svq3.o \
|
||||
h264_loopfilter.o h264_direct.o \
|
||||
h264_sei.o h264_ps.o h264_refs.o \
|
||||
h264_cavlc.o h264_cabac.o cabac.o \
|
||||
@ -553,7 +560,7 @@ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
|
||||
dirac.o mpeg12data.o vorbis_data.o
|
||||
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpegvideo.o xiph.o
|
||||
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
|
||||
OBJS-$(CONFIG_SPDIF_DEMUXER) += aacadtsdec.o mpeg4audio.o
|
||||
OBJS-$(CONFIG_WEBM_MUXER) += xiph.o mpeg4audio.o \
|
||||
flacdec.o flacdata.o flac.o \
|
||||
@ -606,7 +613,7 @@ OBJS-$(CONFIG_FLAC_PARSER) += flac_parser.o flacdata.o flac.o \
|
||||
vorbis_data.o
|
||||
OBJS-$(CONFIG_H261_PARSER) += h261_parser.o
|
||||
OBJS-$(CONFIG_H263_PARSER) += h263_parser.o
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o h264_hl_motion.o \
|
||||
OBJS-$(CONFIG_H264_PARSER) += h264_parser.o h264.o \
|
||||
cabac.o \
|
||||
h264_refs.o h264_sei.o h264_direct.o \
|
||||
h264_loopfilter.o h264_cabac.o \
|
||||
@ -662,39 +669,40 @@ OBJS-$(!CONFIG_SMALL) += inverse.o
|
||||
|
||||
-include $(SUBDIR)$(ARCH)/Makefile
|
||||
|
||||
SKIPHEADERS = %_tablegen.h
|
||||
SKIPHEADERS += %_tablegen.h \
|
||||
%_tables.h \
|
||||
aac_tablegen_decl.h \
|
||||
fft-internal.h \
|
||||
tableprint.h \
|
||||
$(ARCH)/vp56_arith.h
|
||||
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
|
||||
SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h
|
||||
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
|
||||
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
|
||||
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
|
||||
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
|
||||
SKIPHEADERS += mpegaudio3.h
|
||||
|
||||
EXAMPLES = api
|
||||
|
||||
TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
|
||||
TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow
|
||||
TESTPROGS-$(HAVE_MMX) += motion
|
||||
TESTOBJS = dctref.o
|
||||
|
||||
HOSTPROGS = costablegen
|
||||
HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \
|
||||
dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
|
||||
pcm_tablegen qdm2_tablegen sinewin_tablegen
|
||||
|
||||
DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
|
||||
|
||||
CLEANFILES = sin_tables.c cos_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
|
||||
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)
|
||||
|
||||
include $(SUBDIR)../subdir.mak
|
||||
|
||||
$(SUBDIR)dct-test$(EXESUF): $(SUBDIR)dctref.o
|
||||
|
||||
$(SUBDIR)cos_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
|
||||
$(M)./$< > $@
|
||||
TRIG_TABLES = cos cos_fixed sin
|
||||
TRIG_TABLES := $(TRIG_TABLES:%=$(SUBDIR)%_tables.c)
|
||||
|
||||
$(SUBDIR)cos_fixed_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
|
||||
$(M)./$< cos fixed > $@
|
||||
|
||||
$(SUBDIR)sin_tables.c: $(SUBDIR)costablegen$(HOSTEXESUF)
|
||||
$(M)./$< sin > $@
|
||||
$(TRIG_TABLES): $(SUBDIR)%_tables.c: $(SUBDIR)cos_tablegen$(HOSTEXESUF)
|
||||
$(M)./$< $* > $@
|
||||
|
||||
ifdef CONFIG_SMALL
|
||||
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=1
|
||||
@ -702,9 +710,6 @@ else
|
||||
$(SUBDIR)%_tablegen$(HOSTEXESUF): HOSTCFLAGS += -DCONFIG_SMALL=0
|
||||
endif
|
||||
|
||||
$(SUBDIR)%_tablegen$(HOSTEXESUF): $(SUBDIR)%_tablegen.c $(SUBDIR)%_tablegen.h $(SUBDIR)tableprint.c
|
||||
$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(filter %.c,$^) $(HOSTLIBS)
|
||||
|
||||
GEN_HEADERS = cbrt_tables.h aacps_tables.h aac_tables.h dv_tables.h \
|
||||
sinewin_tables.h mpegaudio_tables.h motionpixels_tables.h \
|
||||
pcm_tables.h qdm2_tables.h
|
||||
|
@ -252,7 +252,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
|
||||
int b_width;
|
||||
|
||||
int req_size;
|
||||
int num_frames = c->mc_lifetime;
|
||||
|
||||
int *charmap = c->mc_charmap;
|
||||
uint8_t *colram = c->mc_colram;
|
||||
@ -280,7 +279,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
|
||||
if (!c->mc_lifetime) return 0;
|
||||
/* no more frames in queue, prepare to flush remaining frames */
|
||||
if (!c->mc_frame_counter) {
|
||||
num_frames = c->mc_lifetime;
|
||||
c->mc_lifetime = 0;
|
||||
}
|
||||
/* still frames in queue so limit lifetime to remaining frames */
|
||||
|
@ -227,7 +227,7 @@ typedef struct {
|
||||
DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT
|
||||
DECLARE_ALIGNED(32, float, saved)[1024]; ///< overlap
|
||||
DECLARE_ALIGNED(32, float, ret)[2048]; ///< PCM output
|
||||
DECLARE_ALIGNED(16, int16_t, ltp_state)[3072]; ///< time signal for LTP
|
||||
DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP
|
||||
PredictorState predictor_state[MAX_PREDICTORS];
|
||||
} SingleChannelElement;
|
||||
|
||||
|
@ -20,8 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AAC_TABLEGEN_H
|
||||
#define AAC_TABLEGEN_H
|
||||
#ifndef AVCODEC_AAC_TABLEGEN_H
|
||||
#define AVCODEC_AAC_TABLEGEN_H
|
||||
|
||||
#include "aac_tablegen_decl.h"
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "libavcodec/aac_tables.h"
|
||||
#else
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavcodec/aac.h"
|
||||
#include "aac.h"
|
||||
float ff_aac_pow2sf_tab[428];
|
||||
|
||||
void ff_aac_tableinit(void)
|
||||
@ -40,4 +40,4 @@ void ff_aac_tableinit(void)
|
||||
}
|
||||
#endif /* CONFIG_HARDCODED_TABLES */
|
||||
|
||||
#endif /* AAC_TABLEGEN_H */
|
||||
#endif /* AVCODEC_AAC_TABLEGEN_H */
|
||||
|
@ -20,8 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AAC_TABLEGEN_DECL_H
|
||||
#define AAC_TABLEGEN_DECL_H
|
||||
#ifndef AVCODEC_AAC_TABLEGEN_DECL_H
|
||||
#define AVCODEC_AAC_TABLEGEN_DECL_H
|
||||
|
||||
#if CONFIG_HARDCODED_TABLES
|
||||
#define ff_aac_tableinit()
|
||||
@ -31,4 +31,4 @@ void ff_aac_tableinit(void);
|
||||
extern float ff_aac_pow2sf_tab[428];
|
||||
#endif /* CONFIG_HARDCODED_TABLES */
|
||||
|
||||
#endif /* AAC_TABLEGEN_DECL_H */
|
||||
#endif /* AVCODEC_AAC_TABLEGEN_DECL_H */
|
||||
|
@ -312,7 +312,7 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
|
||||
int win, int group_len, const float lambda)
|
||||
{
|
||||
BandCodingPath path[120][12];
|
||||
int w, swb, cb, start, start2, size;
|
||||
int w, swb, cb, start, size;
|
||||
int i, j;
|
||||
const int max_sfb = sce->ics.max_sfb;
|
||||
const int run_bits = sce->ics.num_windows == 1 ? 5 : 3;
|
||||
@ -330,7 +330,6 @@ static void encode_window_bands_info(AACEncContext *s, SingleChannelElement *sce
|
||||
path[0][cb].run = 0;
|
||||
}
|
||||
for (swb = 0; swb < max_sfb; swb++) {
|
||||
start2 = start;
|
||||
size = sce->ics.swb_sizes[swb];
|
||||
if (sce->zeroes[win*16 + swb]) {
|
||||
for (cb = 0; cb < 12; cb++) {
|
||||
@ -414,7 +413,7 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
|
||||
int win, int group_len, const float lambda)
|
||||
{
|
||||
BandCodingPath path[120][12];
|
||||
int w, swb, cb, start, start2, size;
|
||||
int w, swb, cb, start, size;
|
||||
int i, j;
|
||||
const int max_sfb = sce->ics.max_sfb;
|
||||
const int run_bits = sce->ics.num_windows == 1 ? 5 : 3;
|
||||
@ -432,7 +431,6 @@ static void codebook_trellis_rate(AACEncContext *s, SingleChannelElement *sce,
|
||||
path[0][cb].run = 0;
|
||||
}
|
||||
for (swb = 0; swb < max_sfb; swb++) {
|
||||
start2 = start;
|
||||
size = sce->ics.swb_sizes[swb];
|
||||
if (sce->zeroes[win*16 + swb]) {
|
||||
for (cb = 0; cb < 12; cb++) {
|
||||
@ -1007,12 +1005,11 @@ static void search_for_quantizers_fast(AVCodecContext *avctx, AACEncContext *s,
|
||||
SingleChannelElement *sce,
|
||||
const float lambda)
|
||||
{
|
||||
int start = 0, i, w, w2, g;
|
||||
int i, w, w2, g;
|
||||
int minq = 255;
|
||||
|
||||
memset(sce->sf_idx, 0, sizeof(sce->sf_idx));
|
||||
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
|
||||
start = w*128;
|
||||
for (g = 0; g < sce->ics.num_swb; g++) {
|
||||
for (w2 = 0; w2 < sce->ics.group_len[w]; w2++) {
|
||||
FFPsyBand *band = &s->psy.psy_bands[s->cur_channel*PSY_MAX_BANDS+(w+w2)*16+g];
|
||||
|
@ -186,7 +186,7 @@ static av_cold int che_configure(AACContext *ac,
|
||||
if (che_pos[type][id]) {
|
||||
if (!ac->che[type][id] && !(ac->che[type][id] = av_mallocz(sizeof(ChannelElement))))
|
||||
return AVERROR(ENOMEM);
|
||||
ff_aac_sbr_ctx_init(&ac->che[type][id]->sbr);
|
||||
ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr);
|
||||
if (type != TYPE_CCE) {
|
||||
ac->output_data[(*channels)++] = ac->che[type][id]->ch[0].ret;
|
||||
if (type == TYPE_CPE ||
|
||||
@ -251,8 +251,6 @@ static av_cold int output_configure(AACContext *ac,
|
||||
}
|
||||
|
||||
memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0]));
|
||||
|
||||
avctx->channel_layout = 0;
|
||||
}
|
||||
|
||||
avctx->channels = channels;
|
||||
@ -550,6 +548,7 @@ static void reset_predictor_group(PredictorState *ps, int group_num)
|
||||
static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AACContext *ac = avctx->priv_data;
|
||||
float output_scale_factor;
|
||||
|
||||
ac->avctx = avctx;
|
||||
ac->m4ac.sample_rate = avctx->sample_rate;
|
||||
@ -561,8 +560,13 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
|
||||
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
|
||||
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
output_scale_factor = 1.0 / 32768.0;
|
||||
} else {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
output_scale_factor = 1.0;
|
||||
}
|
||||
|
||||
AAC_INIT_VLC_STATIC( 0, 304);
|
||||
AAC_INIT_VLC_STATIC( 1, 270);
|
||||
@ -590,9 +594,9 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
|
||||
ff_aac_scalefactor_code, sizeof(ff_aac_scalefactor_code[0]), sizeof(ff_aac_scalefactor_code[0]),
|
||||
352);
|
||||
|
||||
ff_mdct_init(&ac->mdct, 11, 1, 1.0/1024.0);
|
||||
ff_mdct_init(&ac->mdct_small, 8, 1, 1.0/128.0);
|
||||
ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0);
|
||||
ff_mdct_init(&ac->mdct, 11, 1, output_scale_factor/1024.0);
|
||||
ff_mdct_init(&ac->mdct_small, 8, 1, output_scale_factor/128.0);
|
||||
ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0/output_scale_factor);
|
||||
// window initialization
|
||||
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
|
||||
ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128);
|
||||
@ -818,7 +822,7 @@ static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
|
||||
else
|
||||
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
|
||||
clipped_offset = av_clip(offset[1], -100, 155);
|
||||
if (offset[2] != clipped_offset) {
|
||||
if (offset[1] != clipped_offset) {
|
||||
av_log_ask_for_sample(ac->avctx, "Noise gain clipped "
|
||||
"(%d -> %d).\nIf you heard an audible "
|
||||
"artifact, there may be a bug in the decoder. ",
|
||||
@ -1825,9 +1829,9 @@ static void update_ltp(AACContext *ac, SingleChannelElement *sce)
|
||||
saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i];
|
||||
}
|
||||
|
||||
memcpy(sce->ltp_state, &sce->ltp_state[1024], 1024 * sizeof(int16_t));
|
||||
ac->fmt_conv.float_to_int16(&(sce->ltp_state[1024]), sce->ret, 1024);
|
||||
ac->fmt_conv.float_to_int16(&(sce->ltp_state[2048]), saved_ltp, 1024);
|
||||
memcpy(sce->ltp_state, sce->ltp_state+1024, 1024 * sizeof(*sce->ltp_state));
|
||||
memcpy(sce->ltp_state+1024, sce->ret, 1024 * sizeof(*sce->ltp_state));
|
||||
memcpy(sce->ltp_state+2048, saved_ltp, 1024 * sizeof(*sce->ltp_state));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2174,8 +2178,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
avctx->frame_size = samples;
|
||||
}
|
||||
|
||||
data_size_tmp = samples * avctx->channels;
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(float) : sizeof(int16_t);
|
||||
data_size_tmp = samples * avctx->channels *
|
||||
(av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
|
||||
if (*data_size < data_size_tmp) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
|
||||
@ -2185,10 +2189,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data,
|
||||
*data_size = data_size_tmp;
|
||||
|
||||
if (samples) {
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
float_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
||||
} else
|
||||
ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data, samples, avctx->channels);
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
|
||||
ac->fmt_conv.float_interleave(data, (const float **)ac->output_data,
|
||||
samples, avctx->channels);
|
||||
else
|
||||
ac->fmt_conv.float_to_int16_interleave(data, (const float **)ac->output_data,
|
||||
samples, avctx->channels);
|
||||
}
|
||||
|
||||
if (ac->output_configured)
|
||||
@ -2460,6 +2466,7 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size,
|
||||
*out_size = 0;
|
||||
return avpkt->size;
|
||||
} else {
|
||||
aac_decode_close(avctx);
|
||||
if ((err = aac_decode_init(avctx)) < 0)
|
||||
return err;
|
||||
latmctx->initialized = 1;
|
||||
@ -2507,7 +2514,7 @@ AVCodec ff_aac_decoder = {
|
||||
aac_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.channel_layouts = aac_channel_layout,
|
||||
};
|
||||
@ -2527,7 +2534,7 @@ AVCodec ff_aac_latm_decoder = {
|
||||
.decode = latm_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Codec LATM syntax)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.channel_layouts = aac_channel_layout,
|
||||
};
|
||||
|
@ -30,6 +30,7 @@
|
||||
* add temporal noise shaping
|
||||
***********************************/
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
#include "avcodec.h"
|
||||
#include "put_bits.h"
|
||||
#include "dsputil.h"
|
||||
@ -134,6 +135,15 @@ static const uint8_t aac_chan_configs[6][5] = {
|
||||
{4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
|
||||
};
|
||||
|
||||
static const uint8_t channel_maps[][AAC_MAX_CHANNELS] = {
|
||||
{ 0 },
|
||||
{ 0, 1 },
|
||||
{ 2, 0, 1 },
|
||||
{ 2, 0, 1, 3 },
|
||||
{ 2, 0, 1, 3, 4 },
|
||||
{ 2, 0, 1, 4, 5, 3 },
|
||||
};
|
||||
|
||||
/**
|
||||
* Make AAC audio config object.
|
||||
* @see 1.6.2.1 "Syntax - AudioSpecificConfig"
|
||||
@ -489,7 +499,7 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
AACEncContext *s = avctx->priv_data;
|
||||
int16_t *samples = s->samples, *samples2, *la;
|
||||
ChannelElement *cpe;
|
||||
int i, ch, w, chans, tag, start_ch;
|
||||
int i, ch, w, g, chans, tag, start_ch;
|
||||
const uint8_t *chan_map = aac_chan_configs[avctx->channels-1];
|
||||
int chan_el_counter[4];
|
||||
FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
|
||||
@ -498,15 +508,24 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
return 0;
|
||||
if (data) {
|
||||
if (!s->psypp) {
|
||||
memcpy(s->samples + 1024 * avctx->channels, data,
|
||||
1024 * avctx->channels * sizeof(s->samples[0]));
|
||||
if (avctx->channels <= 2) {
|
||||
memcpy(s->samples + 1024 * avctx->channels, data,
|
||||
1024 * avctx->channels * sizeof(s->samples[0]));
|
||||
} else {
|
||||
for (i = 0; i < 1024; i++)
|
||||
for (ch = 0; ch < avctx->channels; ch++)
|
||||
s->samples[(i + 1024) * avctx->channels + ch] =
|
||||
((int16_t*)data)[i * avctx->channels +
|
||||
channel_maps[avctx->channels-1][ch]];
|
||||
}
|
||||
} else {
|
||||
start_ch = 0;
|
||||
samples2 = s->samples + 1024 * avctx->channels;
|
||||
for (i = 0; i < chan_map[0]; i++) {
|
||||
tag = chan_map[i+1];
|
||||
chans = tag == TYPE_CPE ? 2 : 1;
|
||||
ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch,
|
||||
ff_psy_preprocess(s->psypp,
|
||||
(uint16_t*)data + channel_maps[avctx->channels-1][start_ch],
|
||||
samples2 + start_ch, start_ch, chans);
|
||||
start_ch += chans;
|
||||
}
|
||||
@ -587,8 +606,16 @@ static int aac_encode_frame(AVCodecContext *avctx,
|
||||
}
|
||||
}
|
||||
s->cur_channel = start_ch;
|
||||
if (cpe->common_window && s->coder->search_for_ms)
|
||||
s->coder->search_for_ms(s, cpe, s->lambda);
|
||||
if (s->options.stereo_mode && cpe->common_window) {
|
||||
if (s->options.stereo_mode > 0) {
|
||||
IndividualChannelStream *ics = &cpe->ch[0].ics;
|
||||
for (w = 0; w < ics->num_windows; w += ics->group_len[w])
|
||||
for (g = 0; g < ics->num_swb; g++)
|
||||
cpe->ms_mask[w*16+g] = 1;
|
||||
} else if (s->coder->search_for_ms) {
|
||||
s->coder->search_for_ms(s, cpe, s->lambda);
|
||||
}
|
||||
}
|
||||
adjust_frame_information(s, cpe, chans);
|
||||
if (chans == 2) {
|
||||
put_bits(&s->pb, 1, cpe->common_window);
|
||||
@ -645,6 +672,22 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define AACENC_FLAGS AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM
|
||||
static const AVOption aacenc_options[] = {
|
||||
{"stereo_mode", "Stereo coding method", offsetof(AACEncContext, options.stereo_mode), FF_OPT_TYPE_INT, {.dbl = 0}, -1, 1, AACENC_FLAGS, "stereo_mode"},
|
||||
{"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
|
||||
{"ms_off", "Disable Mid/Side coding", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
|
||||
{"ms_force", "Force Mid/Side for the whole frame if possible", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AACENC_FLAGS, "stereo_mode"},
|
||||
{NULL}
|
||||
};
|
||||
|
||||
static const AVClass aacenc_class = {
|
||||
"AAC encoder",
|
||||
av_default_item_name,
|
||||
aacenc_options,
|
||||
LIBAVUTIL_VERSION_INT,
|
||||
};
|
||||
|
||||
AVCodec ff_aac_encoder = {
|
||||
"aac",
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
@ -656,4 +699,5 @@ AVCodec ff_aac_encoder = {
|
||||
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
|
||||
.priv_class = &aacenc_class,
|
||||
};
|
||||
|
@ -30,6 +30,10 @@
|
||||
|
||||
#include "psymodel.h"
|
||||
|
||||
typedef struct AACEncOptions {
|
||||
int stereo_mode;
|
||||
} AACEncOptions;
|
||||
|
||||
struct AACEncContext;
|
||||
|
||||
typedef struct AACCoefficientsEncoder {
|
||||
@ -48,6 +52,8 @@ extern AACCoefficientsEncoder ff_aac_coders[];
|
||||
* AAC encoder context
|
||||
*/
|
||||
typedef struct AACEncContext {
|
||||
AVClass *av_class;
|
||||
AACEncOptions options; ///< encoding options
|
||||
PutBitContext pb;
|
||||
FFTContext mdct1024; ///< long (1024 samples) frame transform context
|
||||
FFTContext mdct128; ///< short (128 samples) frame transform context
|
||||
|
@ -127,14 +127,19 @@ av_cold void ff_aac_sbr_init(void)
|
||||
ff_ps_init();
|
||||
}
|
||||
|
||||
av_cold void ff_aac_sbr_ctx_init(SpectralBandReplication *sbr)
|
||||
av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
|
||||
{
|
||||
float mdct_scale;
|
||||
sbr->kx[0] = sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
|
||||
sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
|
||||
sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
|
||||
sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
|
||||
ff_mdct_init(&sbr->mdct, 7, 1, 1.0/64);
|
||||
ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0);
|
||||
/* SBR requires samples to be scaled to +/-32768.0 to work correctly.
|
||||
* mdct scale factors are adjusted to scale up from +/-1.0 at analysis
|
||||
* and scale back down at synthesis. */
|
||||
mdct_scale = ac->avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? 32768.0f : 1.0f;
|
||||
ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale));
|
||||
ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale);
|
||||
ff_ps_ctx_init(&sbr->ps);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
/** Initialize SBR. */
|
||||
av_cold void ff_aac_sbr_init(void);
|
||||
/** Initialize one SBR context. */
|
||||
av_cold void ff_aac_sbr_ctx_init(SpectralBandReplication *sbr);
|
||||
av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr);
|
||||
/** Close one SBR context. */
|
||||
av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr);
|
||||
/** Decode one SBR element. */
|
||||
|
@ -28,7 +28,8 @@
|
||||
#define AVCODEC_AC3_H
|
||||
|
||||
#define AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */
|
||||
#define AC3_MAX_CHANNELS 6 /* including LFE channel */
|
||||
#define AC3_MAX_CHANNELS 7 /**< maximum number of channels, including coupling channel */
|
||||
#define CPL_CH 0 /**< coupling channel index */
|
||||
|
||||
#define AC3_MAX_COEFS 256
|
||||
#define AC3_BLOCK_SIZE 256
|
||||
@ -158,10 +159,11 @@ typedef struct AC3EncOptions {
|
||||
|
||||
/* other encoding options */
|
||||
int allow_per_frame_metadata;
|
||||
int stereo_rematrixing;
|
||||
int stereo_rematrixing;
|
||||
int channel_coupling;
|
||||
int cpl_start;
|
||||
} AC3EncOptions;
|
||||
|
||||
|
||||
void ff_ac3_common_init(void);
|
||||
|
||||
extern const int64_t ff_ac3_channel_layouts[];
|
||||
|
@ -185,6 +185,15 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||
ff_fmt_convert_init(&s->fmt_conv, avctx);
|
||||
av_lfg_init(&s->dith_state, 0);
|
||||
|
||||
/* set scale value for float to int16 conversion */
|
||||
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
s->mul_bias = 1.0f;
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
} else {
|
||||
s->mul_bias = 32767.0f;
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
}
|
||||
|
||||
/* allow downmixing to stereo or mono */
|
||||
if (avctx->channels > 0 && avctx->request_channels > 0 &&
|
||||
avctx->request_channels < avctx->channels &&
|
||||
@ -193,14 +202,6 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
|
||||
}
|
||||
s->downmixed = 1;
|
||||
|
||||
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
s->mul_bias = 1.0f;
|
||||
} else {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
/* set scale value for float to int16 conversion */
|
||||
s->mul_bias = 32767.0f;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1295,8 +1296,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
AC3DecodeContext *s = avctx->priv_data;
|
||||
float *out_samples_flt = (float *)data;
|
||||
int16_t *out_samples = (int16_t *)data;
|
||||
float *out_samples_flt = data;
|
||||
int16_t *out_samples_s16 = data;
|
||||
int blk, ch, err;
|
||||
int data_size_orig, data_size_tmp;
|
||||
const uint8_t *channel_map;
|
||||
@ -1400,7 +1401,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
for (ch = 0; ch < s->out_channels; ch++)
|
||||
output[ch] = s->output[channel_map[ch]];
|
||||
data_size_tmp = s->num_blocks * 256 * avctx->channels;
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*out_samples_flt) : sizeof(*out_samples);
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*out_samples_flt) : sizeof(*out_samples_s16);
|
||||
if (data_size_orig < data_size_tmp)
|
||||
return -1;
|
||||
*data_size = data_size_tmp;
|
||||
@ -1409,14 +1410,19 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, int *data_size,
|
||||
av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n");
|
||||
err = 1;
|
||||
}
|
||||
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
float_interleave_noscale(out_samples_flt, output, 256, s->out_channels);
|
||||
s->fmt_conv.float_interleave(out_samples_flt, output, 256,
|
||||
s->out_channels);
|
||||
out_samples_flt += 256 * s->out_channels;
|
||||
} else {
|
||||
s->fmt_conv.float_to_int16_interleave(out_samples, output, 256, s->out_channels);
|
||||
out_samples += 256 * s->out_channels;
|
||||
s->fmt_conv.float_to_int16_interleave(out_samples_s16, output, 256,
|
||||
s->out_channels);
|
||||
out_samples_s16 += 256 * s->out_channels;
|
||||
}
|
||||
}
|
||||
*data_size = s->num_blocks * 256 * avctx->channels *
|
||||
(av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
|
||||
return FFMIN(buf_size, s->frame_size);
|
||||
}
|
||||
|
||||
@ -1441,6 +1447,9 @@ AVCodec ff_ac3_decoder = {
|
||||
.close = ac3_decode_end,
|
||||
.decode = ac3_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
};
|
||||
|
||||
#if CONFIG_EAC3_DECODER
|
||||
@ -1453,5 +1462,8 @@ AVCodec ff_eac3_decoder = {
|
||||
.close = ac3_decode_end,
|
||||
.decode = ac3_decode_frame,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"),
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
@ -58,11 +58,6 @@
|
||||
#include "fft.h"
|
||||
#include "fmtconvert.h"
|
||||
|
||||
/* override ac3.h to include coupling channel */
|
||||
#undef AC3_MAX_CHANNELS
|
||||
#define AC3_MAX_CHANNELS 7
|
||||
#define CPL_CH 0
|
||||
|
||||
#define AC3_OUTPUT_LFEON 8
|
||||
|
||||
#define SPX_MAX_BANDS 17
|
||||
@ -201,7 +196,7 @@ typedef struct {
|
||||
///@}
|
||||
|
||||
///@defgroup arrays aligned arrays
|
||||
DECLARE_ALIGNED(16, int, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///> fixed-point transform coefficients
|
||||
DECLARE_ALIGNED(16, int, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< fixed-point transform coefficients
|
||||
DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< transform coefficients
|
||||
DECLARE_ALIGNED(32, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< delay - added to the next block
|
||||
DECLARE_ALIGNED(32, float, window)[AC3_BLOCK_SIZE]; ///< window coefficients
|
||||
|
@ -53,12 +53,6 @@ const uint8_t ff_eac3_hebap_tab[64] = {
|
||||
19, 19, 19, 19,
|
||||
};
|
||||
|
||||
/**
|
||||
* Table E2.16 Default Coupling Banding Structure
|
||||
*/
|
||||
const uint8_t ff_eac3_default_cpl_band_struct[18] =
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 };
|
||||
|
||||
/**
|
||||
* Table E2.15 Default Spectral Extension Banding Structure
|
||||
*/
|
||||
|
@ -27,7 +27,6 @@
|
||||
extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3];
|
||||
|
||||
extern const uint8_t ff_eac3_hebap_tab[64];
|
||||
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
|
||||
extern const uint8_t ff_eac3_default_spx_band_struct[17];
|
||||
|
||||
#endif /* AVCODEC_AC3DEC_DATA_H */
|
||||
|
@ -128,24 +128,33 @@ static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd,
|
||||
} while (end > ff_ac3_band_start_tab[band++]);
|
||||
}
|
||||
|
||||
static int ac3_compute_mantissa_size_c(int mant_cnt[5], uint8_t *bap,
|
||||
int nb_coefs)
|
||||
static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap,
|
||||
int len)
|
||||
{
|
||||
int bits, b, i;
|
||||
while (len-- > 0)
|
||||
mant_cnt[bap[len]]++;
|
||||
}
|
||||
|
||||
bits = 0;
|
||||
for (i = 0; i < nb_coefs; i++) {
|
||||
b = bap[i];
|
||||
if (b <= 4) {
|
||||
// bap=1 to bap=4 will be counted in compute_mantissa_size_final
|
||||
mant_cnt[b]++;
|
||||
} else if (b <= 13) {
|
||||
// bap=5 to bap=13 use (bap-1) bits
|
||||
bits += b - 1;
|
||||
} else {
|
||||
// bap=14 uses 14 bits and bap=15 uses 16 bits
|
||||
bits += (b == 14) ? 14 : 16;
|
||||
}
|
||||
DECLARE_ALIGNED(16, const uint16_t, ff_ac3_bap_bits)[16] = {
|
||||
0, 0, 0, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16
|
||||
};
|
||||
|
||||
static int ac3_compute_mantissa_size_c(uint16_t mant_cnt[6][16])
|
||||
{
|
||||
int blk, bap;
|
||||
int bits = 0;
|
||||
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
// bap=1 : 3 mantissas in 5 bits
|
||||
bits += (mant_cnt[blk][1] / 3) * 5;
|
||||
// bap=2 : 3 mantissas in 7 bits
|
||||
// bap=4 : 2 mantissas in 7 bits
|
||||
bits += ((mant_cnt[blk][2] / 3) + (mant_cnt[blk][4] >> 1)) * 7;
|
||||
// bap=3 : 1 mantissa in 3 bits
|
||||
bits += mant_cnt[blk][3] * 3;
|
||||
// bap=5 to 15 : get bits per mantissa from table
|
||||
for (bap = 5; bap < 16; bap++)
|
||||
bits += mant_cnt[blk][bap] * ff_ac3_bap_bits[bap];
|
||||
}
|
||||
return bits;
|
||||
}
|
||||
@ -181,6 +190,7 @@ av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact)
|
||||
c->ac3_rshift_int32 = ac3_rshift_int32_c;
|
||||
c->float_to_fixed24 = float_to_fixed24_c;
|
||||
c->bit_alloc_calc_bap = ac3_bit_alloc_calc_bap_c;
|
||||
c->update_bap_counts = ac3_update_bap_counts_c;
|
||||
c->compute_mantissa_size = ac3_compute_mantissa_size_c;
|
||||
c->extract_exponents = ac3_extract_exponents_c;
|
||||
|
||||
|
@ -24,6 +24,12 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Number of mantissa bits written for each bap value.
|
||||
* bap values with fractional bits are set to 0 and are calculated separately.
|
||||
*/
|
||||
extern const uint16_t ff_ac3_bap_bits[16];
|
||||
|
||||
typedef struct AC3DSPContext {
|
||||
/**
|
||||
* Set each encoded exponent in a block to the minimum of itself and the
|
||||
@ -102,9 +108,21 @@ typedef struct AC3DSPContext {
|
||||
const uint8_t *bap_tab, uint8_t *bap);
|
||||
|
||||
/**
|
||||
* Calculate the number of bits needed to encode a set of mantissas.
|
||||
* Update bap counts using the supplied array of bap.
|
||||
*
|
||||
* @param[out] mant_cnt bap counts for 1 block
|
||||
* @param[in] bap array of bap, pointing to start coef bin
|
||||
* @param[in] len number of elements to process
|
||||
*/
|
||||
int (*compute_mantissa_size)(int mant_cnt[5], uint8_t *bap, int nb_coefs);
|
||||
void (*update_bap_counts)(uint16_t mant_cnt[16], uint8_t *bap, int len);
|
||||
|
||||
/**
|
||||
* Calculate the number of bits needed to encode a set of mantissas.
|
||||
*
|
||||
* @param[in] mant_cnt bap counts for all blocks
|
||||
* @return mantissa bit count
|
||||
*/
|
||||
int (*compute_mantissa_size)(uint16_t mant_cnt[6][16]);
|
||||
|
||||
void (*extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs);
|
||||
} AC3DSPContext;
|
||||
|
1371
libavcodec/ac3enc.c
1371
libavcodec/ac3enc.c
File diff suppressed because it is too large
Load Diff
296
libavcodec/ac3enc.h
Normal file
296
libavcodec/ac3enc.h
Normal file
@ -0,0 +1,296 @@
|
||||
/*
|
||||
* AC-3 encoder & E-AC-3 encoder common header
|
||||
* Copyright (c) 2000 Fabrice Bellard
|
||||
* Copyright (c) 2006-2010 Justin Ruggles <justin.ruggles@gmail.com>
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* AC-3 encoder & E-AC-3 encoder common header
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3ENC_H
|
||||
#define AVCODEC_AC3ENC_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ac3.h"
|
||||
#include "ac3dsp.h"
|
||||
#include "avcodec.h"
|
||||
#include "dsputil.h"
|
||||
#include "put_bits.h"
|
||||
#include "fft.h"
|
||||
|
||||
#ifndef CONFIG_AC3ENC_FLOAT
|
||||
#define CONFIG_AC3ENC_FLOAT 0
|
||||
#endif
|
||||
|
||||
#define OFFSET(param) offsetof(AC3EncodeContext, options.param)
|
||||
#define AC3ENC_PARAM (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||
|
||||
#define AC3ENC_TYPE_AC3_FIXED 0
|
||||
#define AC3ENC_TYPE_AC3 1
|
||||
#define AC3ENC_TYPE_EAC3 2
|
||||
|
||||
#if CONFIG_AC3ENC_FLOAT
|
||||
#define AC3_NAME(x) ff_ac3_float_ ## x
|
||||
#define MAC_COEF(d,a,b) ((d)+=(a)*(b))
|
||||
typedef float SampleType;
|
||||
typedef float CoefType;
|
||||
typedef float CoefSumType;
|
||||
#else
|
||||
#define AC3_NAME(x) ff_ac3_fixed_ ## x
|
||||
#define MAC_COEF(d,a,b) MAC64(d,a,b)
|
||||
typedef int16_t SampleType;
|
||||
typedef int32_t CoefType;
|
||||
typedef int64_t CoefSumType;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct AC3MDCTContext {
|
||||
const SampleType *window; ///< MDCT window function
|
||||
FFTContext fft; ///< FFT context for MDCT calculation
|
||||
} AC3MDCTContext;
|
||||
#if 0
|
||||
/**
|
||||
* Encoding Options used by AVOption.
|
||||
*/
|
||||
typedef struct AC3EncOptions {
|
||||
/* AC-3 metadata options*/
|
||||
int dialogue_level;
|
||||
int bitstream_mode;
|
||||
float center_mix_level;
|
||||
float surround_mix_level;
|
||||
int dolby_surround_mode;
|
||||
int audio_production_info;
|
||||
int mixing_level;
|
||||
int room_type;
|
||||
int copyright;
|
||||
int original;
|
||||
int extended_bsi_1;
|
||||
int preferred_stereo_downmix;
|
||||
float ltrt_center_mix_level;
|
||||
float ltrt_surround_mix_level;
|
||||
float loro_center_mix_level;
|
||||
float loro_surround_mix_level;
|
||||
int extended_bsi_2;
|
||||
int dolby_surround_ex_mode;
|
||||
int dolby_headphone_mode;
|
||||
int ad_converter_type;
|
||||
|
||||
/* other encoding options */
|
||||
int allow_per_frame_metadata;
|
||||
int stereo_rematrixing;
|
||||
int channel_coupling;
|
||||
int cpl_start;
|
||||
} AC3EncOptions;
|
||||
#endif
|
||||
/**
|
||||
* Data for a single audio block.
|
||||
*/
|
||||
typedef struct AC3Block {
|
||||
CoefType **mdct_coef; ///< MDCT coefficients
|
||||
int32_t **fixed_coef; ///< fixed-point MDCT coefficients
|
||||
uint8_t **exp; ///< original exponents
|
||||
uint8_t **grouped_exp; ///< grouped exponents
|
||||
int16_t **psd; ///< psd per frequency bin
|
||||
int16_t **band_psd; ///< psd per critical band
|
||||
int16_t **mask; ///< masking curve
|
||||
uint16_t **qmant; ///< quantized mantissas
|
||||
uint8_t **cpl_coord_exp; ///< coupling coord exponents (cplcoexp)
|
||||
uint8_t **cpl_coord_mant; ///< coupling coord mantissas (cplcomant)
|
||||
uint8_t coeff_shift[AC3_MAX_CHANNELS]; ///< fixed-point coefficient shift values
|
||||
uint8_t new_rematrixing_strategy; ///< send new rematrixing flags in this block
|
||||
int num_rematrixing_bands; ///< number of rematrixing bands
|
||||
uint8_t rematrixing_flags[4]; ///< rematrixing flags
|
||||
int new_cpl_strategy; ///< send new coupling strategy
|
||||
int cpl_in_use; ///< coupling in use for this block (cplinu)
|
||||
uint8_t channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl)
|
||||
int num_cpl_channels; ///< number of channels in coupling
|
||||
uint8_t new_cpl_coords; ///< send new coupling coordinates (cplcoe)
|
||||
uint8_t cpl_master_exp[AC3_MAX_CHANNELS]; ///< coupling coord master exponents (mstrcplco)
|
||||
int new_snr_offsets; ///< send new SNR offsets
|
||||
int new_cpl_leak; ///< send new coupling leak info
|
||||
int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant)
|
||||
} AC3Block;
|
||||
|
||||
/**
|
||||
* AC-3 encoder private context.
|
||||
*/
|
||||
typedef struct AC3EncodeContext {
|
||||
AVClass *av_class; ///< AVClass used for AVOption
|
||||
AC3EncOptions options; ///< encoding options
|
||||
AVCodecContext *avctx; ///< parent AVCodecContext
|
||||
PutBitContext pb; ///< bitstream writer context
|
||||
DSPContext dsp;
|
||||
AC3DSPContext ac3dsp; ///< AC-3 optimized functions
|
||||
AC3MDCTContext *mdct; ///< MDCT context
|
||||
|
||||
AC3Block blocks[AC3_MAX_BLOCKS]; ///< per-block info
|
||||
|
||||
int fixed_point; ///< indicates if fixed-point encoder is being used
|
||||
int eac3; ///< indicates if this is E-AC-3 vs. AC-3
|
||||
int bitstream_id; ///< bitstream id (bsid)
|
||||
int bitstream_mode; ///< bitstream mode (bsmod)
|
||||
|
||||
int bit_rate; ///< target bit rate, in bits-per-second
|
||||
int sample_rate; ///< sampling frequency, in Hz
|
||||
|
||||
int frame_size_min; ///< minimum frame size in case rounding is necessary
|
||||
int frame_size; ///< current frame size in bytes
|
||||
int frame_size_code; ///< frame size code (frmsizecod)
|
||||
uint16_t crc_inv[2];
|
||||
int64_t bits_written; ///< bit count (used to avg. bitrate)
|
||||
int64_t samples_written; ///< sample count (used to avg. bitrate)
|
||||
|
||||
int fbw_channels; ///< number of full-bandwidth channels (nfchans)
|
||||
int channels; ///< total number of channels (nchans)
|
||||
int lfe_on; ///< indicates if there is an LFE channel (lfeon)
|
||||
int lfe_channel; ///< channel index of the LFE channel
|
||||
int has_center; ///< indicates if there is a center channel
|
||||
int has_surround; ///< indicates if there are one or more surround channels
|
||||
int channel_mode; ///< channel mode (acmod)
|
||||
const uint8_t *channel_map; ///< channel map used to reorder channels
|
||||
|
||||
int center_mix_level; ///< center mix level code
|
||||
int surround_mix_level; ///< surround mix level code
|
||||
int ltrt_center_mix_level; ///< Lt/Rt center mix level code
|
||||
int ltrt_surround_mix_level; ///< Lt/Rt surround mix level code
|
||||
int loro_center_mix_level; ///< Lo/Ro center mix level code
|
||||
int loro_surround_mix_level; ///< Lo/Ro surround mix level code
|
||||
|
||||
int cutoff; ///< user-specified cutoff frequency, in Hz
|
||||
int bandwidth_code; ///< bandwidth code (0 to 60) (chbwcod)
|
||||
int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant)
|
||||
int cpl_end_freq; ///< coupling channel end frequency bin
|
||||
|
||||
int cpl_on; ///< coupling turned on for this frame
|
||||
int cpl_enabled; ///< coupling enabled for all frames
|
||||
int num_cpl_subbands; ///< number of coupling subbands (ncplsubnd)
|
||||
int num_cpl_bands; ///< number of coupling bands (ncplbnd)
|
||||
uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band
|
||||
|
||||
int rematrixing_enabled; ///< stereo rematrixing enabled
|
||||
|
||||
/* bitrate allocation control */
|
||||
int slow_gain_code; ///< slow gain code (sgaincod)
|
||||
int slow_decay_code; ///< slow decay code (sdcycod)
|
||||
int fast_decay_code; ///< fast decay code (fdcycod)
|
||||
int db_per_bit_code; ///< dB/bit code (dbpbcod)
|
||||
int floor_code; ///< floor code (floorcod)
|
||||
AC3BitAllocParameters bit_alloc; ///< bit allocation parameters
|
||||
int coarse_snr_offset; ///< coarse SNR offsets (csnroffst)
|
||||
int fast_gain_code[AC3_MAX_CHANNELS]; ///< fast gain codes (signal-to-mask ratio) (fgaincod)
|
||||
int fine_snr_offset[AC3_MAX_CHANNELS]; ///< fine SNR offsets (fsnroffst)
|
||||
int frame_bits_fixed; ///< number of non-coefficient bits for fixed parameters
|
||||
int frame_bits; ///< all frame bits except exponents and mantissas
|
||||
int exponent_bits; ///< number of bits used for exponents
|
||||
|
||||
SampleType *windowed_samples;
|
||||
SampleType **planar_samples;
|
||||
uint8_t *bap_buffer;
|
||||
uint8_t *bap1_buffer;
|
||||
CoefType *mdct_coef_buffer;
|
||||
int32_t *fixed_coef_buffer;
|
||||
uint8_t *exp_buffer;
|
||||
uint8_t *grouped_exp_buffer;
|
||||
int16_t *psd_buffer;
|
||||
int16_t *band_psd_buffer;
|
||||
int16_t *mask_buffer;
|
||||
uint16_t *qmant_buffer;
|
||||
uint8_t *cpl_coord_exp_buffer;
|
||||
uint8_t *cpl_coord_mant_buffer;
|
||||
|
||||
uint8_t exp_strategy[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< exponent strategies
|
||||
uint8_t exp_ref_block[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< reference blocks for EXP_REUSE
|
||||
uint8_t *ref_bap [AC3_MAX_CHANNELS][AC3_MAX_BLOCKS]; ///< bit allocation pointers (bap)
|
||||
int ref_bap_set; ///< indicates if ref_bap pointers have been set
|
||||
|
||||
/* fixed vs. float function pointers */
|
||||
void (*mdct_end)(AC3MDCTContext *mdct);
|
||||
int (*mdct_init)(AVCodecContext *avctx, AC3MDCTContext *mdct, int nbits);
|
||||
void (*apply_window)(DSPContext *dsp, SampleType *output,
|
||||
const SampleType *input, const SampleType *window,
|
||||
unsigned int len);
|
||||
int (*normalize_samples)(struct AC3EncodeContext *s);
|
||||
void (*scale_coefficients)(struct AC3EncodeContext *s);
|
||||
|
||||
/* fixed vs. float templated function pointers */
|
||||
int (*allocate_sample_buffers)(struct AC3EncodeContext *s);
|
||||
void (*deinterleave_input_samples)(struct AC3EncodeContext *s,
|
||||
const SampleType *samples);
|
||||
void (*apply_mdct)(struct AC3EncodeContext *s);
|
||||
void (*apply_channel_coupling)(struct AC3EncodeContext *s);
|
||||
void (*compute_rematrixing_strategy)(struct AC3EncodeContext *s);
|
||||
|
||||
/* AC-3 vs. E-AC-3 function pointers */
|
||||
void (*output_frame_header)(struct AC3EncodeContext *s);
|
||||
} AC3EncodeContext;
|
||||
|
||||
|
||||
int ff_ac3_encode_init(AVCodecContext *avctx);
|
||||
|
||||
int ff_ac3_encode_frame(AVCodecContext *avctx, unsigned char *frame,
|
||||
int buf_size, void *data);
|
||||
|
||||
int ff_ac3_encode_close(AVCodecContext *avctx);
|
||||
|
||||
|
||||
/* prototypes for functions in ac3enc_fixed.c and ac3enc_float.c */
|
||||
|
||||
void ff_ac3_fixed_mdct_end(AC3MDCTContext *mdct);
|
||||
void ff_ac3_float_mdct_end(AC3MDCTContext *mdct);
|
||||
|
||||
int ff_ac3_fixed_mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits);
|
||||
int ff_ac3_float_mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits);
|
||||
|
||||
void ff_ac3_fixed_apply_window(DSPContext *dsp, SampleType *output,
|
||||
const SampleType *input,
|
||||
const SampleType *window, unsigned int len);
|
||||
void ff_ac3_float_apply_window(DSPContext *dsp, SampleType *output,
|
||||
const SampleType *input,
|
||||
const SampleType *window, unsigned int len);
|
||||
|
||||
int ff_ac3_fixed_normalize_samples(AC3EncodeContext *s);
|
||||
|
||||
void ff_ac3_fixed_scale_coefficients(AC3EncodeContext *s);
|
||||
void ff_ac3_float_scale_coefficients(AC3EncodeContext *s);
|
||||
|
||||
|
||||
/* prototypes for functions in ac3enc_template.c */
|
||||
|
||||
int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s);
|
||||
int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s);
|
||||
|
||||
void ff_ac3_fixed_deinterleave_input_samples(AC3EncodeContext *s,
|
||||
const SampleType *samples);
|
||||
void ff_ac3_float_deinterleave_input_samples(AC3EncodeContext *s,
|
||||
const SampleType *samples);
|
||||
|
||||
void ff_ac3_fixed_apply_mdct(AC3EncodeContext *s);
|
||||
void ff_ac3_float_apply_mdct(AC3EncodeContext *s);
|
||||
|
||||
void ff_ac3_fixed_apply_channel_coupling(AC3EncodeContext *s);
|
||||
void ff_ac3_float_apply_channel_coupling(AC3EncodeContext *s);
|
||||
|
||||
void ff_ac3_fixed_compute_rematrixing_strategy(AC3EncodeContext *s);
|
||||
void ff_ac3_float_compute_rematrixing_strategy(AC3EncodeContext *s);
|
||||
|
||||
#endif /* AVCODEC_AC3ENC_H */
|
@ -11,8 +11,18 @@ typedef struct CombineContext{
|
||||
AVCodec *codec;
|
||||
}CombineContext;
|
||||
|
||||
#define OFFSET(param) offsetof(CombineContext, options.param)
|
||||
#define AC3ENC_PARAM (AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
|
||||
|
||||
#define AC3ENC_TYPE_AC3_FIXED 0
|
||||
#define AC3ENC_TYPE_AC3 1
|
||||
#define AC3ENC_TYPE_EAC3 2
|
||||
|
||||
#define AC3ENC_TYPE 12354
|
||||
#include "ac3enc_opts_template.c"
|
||||
|
||||
static AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
|
||||
ff_ac3_options, LIBAVUTIL_VERSION_INT };
|
||||
eac3_options, LIBAVUTIL_VERSION_INT };
|
||||
|
||||
static av_cold AVCodec *get_codec(enum AVSampleFormat s){
|
||||
#if CONFIG_AC3_FIXED_ENCODER
|
||||
|
@ -28,13 +28,20 @@
|
||||
|
||||
#define CONFIG_FFT_FLOAT 0
|
||||
#undef CONFIG_AC3ENC_FLOAT
|
||||
#include "ac3enc.c"
|
||||
#include "ac3enc.h"
|
||||
|
||||
#define AC3ENC_TYPE AC3ENC_TYPE_AC3_FIXED
|
||||
#include "ac3enc_opts_template.c"
|
||||
static AVClass ac3enc_class = { "Fixed-Point AC-3 Encoder", av_default_item_name,
|
||||
ac3fixed_options, LIBAVUTIL_VERSION_INT };
|
||||
|
||||
#include "ac3enc_template.c"
|
||||
|
||||
|
||||
/**
|
||||
* Finalize MDCT and free allocated memory.
|
||||
*/
|
||||
static av_cold void mdct_end(AC3MDCTContext *mdct)
|
||||
av_cold void AC3_NAME(mdct_end)(AC3MDCTContext *mdct)
|
||||
{
|
||||
ff_mdct_end(&mdct->fft);
|
||||
}
|
||||
@ -44,8 +51,8 @@ static av_cold void mdct_end(AC3MDCTContext *mdct)
|
||||
* Initialize MDCT tables.
|
||||
* @param nbits log2(MDCT size)
|
||||
*/
|
||||
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits)
|
||||
av_cold int AC3_NAME(mdct_init)(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits)
|
||||
{
|
||||
int ret = ff_mdct_init(&mdct->fft, nbits, 0, -1.0);
|
||||
mdct->window = ff_ac3_window;
|
||||
@ -56,8 +63,9 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
/**
|
||||
* Apply KBD window to input samples prior to MDCT.
|
||||
*/
|
||||
static void apply_window(DSPContext *dsp, int16_t *output, const int16_t *input,
|
||||
const int16_t *window, unsigned int len)
|
||||
void AC3_NAME(apply_window)(DSPContext *dsp, int16_t *output,
|
||||
const int16_t *input, const int16_t *window,
|
||||
unsigned int len)
|
||||
{
|
||||
dsp->apply_window_int16(output, input, window, len);
|
||||
}
|
||||
@ -82,7 +90,7 @@ static int log2_tab(AC3EncodeContext *s, int16_t *src, int len)
|
||||
*
|
||||
* @return exponent shift
|
||||
*/
|
||||
static int normalize_samples(AC3EncodeContext *s)
|
||||
int AC3_NAME(normalize_samples)(AC3EncodeContext *s)
|
||||
{
|
||||
int v = 14 - log2_tab(s, s->windowed_samples, AC3_WINDOW_SIZE);
|
||||
if (v > 0)
|
||||
@ -95,13 +103,13 @@ static int normalize_samples(AC3EncodeContext *s)
|
||||
/**
|
||||
* Scale MDCT coefficients to 25-bit signed fixed-point.
|
||||
*/
|
||||
static void scale_coefficients(AC3EncodeContext *s)
|
||||
void AC3_NAME(scale_coefficients)(AC3EncodeContext *s)
|
||||
{
|
||||
int blk, ch;
|
||||
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
for (ch = 1; ch <= s->channels; ch++) {
|
||||
s->ac3dsp.ac3_rshift_int32(block->mdct_coef[ch], AC3_MAX_COEFS,
|
||||
block->coeff_shift[ch]);
|
||||
}
|
||||
@ -109,14 +117,22 @@ static void scale_coefficients(AC3EncodeContext *s)
|
||||
}
|
||||
|
||||
|
||||
static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
|
||||
{
|
||||
AC3EncodeContext *s = avctx->priv_data;
|
||||
s->fixed_point = 1;
|
||||
return ff_ac3_encode_init(avctx);
|
||||
}
|
||||
|
||||
|
||||
AVCodec ff_ac3_fixed_encoder = {
|
||||
"ac3_fixed",
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
CODEC_ID_AC3,
|
||||
sizeof(AC3EncodeContext),
|
||||
ac3_encode_init,
|
||||
ac3_encode_frame,
|
||||
ac3_encode_close,
|
||||
ac3_fixed_encode_init,
|
||||
ff_ac3_encode_frame,
|
||||
ff_ac3_encode_close,
|
||||
NULL,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
|
@ -27,14 +27,25 @@
|
||||
*/
|
||||
|
||||
#define CONFIG_AC3ENC_FLOAT 1
|
||||
#include "ac3enc.c"
|
||||
#include "ac3enc.h"
|
||||
#include "eac3enc.h"
|
||||
#include "kbdwin.h"
|
||||
|
||||
|
||||
#if CONFIG_AC3_ENCODER
|
||||
#define AC3ENC_TYPE AC3ENC_TYPE_AC3
|
||||
#include "ac3enc_opts_template.c"
|
||||
static AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
|
||||
ac3_options, LIBAVUTIL_VERSION_INT };
|
||||
#endif
|
||||
|
||||
#include "ac3enc_template.c"
|
||||
|
||||
|
||||
/**
|
||||
* Finalize MDCT and free allocated memory.
|
||||
*/
|
||||
static av_cold void mdct_end(AC3MDCTContext *mdct)
|
||||
av_cold void ff_ac3_float_mdct_end(AC3MDCTContext *mdct)
|
||||
{
|
||||
ff_mdct_end(&mdct->fft);
|
||||
av_freep(&mdct->window);
|
||||
@ -45,8 +56,8 @@ static av_cold void mdct_end(AC3MDCTContext *mdct)
|
||||
* Initialize MDCT tables.
|
||||
* @param nbits log2(MDCT size)
|
||||
*/
|
||||
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits)
|
||||
av_cold int ff_ac3_float_mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
int nbits)
|
||||
{
|
||||
float *window;
|
||||
int i, n, n2;
|
||||
@ -71,44 +82,39 @@ static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
|
||||
/**
|
||||
* Apply KBD window to input samples prior to MDCT.
|
||||
*/
|
||||
static void apply_window(DSPContext *dsp, float *output, const float *input,
|
||||
const float *window, unsigned int len)
|
||||
void ff_ac3_float_apply_window(DSPContext *dsp, float *output,
|
||||
const float *input, const float *window,
|
||||
unsigned int len)
|
||||
{
|
||||
dsp->vector_fmul(output, input, window, len);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Normalize the input samples to use the maximum available precision.
|
||||
*/
|
||||
static int normalize_samples(AC3EncodeContext *s)
|
||||
{
|
||||
/* Normalization is not needed for floating-point samples, so just return 0 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scale MDCT coefficients from float to 24-bit fixed-point.
|
||||
*/
|
||||
static void scale_coefficients(AC3EncodeContext *s)
|
||||
void ff_ac3_float_scale_coefficients(AC3EncodeContext *s)
|
||||
{
|
||||
s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer, s->mdct_coef_buffer,
|
||||
AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels);
|
||||
int chan_size = AC3_MAX_COEFS * AC3_MAX_BLOCKS;
|
||||
s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + chan_size,
|
||||
s->mdct_coef_buffer + chan_size,
|
||||
chan_size * s->channels);
|
||||
}
|
||||
|
||||
|
||||
#if CONFIG_AC3_ENCODER
|
||||
AVCodec ff_ac3_float_encoder = {
|
||||
"ac3_float",
|
||||
AVMEDIA_TYPE_AUDIO,
|
||||
CODEC_ID_AC3,
|
||||
sizeof(AC3EncodeContext),
|
||||
ac3_encode_init,
|
||||
ac3_encode_frame,
|
||||
ac3_encode_close,
|
||||
ff_ac3_encode_init,
|
||||
ff_ac3_encode_frame,
|
||||
ff_ac3_encode_close,
|
||||
NULL,
|
||||
.sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
|
||||
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
|
||||
.priv_class = &ac3enc_class,
|
||||
.channel_layouts = ff_ac3_channel_layouts,
|
||||
};
|
||||
#endif
|
||||
|
84
libavcodec/ac3enc_opts_template.c
Normal file
84
libavcodec/ac3enc_opts_template.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* AC-3 encoder options
|
||||
* Copyright (c) 2011 Justin Ruggles <justin.ruggles@gmail.com>
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
#include "ac3.h"
|
||||
|
||||
#if AC3ENC_TYPE == AC3ENC_TYPE_AC3_FIXED
|
||||
static const AVOption ac3fixed_options[] = {
|
||||
#elif AC3ENC_TYPE == AC3ENC_TYPE_AC3
|
||||
static const AVOption ac3_options[] = {
|
||||
#else /* AC3ENC_TYPE_EAC3 */
|
||||
static const AVOption eac3_options[] = {
|
||||
#endif
|
||||
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
|
||||
/* Metadata Options */
|
||||
{"per_frame_metadata", "Allow Changing Metadata Per-Frame", OFFSET(allow_per_frame_metadata), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM},
|
||||
/* downmix levels */
|
||||
{"center_mixlev", "Center Mix Level", OFFSET(center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_4POINT5DB }, 0.0, 1.0, AC3ENC_PARAM},
|
||||
{"surround_mixlev", "Surround Mix Level", OFFSET(surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = LEVEL_MINUS_6DB }, 0.0, 1.0, AC3ENC_PARAM},
|
||||
/* audio production information */
|
||||
{"mixing_level", "Mixing Level", OFFSET(mixing_level), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 111, AC3ENC_PARAM},
|
||||
{"room_type", "Room Type", OFFSET(room_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "room_type"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"large", "Large Room", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
{"small", "Small Room", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "room_type"},
|
||||
/* other metadata options */
|
||||
{"copyright", "Copyright Bit", OFFSET(copyright), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 1, AC3ENC_PARAM},
|
||||
#endif
|
||||
{"dialnorm", "Dialogue Level (dB)", OFFSET(dialogue_level), FF_OPT_TYPE_INT, {.dbl = -31 }, -31, -1, AC3ENC_PARAM},
|
||||
#if AC3ENC_TYPE != AC3ENC_TYPE_EAC3
|
||||
{"dsur_mode", "Dolby Surround Mode", OFFSET(dolby_surround_mode), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, 2, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"on", "Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"off", "Not Dolby Surround Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsur_mode"},
|
||||
{"original", "Original Bit Stream", OFFSET(original), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM},
|
||||
/* extended bitstream information */
|
||||
{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt", "Lt/Rt Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"loro", "Lo/Ro Downmix Preferred", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dmix_mode"},
|
||||
{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), FF_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, AC3ENC_PARAM},
|
||||
{"dsurex_mode", "Dolby Surround EX Mode", OFFSET(dolby_surround_ex_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"on", "Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"off", "Not Dolby Surround EX Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dsurex_mode"},
|
||||
{"dheadphone_mode", "Dolby Headphone Mode", OFFSET(dolby_headphone_mode), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 2, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"notindicated", "Not Indicated (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"on", "Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"off", "Not Dolby Headphone Encoded", 0, FF_OPT_TYPE_CONST, {.dbl = 2 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "dheadphone_mode"},
|
||||
{"ad_conv_type", "A/D Converter Type", OFFSET(ad_converter_type), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 1, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"standard", "Standard (default)", 0, FF_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
{"hdcd", "HDCD", 0, FF_OPT_TYPE_CONST, {.dbl = 1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "ad_conv_type"},
|
||||
#endif
|
||||
/* Other Encoding Options */
|
||||
{"stereo_rematrixing", "Stereo Rematrixing", OFFSET(stereo_rematrixing), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM},
|
||||
#if AC3ENC_TYPE != AC3ENC_TYPE_AC3_FIXED
|
||||
{"channel_coupling", "Channel Coupling", OFFSET(channel_coupling), FF_OPT_TYPE_INT, {.dbl = 1 }, 0, 1, AC3ENC_PARAM, "channel_coupling"},
|
||||
{"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "channel_coupling"},
|
||||
{"cpl_start_band", "Coupling Start Band", OFFSET(cpl_start), FF_OPT_TYPE_INT, {.dbl = -1 }, -1, 15, AC3ENC_PARAM, "cpl_start_band"},
|
||||
{"auto", "Selected by the Encoder", 0, FF_OPT_TYPE_CONST, {.dbl = -1 }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"},
|
||||
#endif
|
||||
{NULL}
|
||||
};
|
399
libavcodec/ac3enc_template.c
Normal file
399
libavcodec/ac3enc_template.c
Normal file
@ -0,0 +1,399 @@
|
||||
/*
|
||||
* AC-3 encoder float/fixed template
|
||||
* Copyright (c) 2000 Fabrice Bellard
|
||||
* Copyright (c) 2006-2011 Justin Ruggles <justin.ruggles@gmail.com>
|
||||
* Copyright (c) 2006-2010 Prakash Punnoor <prakash@punnoor.de>
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* AC-3 encoder float/fixed template
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ac3enc.h"
|
||||
|
||||
|
||||
int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
|
||||
{
|
||||
int ch;
|
||||
|
||||
FF_ALLOC_OR_GOTO(s->avctx, s->windowed_samples, AC3_WINDOW_SIZE *
|
||||
sizeof(*s->windowed_samples), alloc_fail);
|
||||
FF_ALLOC_OR_GOTO(s->avctx, s->planar_samples, s->channels * sizeof(*s->planar_samples),
|
||||
alloc_fail);
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
FF_ALLOCZ_OR_GOTO(s->avctx, s->planar_samples[ch],
|
||||
(AC3_FRAME_SIZE+AC3_BLOCK_SIZE) * sizeof(**s->planar_samples),
|
||||
alloc_fail);
|
||||
}
|
||||
|
||||
return 0;
|
||||
alloc_fail:
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deinterleave input samples.
|
||||
* Channels are reordered from Libav's default order to AC-3 order.
|
||||
*/
|
||||
void AC3_NAME(deinterleave_input_samples)(AC3EncodeContext *s,
|
||||
const SampleType *samples)
|
||||
{
|
||||
int ch, i;
|
||||
|
||||
/* deinterleave and remap input samples */
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
const SampleType *sptr;
|
||||
int sinc;
|
||||
|
||||
/* copy last 256 samples of previous frame to the start of the current frame */
|
||||
memcpy(&s->planar_samples[ch][0], &s->planar_samples[ch][AC3_FRAME_SIZE],
|
||||
AC3_BLOCK_SIZE * sizeof(s->planar_samples[0][0]));
|
||||
|
||||
/* deinterleave */
|
||||
sinc = s->channels;
|
||||
sptr = samples + s->channel_map[ch];
|
||||
for (i = AC3_BLOCK_SIZE; i < AC3_FRAME_SIZE+AC3_BLOCK_SIZE; i++) {
|
||||
s->planar_samples[ch][i] = *sptr;
|
||||
sptr += sinc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Apply the MDCT to input samples to generate frequency coefficients.
|
||||
* This applies the KBD window and normalizes the input to reduce precision
|
||||
* loss due to fixed-point calculations.
|
||||
*/
|
||||
void AC3_NAME(apply_mdct)(AC3EncodeContext *s)
|
||||
{
|
||||
int blk, ch;
|
||||
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
const SampleType *input_samples = &s->planar_samples[ch][blk * AC3_BLOCK_SIZE];
|
||||
|
||||
s->apply_window(&s->dsp, s->windowed_samples, input_samples,
|
||||
s->mdct->window, AC3_WINDOW_SIZE);
|
||||
|
||||
if (s->fixed_point)
|
||||
block->coeff_shift[ch+1] = s->normalize_samples(s);
|
||||
|
||||
s->mdct->fft.mdct_calcw(&s->mdct->fft, block->mdct_coef[ch+1],
|
||||
s->windowed_samples);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate a single coupling coordinate.
|
||||
*/
|
||||
static inline float calc_cpl_coord(float energy_ch, float energy_cpl)
|
||||
{
|
||||
float coord = 0.125;
|
||||
if (energy_cpl > 0)
|
||||
coord *= sqrtf(energy_ch / energy_cpl);
|
||||
return coord;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate coupling channel and coupling coordinates.
|
||||
* TODO: Currently this is only used for the floating-point encoder. I was
|
||||
* able to make it work for the fixed-point encoder, but quality was
|
||||
* generally lower in most cases than not using coupling. If a more
|
||||
* adaptive coupling strategy were to be implemented it might be useful
|
||||
* at that time to use coupling for the fixed-point encoder as well.
|
||||
*/
|
||||
void AC3_NAME(apply_channel_coupling)(AC3EncodeContext *s)
|
||||
{
|
||||
#if CONFIG_AC3ENC_FLOAT
|
||||
LOCAL_ALIGNED_16(float, cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);
|
||||
LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);
|
||||
int blk, ch, bnd, i, j;
|
||||
CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};
|
||||
int cpl_start, num_cpl_coefs;
|
||||
|
||||
memset(cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords));
|
||||
memset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*fixed_cpl_coords));
|
||||
|
||||
/* align start to 16-byte boundary. align length to multiple of 32.
|
||||
note: coupling start bin % 4 will always be 1 */
|
||||
cpl_start = s->start_freq[CPL_CH] - 1;
|
||||
num_cpl_coefs = FFALIGN(s->num_cpl_subbands * 12 + 1, 32);
|
||||
cpl_start = FFMIN(256, cpl_start + num_cpl_coefs) - num_cpl_coefs;
|
||||
|
||||
/* calculate coupling channel from fbw channels */
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
CoefType *cpl_coef = &block->mdct_coef[CPL_CH][cpl_start];
|
||||
if (!block->cpl_in_use)
|
||||
continue;
|
||||
memset(cpl_coef, 0, num_cpl_coefs * sizeof(*cpl_coef));
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
CoefType *ch_coef = &block->mdct_coef[ch][cpl_start];
|
||||
if (!block->channel_in_cpl[ch])
|
||||
continue;
|
||||
for (i = 0; i < num_cpl_coefs; i++)
|
||||
cpl_coef[i] += ch_coef[i];
|
||||
}
|
||||
|
||||
/* coefficients must be clipped to +/- 1.0 in order to be encoded */
|
||||
s->dsp.vector_clipf(cpl_coef, cpl_coef, -1.0f, 1.0f, num_cpl_coefs);
|
||||
|
||||
/* scale coupling coefficients from float to 24-bit fixed-point */
|
||||
s->ac3dsp.float_to_fixed24(&block->fixed_coef[CPL_CH][cpl_start],
|
||||
cpl_coef, num_cpl_coefs);
|
||||
}
|
||||
|
||||
/* calculate energy in each band in coupling channel and each fbw channel */
|
||||
/* TODO: possibly use SIMD to speed up energy calculation */
|
||||
bnd = 0;
|
||||
i = s->start_freq[CPL_CH];
|
||||
while (i < s->cpl_end_freq) {
|
||||
int band_size = s->cpl_band_sizes[bnd];
|
||||
for (ch = CPL_CH; ch <= s->fbw_channels; ch++) {
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch]))
|
||||
continue;
|
||||
for (j = 0; j < band_size; j++) {
|
||||
CoefType v = block->mdct_coef[ch][i+j];
|
||||
MAC_COEF(energy[blk][ch][bnd], v, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
i += band_size;
|
||||
bnd++;
|
||||
}
|
||||
|
||||
/* determine which blocks to send new coupling coordinates for */
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
AC3Block *block0 = blk ? &s->blocks[blk-1] : NULL;
|
||||
int new_coords = 0;
|
||||
CoefSumType coord_diff[AC3_MAX_CHANNELS] = {0,};
|
||||
|
||||
if (block->cpl_in_use) {
|
||||
/* calculate coupling coordinates for all blocks and calculate the
|
||||
average difference between coordinates in successive blocks */
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
if (!block->channel_in_cpl[ch])
|
||||
continue;
|
||||
|
||||
for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
|
||||
cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy[blk][ch][bnd],
|
||||
energy[blk][CPL_CH][bnd]);
|
||||
if (blk > 0 && block0->cpl_in_use &&
|
||||
block0->channel_in_cpl[ch]) {
|
||||
coord_diff[ch] += fabs(cpl_coords[blk-1][ch][bnd] -
|
||||
cpl_coords[blk ][ch][bnd]);
|
||||
}
|
||||
}
|
||||
coord_diff[ch] /= s->num_cpl_bands;
|
||||
}
|
||||
|
||||
/* send new coordinates if this is the first block, if previous
|
||||
* block did not use coupling but this block does, the channels
|
||||
* using coupling has changed from the previous block, or the
|
||||
* coordinate difference from the last block for any channel is
|
||||
* greater than a threshold value. */
|
||||
if (blk == 0) {
|
||||
new_coords = 1;
|
||||
} else if (!block0->cpl_in_use) {
|
||||
new_coords = 1;
|
||||
} else {
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
if (block->channel_in_cpl[ch] && !block0->channel_in_cpl[ch]) {
|
||||
new_coords = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!new_coords) {
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
if (block->channel_in_cpl[ch] && coord_diff[ch] > 0.04) {
|
||||
new_coords = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
block->new_cpl_coords = new_coords;
|
||||
}
|
||||
|
||||
/* calculate final coupling coordinates, taking into account reusing of
|
||||
coordinates in successive blocks */
|
||||
for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
|
||||
blk = 0;
|
||||
while (blk < AC3_MAX_BLOCKS) {
|
||||
int blk1;
|
||||
CoefSumType energy_cpl;
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
|
||||
if (!block->cpl_in_use) {
|
||||
blk++;
|
||||
continue;
|
||||
}
|
||||
|
||||
energy_cpl = energy[blk][CPL_CH][bnd];
|
||||
blk1 = blk+1;
|
||||
while (!s->blocks[blk1].new_cpl_coords && blk1 < AC3_MAX_BLOCKS) {
|
||||
if (s->blocks[blk1].cpl_in_use)
|
||||
energy_cpl += energy[blk1][CPL_CH][bnd];
|
||||
blk1++;
|
||||
}
|
||||
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
CoefType energy_ch;
|
||||
if (!block->channel_in_cpl[ch])
|
||||
continue;
|
||||
energy_ch = energy[blk][ch][bnd];
|
||||
blk1 = blk+1;
|
||||
while (!s->blocks[blk1].new_cpl_coords && blk1 < AC3_MAX_BLOCKS) {
|
||||
if (s->blocks[blk1].cpl_in_use)
|
||||
energy_ch += energy[blk1][ch][bnd];
|
||||
blk1++;
|
||||
}
|
||||
cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy_ch, energy_cpl);
|
||||
}
|
||||
blk = blk1;
|
||||
}
|
||||
}
|
||||
|
||||
/* calculate exponents/mantissas for coupling coordinates */
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
AC3Block *block = &s->blocks[blk];
|
||||
if (!block->cpl_in_use || !block->new_cpl_coords)
|
||||
continue;
|
||||
|
||||
s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1],
|
||||
cpl_coords[blk][1],
|
||||
s->fbw_channels * 16);
|
||||
s->ac3dsp.extract_exponents(block->cpl_coord_exp[1],
|
||||
fixed_cpl_coords[blk][1],
|
||||
s->fbw_channels * 16);
|
||||
|
||||
for (ch = 1; ch <= s->fbw_channels; ch++) {
|
||||
int bnd, min_exp, max_exp, master_exp;
|
||||
|
||||
/* determine master exponent */
|
||||
min_exp = max_exp = block->cpl_coord_exp[ch][0];
|
||||
for (bnd = 1; bnd < s->num_cpl_bands; bnd++) {
|
||||
int exp = block->cpl_coord_exp[ch][bnd];
|
||||
min_exp = FFMIN(exp, min_exp);
|
||||
max_exp = FFMAX(exp, max_exp);
|
||||
}
|
||||
master_exp = ((max_exp - 15) + 2) / 3;
|
||||
master_exp = FFMAX(master_exp, 0);
|
||||
while (min_exp < master_exp * 3)
|
||||
master_exp--;
|
||||
for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
|
||||
block->cpl_coord_exp[ch][bnd] = av_clip(block->cpl_coord_exp[ch][bnd] -
|
||||
master_exp * 3, 0, 15);
|
||||
}
|
||||
block->cpl_master_exp[ch] = master_exp;
|
||||
|
||||
/* quantize mantissas */
|
||||
for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
|
||||
int cpl_exp = block->cpl_coord_exp[ch][bnd];
|
||||
int cpl_mant = (fixed_cpl_coords[blk][ch][bnd] << (5 + cpl_exp + master_exp * 3)) >> 24;
|
||||
if (cpl_exp == 15)
|
||||
cpl_mant >>= 1;
|
||||
else
|
||||
cpl_mant -= 16;
|
||||
|
||||
block->cpl_coord_mant[ch][bnd] = cpl_mant;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CONFIG_EAC3_ENCODER && s->eac3)
|
||||
ff_eac3_set_cpl_states(s);
|
||||
#endif /* CONFIG_AC3ENC_FLOAT */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine rematrixing flags for each block and band.
|
||||
*/
|
||||
void AC3_NAME(compute_rematrixing_strategy)(AC3EncodeContext *s)
|
||||
{
|
||||
int nb_coefs;
|
||||
int blk, bnd, i;
|
||||
AC3Block *block, *av_uninit(block0);
|
||||
|
||||
if (s->channel_mode != AC3_CHMODE_STEREO)
|
||||
return;
|
||||
|
||||
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
|
||||
block = &s->blocks[blk];
|
||||
block->new_rematrixing_strategy = !blk;
|
||||
|
||||
if (!s->rematrixing_enabled) {
|
||||
block0 = block;
|
||||
continue;
|
||||
}
|
||||
|
||||
block->num_rematrixing_bands = 4;
|
||||
if (block->cpl_in_use) {
|
||||
block->num_rematrixing_bands -= (s->start_freq[CPL_CH] <= 61);
|
||||
block->num_rematrixing_bands -= (s->start_freq[CPL_CH] == 37);
|
||||
if (blk && block->num_rematrixing_bands != block0->num_rematrixing_bands)
|
||||
block->new_rematrixing_strategy = 1;
|
||||
}
|
||||
nb_coefs = FFMIN(block->end_freq[1], block->end_freq[2]);
|
||||
|
||||
for (bnd = 0; bnd < block->num_rematrixing_bands; bnd++) {
|
||||
/* calculate calculate sum of squared coeffs for one band in one block */
|
||||
int start = ff_ac3_rematrix_band_tab[bnd];
|
||||
int end = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]);
|
||||
CoefSumType sum[4] = {0,};
|
||||
for (i = start; i < end; i++) {
|
||||
CoefType lt = block->mdct_coef[1][i];
|
||||
CoefType rt = block->mdct_coef[2][i];
|
||||
CoefType md = lt + rt;
|
||||
CoefType sd = lt - rt;
|
||||
MAC_COEF(sum[0], lt, lt);
|
||||
MAC_COEF(sum[1], rt, rt);
|
||||
MAC_COEF(sum[2], md, md);
|
||||
MAC_COEF(sum[3], sd, sd);
|
||||
}
|
||||
|
||||
/* compare sums to determine if rematrixing will be used for this band */
|
||||
if (FFMIN(sum[2], sum[3]) < FFMIN(sum[0], sum[1]))
|
||||
block->rematrixing_flags[bnd] = 1;
|
||||
else
|
||||
block->rematrixing_flags[bnd] = 0;
|
||||
|
||||
/* determine if new rematrixing flags will be sent */
|
||||
if (blk &&
|
||||
block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) {
|
||||
block->new_rematrixing_strategy = 1;
|
||||
}
|
||||
}
|
||||
block0 = block;
|
||||
}
|
||||
}
|
@ -138,6 +138,13 @@ const uint16_t ff_ac3_bitrate_tab[19] = {
|
||||
*/
|
||||
const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 };
|
||||
|
||||
/**
|
||||
* Table E2.16 Default Coupling Banding Structure
|
||||
*/
|
||||
const uint8_t ff_eac3_default_cpl_band_struct[18] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1
|
||||
};
|
||||
|
||||
/* AC-3 MDCT window */
|
||||
|
||||
/* MDCT window */
|
||||
|
@ -39,6 +39,7 @@ extern const uint8_t ff_ac3_dec_channel_map[8][2][6];
|
||||
extern const uint16_t ff_ac3_sample_rate_tab[3];
|
||||
extern const uint16_t ff_ac3_bitrate_tab[19];
|
||||
extern const uint8_t ff_ac3_rematrix_band_tab[5];
|
||||
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
|
||||
extern const int16_t ff_ac3_window[AC3_WINDOW_SIZE/2];
|
||||
extern const uint8_t ff_ac3_log_add_tab[260];
|
||||
extern const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3];
|
||||
|
@ -93,16 +93,6 @@ const uint8_t ff_fc_4pulses_8bits_track_4[32] =
|
||||
78, 79,
|
||||
};
|
||||
|
||||
#if 0
|
||||
static uint8_t gray_decode[32] =
|
||||
{
|
||||
0, 1, 3, 2, 7, 6, 4, 5,
|
||||
15, 14, 12, 13, 8, 9, 11, 10,
|
||||
31, 30, 28, 29, 24, 25, 27, 26,
|
||||
16, 17, 19, 18, 23, 22, 20, 21
|
||||
};
|
||||
#endif
|
||||
|
||||
const float ff_pow_0_7[10] = {
|
||||
0.700000, 0.490000, 0.343000, 0.240100, 0.168070,
|
||||
0.117649, 0.082354, 0.057648, 0.040354, 0.028248
|
||||
|
@ -389,6 +389,11 @@ static av_cold int alac_encode_init(AVCodecContext *avctx)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(avctx->channels > 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "channels > 2 not supported\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
// Set default compression level
|
||||
if(avctx->compression_level == FF_COMPRESSION_DEFAULT)
|
||||
s->compression_level = 2;
|
||||
|
@ -104,6 +104,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_DECODER (EIGHTBPS, eightbps);
|
||||
REGISTER_DECODER (EIGHTSVX_EXP, eightsvx_exp);
|
||||
REGISTER_DECODER (EIGHTSVX_FIB, eightsvx_fib);
|
||||
REGISTER_DECODER (EIGHTSVX_RAW, eightsvx_raw);
|
||||
REGISTER_DECODER (ESCAPE124, escape124);
|
||||
REGISTER_ENCDEC (FFV1, ffv1);
|
||||
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
|
||||
@ -130,6 +131,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_DECODER (INDEO3, indeo3);
|
||||
REGISTER_DECODER (INDEO5, indeo5);
|
||||
REGISTER_DECODER (INTERPLAY_VIDEO, interplay_video);
|
||||
REGISTER_DECODER (JPEG2000, jpeg2000);
|
||||
REGISTER_ENCDEC (JPEGLS, jpegls);
|
||||
REGISTER_DECODER (JV, jv);
|
||||
REGISTER_DECODER (KGV1, kgv1);
|
||||
@ -154,7 +156,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_DECODER (MPEG1_VDPAU, mpeg1_vdpau);
|
||||
REGISTER_DECODER (MPEG2_CRYSTALHD, mpeg2_crystalhd);
|
||||
REGISTER_DECODER (MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
|
||||
REGISTER_ENCDEC (MSMPEG4V1, msmpeg4v1);
|
||||
REGISTER_DECODER (MSMPEG4V1, msmpeg4v1);
|
||||
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
|
||||
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
|
||||
REGISTER_DECODER (MSRLE, msrle);
|
||||
@ -251,7 +253,7 @@ void avcodec_register_all(void)
|
||||
REGISTER_DECODER (COOK, cook);
|
||||
REGISTER_ENCDEC (DCA, dca);
|
||||
REGISTER_DECODER (DSICINAUDIO, dsicinaudio);
|
||||
REGISTER_DECODER (EAC3, eac3);
|
||||
REGISTER_ENCDEC (EAC3, eac3);
|
||||
REGISTER_ENCDEC (FLAC, flac);
|
||||
REGISTER_DECODER (GSM, gsm);
|
||||
REGISTER_DECODER (GSM_MS, gsm_ms);
|
||||
|
@ -1887,4 +1887,4 @@ static const uint16_t cf_sizes_wb[] = {
|
||||
40 /// SID/comfort noise frame
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_AMRWBDATA_H */
|
||||
|
@ -5,6 +5,9 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
|
||||
|
||||
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
|
||||
|
||||
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
|
||||
ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
|
||||
|
||||
OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
|
||||
OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o
|
||||
OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o
|
||||
|
@ -30,17 +30,17 @@ static inline float *VMUL2(float *dst, const float *v, unsigned idx,
|
||||
const float *scale)
|
||||
{
|
||||
unsigned v0, v1;
|
||||
__asm__ volatile ("ubfx %0, %4, #0, #4 \n\t"
|
||||
"ubfx %1, %4, #4, #4 \n\t"
|
||||
"ldr %0, [%3, %0, lsl #2] \n\t"
|
||||
"ldr %1, [%3, %1, lsl #2] \n\t"
|
||||
"vld1.32 {d1[]}, [%5,:32] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"vmul.f32 d0, d0, d1 \n\t"
|
||||
"vst1.32 {d0}, [%2,:64]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "+r"(dst)
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "d0", "d1");
|
||||
__asm__ ("ubfx %0, %6, #0, #4 \n\t"
|
||||
"ubfx %1, %6, #4, #4 \n\t"
|
||||
"ldr %0, [%5, %0, lsl #2] \n\t"
|
||||
"ldr %1, [%5, %1, lsl #2] \n\t"
|
||||
"vld1.32 {d1[]}, [%7,:32] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"vmul.f32 d0, d0, d1 \n\t"
|
||||
"vst1.32 {d0}, [%2,:64]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "+r"(dst), "=m"(dst[0]), "=m"(dst[1])
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "d0", "d1");
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -49,22 +49,23 @@ static inline float *VMUL4(float *dst, const float *v, unsigned idx,
|
||||
const float *scale)
|
||||
{
|
||||
unsigned v0, v1, v2, v3;
|
||||
__asm__ volatile ("ubfx %0, %6, #0, #2 \n\t"
|
||||
"ubfx %1, %6, #2, #2 \n\t"
|
||||
"ldr %0, [%5, %0, lsl #2] \n\t"
|
||||
"ubfx %2, %6, #4, #2 \n\t"
|
||||
"ldr %1, [%5, %1, lsl #2] \n\t"
|
||||
"ubfx %3, %6, #6, #2 \n\t"
|
||||
"ldr %2, [%5, %2, lsl #2] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"ldr %3, [%5, %3, lsl #2] \n\t"
|
||||
"vld1.32 {d2[],d3[]},[%7,:32] \n\t"
|
||||
"vmov d1, %2, %3 \n\t"
|
||||
"vmul.f32 q0, q0, q1 \n\t"
|
||||
"vst1.32 {q0}, [%4,:128]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst)
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "d0", "d1", "d2", "d3");
|
||||
__asm__ ("ubfx %0, %10, #0, #2 \n\t"
|
||||
"ubfx %1, %10, #2, #2 \n\t"
|
||||
"ldr %0, [%9, %0, lsl #2] \n\t"
|
||||
"ubfx %2, %10, #4, #2 \n\t"
|
||||
"ldr %1, [%9, %1, lsl #2] \n\t"
|
||||
"ubfx %3, %10, #6, #2 \n\t"
|
||||
"ldr %2, [%9, %2, lsl #2] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"ldr %3, [%9, %3, lsl #2] \n\t"
|
||||
"vld1.32 {d2[],d3[]},[%11,:32] \n\t"
|
||||
"vmov d1, %2, %3 \n\t"
|
||||
"vmul.f32 q0, q0, q1 \n\t"
|
||||
"vst1.32 {q0}, [%4,:128]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
|
||||
"=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3])
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "d0", "d1", "d2", "d3");
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -73,22 +74,23 @@ static inline float *VMUL2S(float *dst, const float *v, unsigned idx,
|
||||
unsigned sign, const float *scale)
|
||||
{
|
||||
unsigned v0, v1, v2, v3;
|
||||
__asm__ volatile ("ubfx %0, %6, #0, #4 \n\t"
|
||||
"ubfx %1, %6, #4, #4 \n\t"
|
||||
"ldr %0, [%5, %0, lsl #2] \n\t"
|
||||
"lsl %2, %8, #30 \n\t"
|
||||
"ldr %1, [%5, %1, lsl #2] \n\t"
|
||||
"lsl %3, %8, #31 \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"bic %2, %2, #1<<30 \n\t"
|
||||
"vld1.32 {d1[]}, [%7,:32] \n\t"
|
||||
"vmov d2, %2, %3 \n\t"
|
||||
"veor d0, d0, d2 \n\t"
|
||||
"vmul.f32 d0, d0, d1 \n\t"
|
||||
"vst1.32 {d0}, [%4,:64]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst)
|
||||
: "r"(v), "r"(idx), "r"(scale), "r"(sign)
|
||||
: "d0", "d1", "d2");
|
||||
__asm__ ("ubfx %0, %8, #0, #4 \n\t"
|
||||
"ubfx %1, %8, #4, #4 \n\t"
|
||||
"ldr %0, [%7, %0, lsl #2] \n\t"
|
||||
"lsl %2, %10, #30 \n\t"
|
||||
"ldr %1, [%7, %1, lsl #2] \n\t"
|
||||
"lsl %3, %10, #31 \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"bic %2, %2, #1<<30 \n\t"
|
||||
"vld1.32 {d1[]}, [%9,:32] \n\t"
|
||||
"vmov d2, %2, %3 \n\t"
|
||||
"veor d0, d0, d2 \n\t"
|
||||
"vmul.f32 d0, d0, d1 \n\t"
|
||||
"vst1.32 {d0}, [%4,:64]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
|
||||
"=m"(dst[0]), "=m"(dst[1])
|
||||
: "r"(v), "r"(idx), "r"(scale), "r"(sign)
|
||||
: "d0", "d1", "d2");
|
||||
return dst;
|
||||
}
|
||||
|
||||
@ -97,38 +99,39 @@ static inline float *VMUL4S(float *dst, const float *v, unsigned idx,
|
||||
unsigned sign, const float *scale)
|
||||
{
|
||||
unsigned v0, v1, v2, v3, nz;
|
||||
__asm__ volatile ("vld1.32 {d2[],d3[]},[%9,:32] \n\t"
|
||||
"ubfx %0, %8, #0, #2 \n\t"
|
||||
"ubfx %1, %8, #2, #2 \n\t"
|
||||
"ldr %0, [%7, %0, lsl #2] \n\t"
|
||||
"ubfx %2, %8, #4, #2 \n\t"
|
||||
"ldr %1, [%7, %1, lsl #2] \n\t"
|
||||
"ubfx %3, %8, #6, #2 \n\t"
|
||||
"ldr %2, [%7, %2, lsl #2] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"ldr %3, [%7, %3, lsl #2] \n\t"
|
||||
"lsr %6, %8, #12 \n\t"
|
||||
"rbit %6, %6 \n\t"
|
||||
"vmov d1, %2, %3 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %0, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %1, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %2, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"vmov d4, %0, %1 \n\t"
|
||||
"and %3, %5, #1<<31 \n\t"
|
||||
"vmov d5, %2, %3 \n\t"
|
||||
"veor q0, q0, q2 \n\t"
|
||||
"vmul.f32 q0, q0, q1 \n\t"
|
||||
"vst1.32 {q0}, [%4,:128]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
|
||||
"+r"(sign), "=r"(nz)
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "d0", "d1", "d2", "d3", "d4", "d5");
|
||||
__asm__ ("vld1.32 {d2[],d3[]},[%13,:32] \n\t"
|
||||
"ubfx %0, %12, #0, #2 \n\t"
|
||||
"ubfx %1, %12, #2, #2 \n\t"
|
||||
"ldr %0, [%11,%0, lsl #2] \n\t"
|
||||
"ubfx %2, %12, #4, #2 \n\t"
|
||||
"ldr %1, [%11,%1, lsl #2] \n\t"
|
||||
"ubfx %3, %12, #6, #2 \n\t"
|
||||
"ldr %2, [%11,%2, lsl #2] \n\t"
|
||||
"vmov d0, %0, %1 \n\t"
|
||||
"ldr %3, [%11,%3, lsl #2] \n\t"
|
||||
"lsr %6, %12, #12 \n\t"
|
||||
"rbit %6, %6 \n\t"
|
||||
"vmov d1, %2, %3 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %0, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %1, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"lsls %6, %6, #1 \n\t"
|
||||
"and %2, %5, #1<<31 \n\t"
|
||||
"lslcs %5, %5, #1 \n\t"
|
||||
"vmov d4, %0, %1 \n\t"
|
||||
"and %3, %5, #1<<31 \n\t"
|
||||
"vmov d5, %2, %3 \n\t"
|
||||
"veor q0, q0, q2 \n\t"
|
||||
"vmul.f32 q0, q0, q1 \n\t"
|
||||
"vst1.32 {q0}, [%4,:128]! \n\t"
|
||||
: "=&r"(v0), "=&r"(v1), "=&r"(v2), "=&r"(v3), "+r"(dst),
|
||||
"+r"(sign), "=r"(nz),
|
||||
"=m"(dst[0]), "=m"(dst[1]), "=m"(dst[2]), "=m"(dst[3])
|
||||
: "r"(v), "r"(idx), "r"(scale)
|
||||
: "cc", "d0", "d1", "d2", "d3", "d4", "d5");
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
@ -20,33 +20,16 @@
|
||||
|
||||
#include "asm.S"
|
||||
|
||||
function ff_ac3_compute_mantissa_size_arm, export=1
|
||||
push {r4-r8,lr}
|
||||
ldm r0, {r4-r8}
|
||||
mov r3, r0
|
||||
mov r0, #0
|
||||
1:
|
||||
function ff_ac3_update_bap_counts_arm, export=1
|
||||
push {lr}
|
||||
ldrb lr, [r1], #1
|
||||
1:
|
||||
lsl r3, lr, #1
|
||||
ldrh r12, [r0, r3]
|
||||
subs r2, r2, #1
|
||||
blt 2f
|
||||
cmp lr, #4
|
||||
bgt 3f
|
||||
subs lr, lr, #1
|
||||
addlt r4, r4, #1
|
||||
addeq r5, r5, #1
|
||||
ble 1b
|
||||
subs lr, lr, #2
|
||||
addlt r6, r6, #1
|
||||
addeq r7, r7, #1
|
||||
addgt r8, r8, #1
|
||||
b 1b
|
||||
3:
|
||||
cmp lr, #14
|
||||
sublt lr, lr, #1
|
||||
addgt r0, r0, #16
|
||||
addle r0, r0, lr
|
||||
b 1b
|
||||
2:
|
||||
stm r3, {r4-r8}
|
||||
pop {r4-r8,pc}
|
||||
ldrbgt lr, [r1], #1
|
||||
add r12, r12, #1
|
||||
strh r12, [r0, r3]
|
||||
bgt 1b
|
||||
pop {pc}
|
||||
endfunc
|
||||
|
@ -35,11 +35,11 @@ void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
|
||||
int snr_offset, int floor,
|
||||
const uint8_t *bap_tab, uint8_t *bap);
|
||||
|
||||
int ff_ac3_compute_mantissa_size_arm(int cnt[5], uint8_t *bap, int nb_coefs);
|
||||
void ff_ac3_update_bap_counts_arm(uint16_t mant_cnt[16], uint8_t *bap, int len);
|
||||
|
||||
av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
|
||||
{
|
||||
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_arm;
|
||||
c->update_bap_counts = ff_ac3_update_bap_counts_arm;
|
||||
|
||||
if (HAVE_ARMV6) {
|
||||
c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6;
|
||||
|
@ -36,4 +36,4 @@
|
||||
#define H263_AIC 0xf0
|
||||
#define INTER_SCANTAB_RASTER_END 0x138
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_ARM_ASM_OFFSETS_H */
|
||||
|
@ -26,6 +26,8 @@
|
||||
# define ELF @
|
||||
#endif
|
||||
|
||||
.syntax unified
|
||||
|
||||
.macro require8 val=1
|
||||
ELF .eabi_attribute 24, \val
|
||||
.endm
|
||||
|
@ -30,4 +30,4 @@ void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx);
|
||||
void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx);
|
||||
void ff_dsputil_init_iwmmxt(DSPContext* c, AVCodecContext *avctx);
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_ARM_DSPUTIL_H */
|
||||
|
@ -28,6 +28,7 @@ void ff_vector_fmul_reverse_vfp(float *dst, const float *src0,
|
||||
|
||||
void ff_dsputil_init_vfp(DSPContext* c, AVCodecContext *avctx)
|
||||
{
|
||||
c->vector_fmul = ff_vector_fmul_vfp;
|
||||
if (!HAVE_VFPV3)
|
||||
c->vector_fmul = ff_vector_fmul_vfp;
|
||||
c->vector_fmul_reverse = ff_vector_fmul_reverse_vfp;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "config.h"
|
||||
#include "asm.S"
|
||||
|
||||
.syntax unified
|
||||
/*
|
||||
* VFP is a floating point coprocessor used in some ARM cores. VFP11 has 1 cycle
|
||||
* throughput for almost all the instructions (except for double precision
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "config.h"
|
||||
#include "asm.S"
|
||||
|
||||
.syntax unified
|
||||
|
||||
/**
|
||||
* ARM VFP optimized float to int16 conversion.
|
||||
* Assume that len is a positive number and is multiple of 8, destination
|
||||
|
@ -148,24 +148,27 @@ function ff_h264_idct_add8_neon, export=1
|
||||
add r5, r1, #16*4
|
||||
add r1, r2, #16*32
|
||||
mov r2, r3
|
||||
mov r3, r1
|
||||
ldr r6, [sp, #32]
|
||||
movrel r7, scan8+16
|
||||
mov ip, #7
|
||||
1: ldrb r8, [r7], #1
|
||||
ldr r0, [r5], #4
|
||||
mov r12, #0
|
||||
1: ldrb r8, [r7, r12]
|
||||
ldr r0, [r5, r12, lsl #2]
|
||||
ldrb r8, [r6, r8]
|
||||
tst ip, #4
|
||||
addne r0, r0, r4
|
||||
addeq r0, r0, r9
|
||||
add r0, r0, r4
|
||||
add r1, r3, r12, lsl #5
|
||||
cmp r8, #0
|
||||
ldrsh r8, [r1]
|
||||
adrne lr, ff_h264_idct_add_neon
|
||||
adreq lr, ff_h264_idct_dc_add_neon
|
||||
cmpeq r8, #0
|
||||
blxne lr
|
||||
subs ip, ip, #1
|
||||
add r1, r1, #32
|
||||
bge 1b
|
||||
add r12, r12, #1
|
||||
cmp r12, #4
|
||||
moveq r12, #16
|
||||
moveq r4, r9
|
||||
cmp r12, #20
|
||||
blt 1b
|
||||
pop {r4-r10,pc}
|
||||
endfunc
|
||||
|
||||
@ -374,11 +377,15 @@ function ff_h264_idct8_add4_neon, export=1
|
||||
endfunc
|
||||
|
||||
.section .rodata
|
||||
scan8: .byte 4+1*8, 5+1*8, 4+2*8, 5+2*8
|
||||
.byte 6+1*8, 7+1*8, 6+2*8, 7+2*8
|
||||
.byte 4+3*8, 5+3*8, 4+4*8, 5+4*8
|
||||
.byte 6+3*8, 7+3*8, 6+4*8, 7+4*8
|
||||
.byte 1+1*8, 2+1*8
|
||||
.byte 1+2*8, 2+2*8
|
||||
.byte 1+4*8, 2+4*8
|
||||
.byte 1+5*8, 2+5*8
|
||||
scan8: .byte 4+ 1*8, 5+ 1*8, 4+ 2*8, 5+ 2*8
|
||||
.byte 6+ 1*8, 7+ 1*8, 6+ 2*8, 7+ 2*8
|
||||
.byte 4+ 3*8, 5+ 3*8, 4+ 4*8, 5+ 4*8
|
||||
.byte 6+ 3*8, 7+ 3*8, 6+ 4*8, 7+ 4*8
|
||||
.byte 4+ 6*8, 5+ 6*8, 4+ 7*8, 5+ 7*8
|
||||
.byte 6+ 6*8, 7+ 6*8, 6+ 7*8, 7+ 7*8
|
||||
.byte 4+ 8*8, 5+ 8*8, 4+ 9*8, 5+ 9*8
|
||||
.byte 6+ 8*8, 7+ 8*8, 6+ 9*8, 7+ 9*8
|
||||
.byte 4+11*8, 5+11*8, 4+12*8, 5+12*8
|
||||
.byte 6+11*8, 7+11*8, 6+12*8, 7+12*8
|
||||
.byte 4+13*8, 5+13*8, 4+14*8, 5+14*8
|
||||
.byte 6+13*8, 7+13*8, 6+14*8, 7+14*8
|
||||
|
@ -54,18 +54,13 @@
|
||||
#define FIX_M_1_961570560_ID 40
|
||||
#define FIX_M_2_562915447_ID 44
|
||||
#define FIX_0xFFFF_ID 48
|
||||
.text
|
||||
.align
|
||||
|
||||
function ff_j_rev_dct_arm, export=1
|
||||
stmdb sp!, { r4 - r12, lr } @ all callee saved regs
|
||||
|
||||
sub sp, sp, #4 @ reserve some space on the stack
|
||||
str r0, [ sp ] @ save the DCT pointer to the stack
|
||||
push {r0, r4 - r11, lr}
|
||||
|
||||
mov lr, r0 @ lr = pointer to the current row
|
||||
mov r12, #8 @ r12 = row-counter
|
||||
adr r11, const_array @ r11 = base pointer to the constants array
|
||||
movrel r11, const_array @ r11 = base pointer to the constants array
|
||||
row_loop:
|
||||
ldrsh r0, [lr, # 0] @ r0 = 'd0'
|
||||
ldrsh r2, [lr, # 2] @ r2 = 'd2'
|
||||
@ -102,7 +97,7 @@ row_loop:
|
||||
add r4, r6, r3, lsl #13 @ r4 = tmp11
|
||||
rsb r3, r6, r3, lsl #13 @ r3 = tmp12
|
||||
|
||||
stmdb sp!, { r0, r2, r3, r4 } @ save on the stack tmp10, tmp13, tmp12, tmp11
|
||||
push {r0, r2, r3, r4} @ save on the stack tmp10, tmp13, tmp12, tmp11
|
||||
|
||||
ldrsh r3, [lr, #10] @ r3 = 'd3'
|
||||
ldrsh r5, [lr, #12] @ r5 = 'd5'
|
||||
@ -136,8 +131,8 @@ row_loop:
|
||||
add r3, r3, r4 @ r3 = tmp2
|
||||
add r1, r1, r6 @ r1 = tmp3
|
||||
|
||||
ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp12 / r6 = tmp11
|
||||
@ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0
|
||||
pop {r0, r2, r4, r6} @ r0 = tmp10 / r2 = tmp13 / r4 = tmp12 / r6 = tmp11
|
||||
@ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0
|
||||
|
||||
@ Compute DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS)
|
||||
add r8, r0, r1
|
||||
@ -211,7 +206,7 @@ end_of_row_loop:
|
||||
|
||||
start_column_loop:
|
||||
@ Start of column loop
|
||||
ldr lr, [ sp ]
|
||||
pop {lr}
|
||||
mov r12, #8
|
||||
column_loop:
|
||||
ldrsh r0, [lr, #( 0*8)] @ r0 = 'd0'
|
||||
@ -245,7 +240,7 @@ column_loop:
|
||||
orrs r10, r9, r10
|
||||
beq empty_odd_column
|
||||
|
||||
stmdb sp!, { r0, r2, r4, r6 } @ save on the stack tmp10, tmp13, tmp12, tmp11
|
||||
push {r0, r2, r4, r6} @ save on the stack tmp10, tmp13, tmp12, tmp11
|
||||
|
||||
add r0, r3, r5 @ r0 = 'z2'
|
||||
add r2, r1, r7 @ r2 = 'z1'
|
||||
@ -275,8 +270,8 @@ column_loop:
|
||||
add r3, r3, r4 @ r3 = tmp2
|
||||
add r1, r1, r6 @ r1 = tmp3
|
||||
|
||||
ldmia sp!, { r0, r2, r4, r6 } @ r0 = tmp10 / r2 = tmp13 / r4 = tmp11 / r6 = tmp12
|
||||
@ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0
|
||||
pop {r0, r2, r4, r6} @ r0 = tmp10 / r2 = tmp13 / r4 = tmp11 / r6 = tmp12
|
||||
@ r1 = tmp3 / r3 = tmp2 / r5 = tmp1 / r7 = tmp0
|
||||
|
||||
@ Compute DESCALE(tmp10 + tmp3, CONST_BITS+PASS1_BITS+3)
|
||||
add r8, r0, r1
|
||||
@ -368,11 +363,10 @@ empty_odd_column:
|
||||
|
||||
the_end:
|
||||
@ The end....
|
||||
add sp, sp, #4
|
||||
ldmia sp!, { r4 - r12, pc } @ restore callee saved regs and return
|
||||
pop {r4 - r11, pc}
|
||||
endfunc
|
||||
|
||||
const_array:
|
||||
.align
|
||||
const const_array
|
||||
.word FIX_0_298631336
|
||||
.word FIX_0_541196100
|
||||
.word FIX_0_765366865
|
||||
@ -386,3 +380,4 @@ const_array:
|
||||
.word FIX_M_1_961570560
|
||||
.word FIX_M_2_562915447
|
||||
.word FIX_0xFFFF
|
||||
endconst
|
||||
|
@ -28,52 +28,16 @@
|
||||
|
||||
#if HAVE_INLINE_ASM
|
||||
|
||||
# define MULL MULL
|
||||
static inline av_const int MULL(int a, int b, unsigned shift)
|
||||
{
|
||||
int lo, hi;
|
||||
__asm__("smull %0, %1, %2, %3 \n\t"
|
||||
"mov %0, %0, lsr %4 \n\t"
|
||||
"add %1, %0, %1, lsl %5 \n\t"
|
||||
: "=&r"(lo), "=&r"(hi)
|
||||
: "r"(b), "r"(a), "ir"(shift), "ir"(32-shift));
|
||||
return hi;
|
||||
}
|
||||
|
||||
#define MULH MULH
|
||||
#if HAVE_ARMV6
|
||||
#define MULH MULH
|
||||
static inline av_const int MULH(int a, int b)
|
||||
{
|
||||
int r;
|
||||
__asm__ ("smmul %0, %1, %2" : "=r"(r) : "r"(a), "r"(b));
|
||||
return r;
|
||||
}
|
||||
#else
|
||||
static inline av_const int MULH(int a, int b)
|
||||
{
|
||||
int lo, hi;
|
||||
__asm__ ("smull %0, %1, %2, %3" : "=&r"(lo), "=&r"(hi) : "r"(b), "r"(a));
|
||||
return hi;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline av_const int64_t MUL64(int a, int b)
|
||||
{
|
||||
union { uint64_t x; unsigned hl[2]; } x;
|
||||
__asm__ ("smull %0, %1, %2, %3"
|
||||
: "=r"(x.hl[0]), "=r"(x.hl[1]) : "r"(a), "r"(b));
|
||||
return x.x;
|
||||
}
|
||||
#define MUL64 MUL64
|
||||
|
||||
static inline av_const int64_t MAC64(int64_t d, int a, int b)
|
||||
{
|
||||
union { uint64_t x; unsigned hl[2]; } x = { d };
|
||||
__asm__ ("smlal %0, %1, %2, %3"
|
||||
: "+r"(x.hl[0]), "+r"(x.hl[1]) : "r"(a), "r"(b));
|
||||
return x.x;
|
||||
}
|
||||
#define MAC64(d, a, b) ((d) = MAC64(d, a, b))
|
||||
#define MLS64(d, a, b) MAC64(d, -(a), b)
|
||||
|
||||
#if HAVE_ARMV5TE
|
||||
@ -97,7 +61,7 @@ static inline av_const int MUL16(int ra, int rb)
|
||||
static inline av_const int mid_pred(int a, int b, int c)
|
||||
{
|
||||
int m;
|
||||
__asm__ volatile (
|
||||
__asm__ (
|
||||
"mov %0, %2 \n\t"
|
||||
"cmp %1, %2 \n\t"
|
||||
"movgt %0, %1 \n\t"
|
||||
@ -107,7 +71,8 @@ static inline av_const int mid_pred(int a, int b, int c)
|
||||
"cmp %0, %1 \n\t"
|
||||
"movgt %0, %1 \n\t"
|
||||
: "=&r"(m), "+r"(a)
|
||||
: "r"(b), "r"(c));
|
||||
: "r"(b), "r"(c)
|
||||
: "cc");
|
||||
return m;
|
||||
}
|
||||
|
||||
|
143
libavcodec/arm/mpegaudiodsp_fixed_armv6.S
Normal file
143
libavcodec/arm/mpegaudiodsp_fixed_armv6.S
Normal file
@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "asm.S"
|
||||
|
||||
.macro skip args:vararg
|
||||
.endm
|
||||
|
||||
.macro sum8 lo, hi, w, p, t1, t2, t3, t4, rsb=skip, offs=0
|
||||
ldr \t1, [\w, #4*\offs]
|
||||
ldr \t2, [\p, #4]!
|
||||
\rsb \t1, \t1, #0
|
||||
.irpc i, 135
|
||||
ldr \t3, [\w, #4*64*\i+4*\offs]
|
||||
ldr \t4, [\p, #4*64*\i]
|
||||
smlal \lo, \hi, \t1, \t2
|
||||
\rsb \t3, \t3, #0
|
||||
ldr \t1, [\w, #4*64*(\i+1)+4*\offs]
|
||||
ldr \t2, [\p, #4*64*(\i+1)]
|
||||
smlal \lo, \hi, \t3, \t4
|
||||
\rsb \t1, \t1, #0
|
||||
.endr
|
||||
ldr \t3, [\w, #4*64*7+4*\offs]
|
||||
ldr \t4, [\p, #4*64*7]
|
||||
smlal \lo, \hi, \t1, \t2
|
||||
\rsb \t3, \t3, #0
|
||||
smlal \lo, \hi, \t3, \t4
|
||||
.endm
|
||||
|
||||
.macro round rd, lo, hi
|
||||
lsr \rd, \lo, #24
|
||||
bic \lo, \lo, #0xff000000
|
||||
orr \rd, \rd, \hi, lsl #8
|
||||
mov \hi, #0
|
||||
ssat \rd, #16, \rd
|
||||
.endm
|
||||
|
||||
function ff_mpadsp_apply_window_fixed_armv6, export=1
|
||||
push {r2,r4-r11,lr}
|
||||
|
||||
add r4, r0, #4*512 @ synth_buf + 512
|
||||
.rept 4
|
||||
ldm r0!, {r5-r12}
|
||||
stm r4!, {r5-r12}
|
||||
.endr
|
||||
|
||||
ldr r4, [sp, #40] @ incr
|
||||
sub r0, r0, #4*17 @ synth_buf + 16
|
||||
ldr r8, [r2] @ sum:low
|
||||
add r2, r0, #4*32 @ synth_buf + 48
|
||||
rsb r5, r4, r4, lsl #5 @ 31 * incr
|
||||
lsl r4, r4, #1
|
||||
asr r9, r8, #31 @ sum:high
|
||||
add r5, r3, r5, lsl #1 @ samples2
|
||||
add r6, r1, #4*32 @ w2
|
||||
str r4, [sp, #40]
|
||||
|
||||
sum8 r8, r9, r1, r0, r10, r11, r12, lr
|
||||
sum8 r8, r9, r1, r2, r10, r11, r12, lr, rsb, 32
|
||||
round r10, r8, r9
|
||||
strh r10, [r3], r4
|
||||
|
||||
mov lr, #15
|
||||
1:
|
||||
ldr r12, [r0, #4]!
|
||||
ldr r11, [r6, #-4]!
|
||||
ldr r10, [r1, #4]!
|
||||
.irpc i, 0246
|
||||
.if \i
|
||||
ldr r11, [r6, #4*64*\i]
|
||||
ldr r10, [r1, #4*64*\i]
|
||||
.endif
|
||||
rsb r11, r11, #0
|
||||
smlal r8, r9, r10, r12
|
||||
ldr r10, [r0, #4*64*(\i+1)]
|
||||
.ifeq \i
|
||||
smull r4, r7, r11, r12
|
||||
.else
|
||||
smlal r4, r7, r11, r12
|
||||
.endif
|
||||
ldr r11, [r6, #4*64*(\i+1)]
|
||||
ldr r12, [r1, #4*64*(\i+1)]
|
||||
rsb r11, r11, #0
|
||||
smlal r8, r9, r12, r10
|
||||
.iflt \i-6
|
||||
ldr r12, [r0, #4*64*(\i+2)]
|
||||
.else
|
||||
ldr r12, [r2, #-4]!
|
||||
.endif
|
||||
smlal r4, r7, r11, r10
|
||||
.endr
|
||||
.irpc i, 0246
|
||||
ldr r10, [r1, #4*64*\i+4*32]
|
||||
rsb r12, r12, #0
|
||||
ldr r11, [r6, #4*64*\i+4*32]
|
||||
smlal r8, r9, r10, r12
|
||||
ldr r10, [r2, #4*64*(\i+1)]
|
||||
smlal r4, r7, r11, r12
|
||||
ldr r12, [r1, #4*64*(\i+1)+4*32]
|
||||
rsb r10, r10, #0
|
||||
ldr r11, [r6, #4*64*(\i+1)+4*32]
|
||||
smlal r8, r9, r12, r10
|
||||
.iflt \i-6
|
||||
ldr r12, [r2, #4*64*(\i+2)]
|
||||
.else
|
||||
ldr r12, [sp, #40]
|
||||
.endif
|
||||
smlal r4, r7, r11, r10
|
||||
.endr
|
||||
round r10, r8, r9
|
||||
adds r8, r8, r4
|
||||
adc r9, r9, r7
|
||||
strh r10, [r3], r12
|
||||
round r11, r8, r9
|
||||
subs lr, lr, #1
|
||||
strh r11, [r5], -r12
|
||||
bgt 1b
|
||||
|
||||
sum8 r8, r9, r1, r0, r10, r11, r12, lr, rsb, 33
|
||||
pop {r4}
|
||||
round r10, r8, r9
|
||||
str r8, [r4]
|
||||
strh r10, [r3]
|
||||
|
||||
pop {r4-r11,pc}
|
||||
endfunc
|
33
libavcodec/arm/mpegaudiodsp_init_arm.c
Normal file
33
libavcodec/arm/mpegaudiodsp_init_arm.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Mans Rullgard
|
||||
*
|
||||
* This file is part of Libav.
|
||||
*
|
||||
* Libav 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.
|
||||
*
|
||||
* Libav 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 Libav; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "libavcodec/mpegaudiodsp.h"
|
||||
#include "config.h"
|
||||
|
||||
void ff_mpadsp_apply_window_fixed_armv6(int32_t *synth_buf, int32_t *window,
|
||||
int *dither, int16_t *out, int incr);
|
||||
|
||||
void ff_mpadsp_init_arm(MPADSPContext *s)
|
||||
{
|
||||
if (HAVE_ARMV6) {
|
||||
s->apply_window_fixed = ff_mpadsp_apply_window_fixed_armv6;
|
||||
}
|
||||
}
|
@ -24,4 +24,4 @@
|
||||
void MPV_common_init_iwmmxt(MpegEncContext *s);
|
||||
void MPV_common_init_armv5te(MpegEncContext *s);
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_ARM_MPEGVIDEO_H */
|
||||
|
@ -35,6 +35,21 @@
|
||||
*
|
||||
* Inner loop should take 6 cycles per element on arm926ej-s (Nokia 770)
|
||||
*/
|
||||
|
||||
.macro dequant_t dst, src, mul, add, tmp
|
||||
rsbs \tmp, ip, \src, asr #16
|
||||
addgt \tmp, \add, #0
|
||||
rsblt \tmp, \add, #0
|
||||
smlatbne \dst, \src, \mul, \tmp
|
||||
.endm
|
||||
|
||||
.macro dequant_b dst, src, mul, add, tmp
|
||||
rsbs \tmp, ip, \src, lsl #16
|
||||
addgt \tmp, \add, #0
|
||||
rsblt \tmp, \add, #0
|
||||
smlabbne \dst, \src, \mul, \tmp
|
||||
.endm
|
||||
|
||||
function ff_dct_unquantize_h263_armv5te, export=1
|
||||
push {r4-r9,lr}
|
||||
mov ip, #0
|
||||
@ -44,50 +59,20 @@ function ff_dct_unquantize_h263_armv5te, export=1
|
||||
1:
|
||||
ldrd r6, [r0, #8]
|
||||
|
||||
rsbs r9, ip, r4, asr #16
|
||||
addgt r9, r2, #0
|
||||
rsblt r9, r2, #0
|
||||
smlatbne r9, r4, r1, r9
|
||||
|
||||
rsbs lr, ip, r5, asr #16
|
||||
addgt lr, r2, #0
|
||||
rsblt lr, r2, #0
|
||||
smlatbne lr, r5, r1, lr
|
||||
|
||||
rsbs r8, ip, r4, asl #16
|
||||
addgt r8, r2, #0
|
||||
rsblt r8, r2, #0
|
||||
smlabbne r4, r4, r1, r8
|
||||
|
||||
rsbs r8, ip, r5, asl #16
|
||||
addgt r8, r2, #0
|
||||
rsblt r8, r2, #0
|
||||
smlabbne r5, r5, r1, r8
|
||||
dequant_t r9, r4, r1, r2, r9
|
||||
dequant_t lr, r5, r1, r2, lr
|
||||
dequant_b r4, r4, r1, r2, r8
|
||||
dequant_b r5, r5, r1, r2, r8
|
||||
|
||||
strh r4, [r0], #2
|
||||
strh r9, [r0], #2
|
||||
strh r5, [r0], #2
|
||||
strh lr, [r0], #2
|
||||
|
||||
rsbs r9, ip, r6, asr #16
|
||||
addgt r9, r2, #0
|
||||
rsblt r9, r2, #0
|
||||
smlatbne r9, r6, r1, r9
|
||||
|
||||
rsbs lr, ip, r7, asr #16
|
||||
addgt lr, r2, #0
|
||||
rsblt lr, r2, #0
|
||||
smlatbne lr, r7, r1, lr
|
||||
|
||||
rsbs r8, ip, r6, asl #16
|
||||
addgt r8, r2, #0
|
||||
rsblt r8, r2, #0
|
||||
smlabbne r6, r6, r1, r8
|
||||
|
||||
rsbs r8, ip, r7, asl #16
|
||||
addgt r8, r2, #0
|
||||
rsblt r8, r2, #0
|
||||
smlabbne r7, r7, r1, r8
|
||||
dequant_t r9, r6, r1, r2, r9
|
||||
dequant_t lr, r7, r1, r2, lr
|
||||
dequant_b r6, r6, r1, r2, r8
|
||||
dequant_b r7, r7, r1, r2, r8
|
||||
|
||||
strh r6, [r0], #2
|
||||
strh r9, [r0], #2
|
||||
@ -95,7 +80,7 @@ function ff_dct_unquantize_h263_armv5te, export=1
|
||||
strh lr, [r0], #2
|
||||
|
||||
subs r3, r3, #8
|
||||
ldrgtd r4, [r0, #0] /* load data early to avoid load/use pipeline stall */
|
||||
ldrdgt r4, [r0, #0] /* load data early to avoid load/use pipeline stall */
|
||||
bgt 1b
|
||||
|
||||
adds r3, r3, #2
|
||||
|
@ -333,6 +333,20 @@ function idct_col_armv5te
|
||||
ldr pc, [sp], #4
|
||||
endfunc
|
||||
|
||||
.macro clip dst, src:vararg
|
||||
movs \dst, \src
|
||||
movmi \dst, #0
|
||||
cmp \dst, #255
|
||||
movgt \dst, #255
|
||||
.endm
|
||||
|
||||
.macro aclip dst, src:vararg
|
||||
adds \dst, \src
|
||||
movmi \dst, #0
|
||||
cmp \dst, #255
|
||||
movgt \dst, #255
|
||||
.endm
|
||||
|
||||
function idct_col_put_armv5te
|
||||
str lr, [sp, #-4]!
|
||||
|
||||
@ -341,27 +355,15 @@ function idct_col_put_armv5te
|
||||
ldmfd sp!, {a3, a4}
|
||||
ldr lr, [sp, #32]
|
||||
add a2, a3, v1
|
||||
movs a2, a2, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a2, asr #20
|
||||
add ip, a4, v2
|
||||
movs ip, ip, asr #20
|
||||
movmi ip, #0
|
||||
cmp ip, #255
|
||||
movgt ip, #255
|
||||
clip ip, ip, asr #20
|
||||
orr a2, a2, ip, lsl #8
|
||||
sub a3, a3, v1
|
||||
movs a3, a3, asr #20
|
||||
movmi a3, #0
|
||||
cmp a3, #255
|
||||
movgt a3, #255
|
||||
clip a3, a3, asr #20
|
||||
sub a4, a4, v2
|
||||
movs a4, a4, asr #20
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
clip a4, a4, asr #20
|
||||
ldr v1, [sp, #28]
|
||||
movgt a4, #255
|
||||
strh a2, [v1]
|
||||
add a2, v1, #2
|
||||
str a2, [sp, #28]
|
||||
@ -371,79 +373,43 @@ function idct_col_put_armv5te
|
||||
strh a2, [v2, v1]!
|
||||
|
||||
sub a2, a3, v3
|
||||
movs a2, a2, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a2, asr #20
|
||||
sub ip, a4, v4
|
||||
movs ip, ip, asr #20
|
||||
movmi ip, #0
|
||||
cmp ip, #255
|
||||
movgt ip, #255
|
||||
clip ip, ip, asr #20
|
||||
orr a2, a2, ip, lsl #8
|
||||
strh a2, [v1, lr]!
|
||||
add a3, a3, v3
|
||||
movs a2, a3, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a3, asr #20
|
||||
add a4, a4, v4
|
||||
movs a4, a4, asr #20
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
clip a4, a4, asr #20
|
||||
orr a2, a2, a4, lsl #8
|
||||
ldmfd sp!, {a3, a4}
|
||||
strh a2, [v2, -lr]!
|
||||
|
||||
add a2, a3, v5
|
||||
movs a2, a2, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a2, asr #20
|
||||
add ip, a4, v6
|
||||
movs ip, ip, asr #20
|
||||
movmi ip, #0
|
||||
cmp ip, #255
|
||||
movgt ip, #255
|
||||
clip ip, ip, asr #20
|
||||
orr a2, a2, ip, lsl #8
|
||||
strh a2, [v1, lr]!
|
||||
sub a3, a3, v5
|
||||
movs a2, a3, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a3, asr #20
|
||||
sub a4, a4, v6
|
||||
movs a4, a4, asr #20
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
clip a4, a4, asr #20
|
||||
orr a2, a2, a4, lsl #8
|
||||
ldmfd sp!, {a3, a4}
|
||||
strh a2, [v2, -lr]!
|
||||
|
||||
add a2, a3, v7
|
||||
movs a2, a2, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a2, asr #20
|
||||
add ip, a4, fp
|
||||
movs ip, ip, asr #20
|
||||
movmi ip, #0
|
||||
cmp ip, #255
|
||||
movgt ip, #255
|
||||
clip ip, ip, asr #20
|
||||
orr a2, a2, ip, lsl #8
|
||||
strh a2, [v1, lr]
|
||||
sub a3, a3, v7
|
||||
movs a2, a3, asr #20
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
clip a2, a3, asr #20
|
||||
sub a4, a4, fp
|
||||
movs a4, a4, asr #20
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
clip a4, a4, asr #20
|
||||
orr a2, a2, a4, lsl #8
|
||||
strh a2, [v2, -lr]
|
||||
|
||||
@ -460,36 +426,22 @@ function idct_col_add_armv5te
|
||||
ldmfd sp!, {a3, a4}
|
||||
ldrh ip, [lr]
|
||||
add a2, a3, v1
|
||||
mov a2, a2, asr #20
|
||||
sub a3, a3, v1
|
||||
and v1, ip, #255
|
||||
adds a2, a2, v1
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
aclip a2, v1, a2, asr #20
|
||||
add v1, a4, v2
|
||||
mov v1, v1, asr #20
|
||||
adds v1, v1, ip, lsr #8
|
||||
movmi v1, #0
|
||||
cmp v1, #255
|
||||
movgt v1, #255
|
||||
aclip v1, v1, ip, lsr #8
|
||||
orr a2, a2, v1, lsl #8
|
||||
ldr v1, [sp, #32]
|
||||
sub a4, a4, v2
|
||||
rsb v2, v1, v1, lsl #3
|
||||
ldrh ip, [v2, lr]!
|
||||
strh a2, [lr]
|
||||
mov a3, a3, asr #20
|
||||
and a2, ip, #255
|
||||
adds a3, a3, a2
|
||||
movmi a3, #0
|
||||
cmp a3, #255
|
||||
movgt a3, #255
|
||||
aclip a3, a2, a3, asr #20
|
||||
mov a4, a4, asr #20
|
||||
adds a4, a4, ip, lsr #8
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
aclip a4, a4, ip, lsr #8
|
||||
add a2, lr, #2
|
||||
str a2, [sp, #28]
|
||||
orr a2, a3, a4, lsl #8
|
||||
@ -498,102 +450,60 @@ function idct_col_add_armv5te
|
||||
ldmfd sp!, {a3, a4}
|
||||
ldrh ip, [lr, v1]!
|
||||
sub a2, a3, v3
|
||||
mov a2, a2, asr #20
|
||||
add a3, a3, v3
|
||||
and v3, ip, #255
|
||||
adds a2, a2, v3
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
aclip a2, v3, a2, asr #20
|
||||
sub v3, a4, v4
|
||||
mov v3, v3, asr #20
|
||||
adds v3, v3, ip, lsr #8
|
||||
movmi v3, #0
|
||||
cmp v3, #255
|
||||
movgt v3, #255
|
||||
aclip v3, v3, ip, lsr #8
|
||||
orr a2, a2, v3, lsl #8
|
||||
add a4, a4, v4
|
||||
ldrh ip, [v2, -v1]!
|
||||
strh a2, [lr]
|
||||
mov a3, a3, asr #20
|
||||
and a2, ip, #255
|
||||
adds a3, a3, a2
|
||||
movmi a3, #0
|
||||
cmp a3, #255
|
||||
movgt a3, #255
|
||||
aclip a3, a2, a3, asr #20
|
||||
mov a4, a4, asr #20
|
||||
adds a4, a4, ip, lsr #8
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
aclip a4, a4, ip, lsr #8
|
||||
orr a2, a3, a4, lsl #8
|
||||
strh a2, [v2]
|
||||
|
||||
ldmfd sp!, {a3, a4}
|
||||
ldrh ip, [lr, v1]!
|
||||
add a2, a3, v5
|
||||
mov a2, a2, asr #20
|
||||
sub a3, a3, v5
|
||||
and v3, ip, #255
|
||||
adds a2, a2, v3
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
aclip a2, v3, a2, asr #20
|
||||
add v3, a4, v6
|
||||
mov v3, v3, asr #20
|
||||
adds v3, v3, ip, lsr #8
|
||||
movmi v3, #0
|
||||
cmp v3, #255
|
||||
movgt v3, #255
|
||||
aclip v3, v3, ip, lsr #8
|
||||
orr a2, a2, v3, lsl #8
|
||||
sub a4, a4, v6
|
||||
ldrh ip, [v2, -v1]!
|
||||
strh a2, [lr]
|
||||
mov a3, a3, asr #20
|
||||
and a2, ip, #255
|
||||
adds a3, a3, a2
|
||||
movmi a3, #0
|
||||
cmp a3, #255
|
||||
movgt a3, #255
|
||||
aclip a3, a2, a3, asr #20
|
||||
mov a4, a4, asr #20
|
||||
adds a4, a4, ip, lsr #8
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
aclip a4, a4, ip, lsr #8
|
||||
orr a2, a3, a4, lsl #8
|
||||
strh a2, [v2]
|
||||
|
||||
ldmfd sp!, {a3, a4}
|
||||
ldrh ip, [lr, v1]!
|
||||
add a2, a3, v7
|
||||
mov a2, a2, asr #20
|
||||
sub a3, a3, v7
|
||||
and v3, ip, #255
|
||||
adds a2, a2, v3
|
||||
movmi a2, #0
|
||||
cmp a2, #255
|
||||
movgt a2, #255
|
||||
aclip a2, v3, a2, asr #20
|
||||
add v3, a4, fp
|
||||
mov v3, v3, asr #20
|
||||
adds v3, v3, ip, lsr #8
|
||||
movmi v3, #0
|
||||
cmp v3, #255
|
||||
movgt v3, #255
|
||||
aclip v3, v3, ip, lsr #8
|
||||
orr a2, a2, v3, lsl #8
|
||||
sub a4, a4, fp
|
||||
ldrh ip, [v2, -v1]!
|
||||
strh a2, [lr]
|
||||
mov a3, a3, asr #20
|
||||
and a2, ip, #255
|
||||
adds a3, a3, a2
|
||||
movmi a3, #0
|
||||
cmp a3, #255
|
||||
movgt a3, #255
|
||||
aclip a3, a2, a3, asr #20
|
||||
mov a4, a4, asr #20
|
||||
adds a4, a4, ip, lsr #8
|
||||
movmi a4, #0
|
||||
cmp a4, #255
|
||||
movgt a4, #255
|
||||
aclip a4, a4, ip, lsr #8
|
||||
orr a2, a3, a4, lsl #8
|
||||
strh a2, [v2]
|
||||
|
||||
|
@ -31,24 +31,25 @@ static inline int vp56_rac_get_prob_armv6(VP56RangeCoder *c, int pr)
|
||||
unsigned high = c->high << shift;
|
||||
unsigned bit;
|
||||
|
||||
__asm__ volatile ("adds %3, %3, %0 \n"
|
||||
"cmpcs %7, %4 \n"
|
||||
"ldrcsh %2, [%4], #2 \n"
|
||||
"rsb %0, %6, #256 \n"
|
||||
"smlabb %0, %5, %6, %0 \n"
|
||||
"rev16cs %2, %2 \n"
|
||||
"orrcs %1, %1, %2, lsl %3 \n"
|
||||
"subcs %3, %3, #16 \n"
|
||||
"lsr %0, %0, #8 \n"
|
||||
"cmp %1, %0, lsl #16 \n"
|
||||
"subge %1, %1, %0, lsl #16 \n"
|
||||
"subge %0, %5, %0 \n"
|
||||
"movge %2, #1 \n"
|
||||
"movlt %2, #0 \n"
|
||||
: "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit),
|
||||
"+&r"(c->bits), "+&r"(c->buffer)
|
||||
: "r"(high), "r"(pr), "r"(c->end - 1),
|
||||
"0"(shift), "1"(code_word));
|
||||
__asm__ ("adds %3, %3, %0 \n"
|
||||
"cmpcs %7, %4 \n"
|
||||
"ldrcsh %2, [%4], #2 \n"
|
||||
"rsb %0, %6, #256 \n"
|
||||
"smlabb %0, %5, %6, %0 \n"
|
||||
"rev16cs %2, %2 \n"
|
||||
"orrcs %1, %1, %2, lsl %3 \n"
|
||||
"subcs %3, %3, #16 \n"
|
||||
"lsr %0, %0, #8 \n"
|
||||
"cmp %1, %0, lsl #16 \n"
|
||||
"subge %1, %1, %0, lsl #16 \n"
|
||||
"subge %0, %5, %0 \n"
|
||||
"movge %2, #1 \n"
|
||||
"movlt %2, #0 \n"
|
||||
: "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit),
|
||||
"+&r"(c->bits), "+&r"(c->buffer)
|
||||
: "r"(high), "r"(pr), "r"(c->end - 1),
|
||||
"0"(shift), "1"(code_word)
|
||||
: "cc");
|
||||
|
||||
return bit;
|
||||
}
|
||||
@ -62,19 +63,20 @@ static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr)
|
||||
unsigned low;
|
||||
unsigned tmp;
|
||||
|
||||
__asm__ volatile ("adds %3, %3, %0 \n"
|
||||
"cmpcs %7, %4 \n"
|
||||
"ldrcsh %2, [%4], #2 \n"
|
||||
"rsb %0, %6, #256 \n"
|
||||
"smlabb %0, %5, %6, %0 \n"
|
||||
"rev16cs %2, %2 \n"
|
||||
"orrcs %1, %1, %2, lsl %3 \n"
|
||||
"subcs %3, %3, #16 \n"
|
||||
"lsr %0, %0, #8 \n"
|
||||
"lsl %2, %0, #16 \n"
|
||||
: "=&r"(low), "+&r"(code_word), "=&r"(tmp),
|
||||
"+&r"(c->bits), "+&r"(c->buffer)
|
||||
: "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift));
|
||||
__asm__ ("adds %3, %3, %0 \n"
|
||||
"cmpcs %7, %4 \n"
|
||||
"ldrcsh %2, [%4], #2 \n"
|
||||
"rsb %0, %6, #256 \n"
|
||||
"smlabb %0, %5, %6, %0 \n"
|
||||
"rev16cs %2, %2 \n"
|
||||
"orrcs %1, %1, %2, lsl %3 \n"
|
||||
"subcs %3, %3, #16 \n"
|
||||
"lsr %0, %0, #8 \n"
|
||||
"lsl %2, %0, #16 \n"
|
||||
: "=&r"(low), "+&r"(code_word), "=&r"(tmp),
|
||||
"+&r"(c->bits), "+&r"(c->buffer)
|
||||
: "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift)
|
||||
: "cc");
|
||||
|
||||
if (code_word >= tmp) {
|
||||
c->high = high - low;
|
||||
@ -89,4 +91,4 @@ static inline int vp56_rac_get_prob_branchy_armv6(VP56RangeCoder *c, int pr)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_ARM_VP56_ARITH_H */
|
||||
|
@ -26,4 +26,4 @@ int ff_decode_block_coeffs_armv6(VP56RangeCoder *rc, DCTELEM block[16],
|
||||
int i, uint8_t *token_prob, int16_t qmul[2]);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_ARM_VP8_H */
|
||||
|
@ -20,8 +20,6 @@
|
||||
|
||||
#include "asm.S"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.macro rac_get_prob h, bs, buf, cw, pr, t0, t1
|
||||
adds \bs, \bs, \t0
|
||||
lsl \cw, \cw, \t0
|
||||
|
@ -213,6 +213,7 @@ enum CodecID {
|
||||
CODEC_ID_PRORES,
|
||||
CODEC_ID_JV,
|
||||
CODEC_ID_DFA,
|
||||
CODEC_ID_8SVX_RAW,
|
||||
|
||||
/* various PCM "codecs" */
|
||||
CODEC_ID_PCM_S16LE= 0x10000,
|
||||
@ -2690,7 +2691,7 @@ typedef struct AVCodecContext {
|
||||
/**
|
||||
* Audio channel layout.
|
||||
* - encoding: set by user.
|
||||
* - decoding: set by libavcodec.
|
||||
* - decoding: set by user, may be overwritten by libavcodec.
|
||||
*/
|
||||
int64_t channel_layout;
|
||||
|
||||
@ -2959,6 +2960,14 @@ typedef struct AVCodecContext {
|
||||
*/
|
||||
enum AVAudioServiceType audio_service_type;
|
||||
|
||||
/**
|
||||
* desired sample format
|
||||
* - encoding: Not used.
|
||||
* - decoding: Set by user.
|
||||
* Decoder will decode to this format if it can.
|
||||
*/
|
||||
enum AVSampleFormat request_sample_fmt;
|
||||
|
||||
/**
|
||||
* Current statistics for PTS correction.
|
||||
* - decoding: maintained and used by libavcodec, not intended to be used by user apps
|
||||
@ -2969,13 +2978,6 @@ typedef struct AVCodecContext {
|
||||
int64_t pts_correction_last_pts; /// PTS of the last frame
|
||||
int64_t pts_correction_last_dts; /// DTS of the last frame
|
||||
|
||||
/**
|
||||
* desired sample format
|
||||
* - encoding: Not used.
|
||||
* - decoding: Set by user.
|
||||
* Decoder will decode to this format if it can.
|
||||
*/
|
||||
enum AVSampleFormat request_sample_fmt;
|
||||
|
||||
} AVCodecContext;
|
||||
|
||||
@ -3450,12 +3452,16 @@ int avpicture_layout(const AVPicture* src, enum PixelFormat pix_fmt, int width,
|
||||
int avpicture_get_size(enum PixelFormat pix_fmt, int width, int height);
|
||||
void avcodec_get_chroma_sub_sample(enum PixelFormat pix_fmt, int *h_shift, int *v_shift);
|
||||
|
||||
#if FF_API_GET_PIX_FMT_NAME
|
||||
/**
|
||||
* Return the short name for a pixel format.
|
||||
*
|
||||
* \see av_get_pix_fmt(), av_get_pix_fmt_string().
|
||||
* @deprecated Deprecated in favor of av_get_pix_fmt_name().
|
||||
*/
|
||||
attribute_deprecated
|
||||
const char *avcodec_get_pix_fmt_name(enum PixelFormat pix_fmt);
|
||||
#endif
|
||||
|
||||
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
#include "avcodec.h"
|
||||
#include "libavutil/avassert.h"
|
||||
|
||||
#include "bytestream.h"
|
||||
|
||||
void av_destruct_packet_nofree(AVPacket *pkt)
|
||||
{
|
||||
@ -115,3 +115,4 @@ void av_free_packet(AVPacket *pkt)
|
||||
pkt->data = NULL; pkt->size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1208,7 +1208,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
|
||||
/**
|
||||
* Caclulate quantization tables for version b
|
||||
*/
|
||||
static av_cold void binkb_calc_quant()
|
||||
static av_cold void binkb_calc_quant(void)
|
||||
{
|
||||
uint8_t inv_bink_scan[64];
|
||||
double s[64];
|
||||
|
@ -83,8 +83,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
|
||||
|
||||
/* VLC decoding */
|
||||
|
||||
//#define DEBUG_VLC
|
||||
|
||||
#define GET_DATA(v, table, i, wrap, size) \
|
||||
{\
|
||||
const uint8_t *ptr = (const uint8_t *)table + i * wrap;\
|
||||
@ -120,10 +118,10 @@ static int alloc_table(VLC *vlc, int size, int use_static)
|
||||
}
|
||||
|
||||
static av_always_inline uint32_t bitswap_32(uint32_t x) {
|
||||
return av_reverse[x&0xFF]<<24
|
||||
| av_reverse[(x>>8)&0xFF]<<16
|
||||
| av_reverse[(x>>16)&0xFF]<<8
|
||||
| av_reverse[x>>24];
|
||||
return (uint32_t)av_reverse[x&0xFF]<<24
|
||||
| (uint32_t)av_reverse[(x>>8)&0xFF]<<16
|
||||
| (uint32_t)av_reverse[(x>>16)&0xFF]<<8
|
||||
| (uint32_t)av_reverse[x>>24];
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
@ -164,10 +162,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
|
||||
table_size = 1 << table_nb_bits;
|
||||
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"new table index=%d size=%d\n",
|
||||
table_index, table_size);
|
||||
#endif
|
||||
av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
|
||||
if (table_index < 0)
|
||||
return -1;
|
||||
table = &vlc->table[table_index];
|
||||
@ -182,9 +177,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
n = codes[i].bits;
|
||||
code = codes[i].code;
|
||||
symbol = codes[i].symbol;
|
||||
#if defined(DEBUG_VLC) && 0
|
||||
av_log(NULL,AV_LOG_DEBUG,"i=%d n=%d code=0x%x\n", i, n, code);
|
||||
#endif
|
||||
av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
|
||||
if (n <= table_nb_bits) {
|
||||
/* no need to add another table */
|
||||
j = code >> (32 - table_nb_bits);
|
||||
@ -195,10 +188,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
inc = 1 << n;
|
||||
}
|
||||
for (k = 0; k < nb; k++) {
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL, AV_LOG_DEBUG, "%4x: code=%d n=%d\n",
|
||||
j, i, n);
|
||||
#endif
|
||||
av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n);
|
||||
if (table[j][1] /*bits*/ != 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "incorrect codes\n");
|
||||
return -1;
|
||||
@ -228,10 +218,8 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
|
||||
subtable_bits = FFMIN(subtable_bits, table_nb_bits);
|
||||
j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix;
|
||||
table[j][1] = -subtable_bits;
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"%4x: n=%d (subtable)\n",
|
||||
j, codes[i].bits + table_nb_bits);
|
||||
#endif
|
||||
av_dlog(NULL, "%4x: n=%d (subtable)\n",
|
||||
j, codes[i].bits + table_nb_bits);
|
||||
index = build_table(vlc, subtable_bits, k-i, codes+i, flags);
|
||||
if (index < 0)
|
||||
return -1;
|
||||
@ -293,9 +281,7 @@ int init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
|
||||
vlc->table_size = 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VLC
|
||||
av_log(NULL,AV_LOG_DEBUG,"build table nb_codes=%d\n", nb_codes);
|
||||
#endif
|
||||
av_dlog(NULL, "build table nb_codes=%d\n", nb_codes);
|
||||
|
||||
buf = av_malloc((nb_codes+1)*sizeof(VLCcode));
|
||||
|
||||
|
@ -38,4 +38,4 @@ typedef struct CAVSDSPContext {
|
||||
void ff_cavsdsp_init(CAVSDSPContext* c, AVCodecContext *avctx);
|
||||
void ff_cavsdsp_init_mmx(CAVSDSPContext* c, AVCodecContext *avctx);
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_CAVSDSP_H */
|
||||
|
@ -20,8 +20,8 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef CBRT_TABLEGEN_H
|
||||
#define CBRT_TABLEGEN_H
|
||||
#ifndef AVCODEC_CBRT_TABLEGEN_H
|
||||
#define AVCODEC_CBRT_TABLEGEN_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
@ -48,4 +48,4 @@ static void cbrt_tableinit(void)
|
||||
}
|
||||
#endif /* CONFIG_HARDCODED_TABLES */
|
||||
|
||||
#endif /* CBRT_TABLEGEN_H */
|
||||
#endif /* AVCODEC_CBRT_TABLEGEN_H */
|
||||
|
@ -109,7 +109,7 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
|
||||
old_out2 = out[-2];
|
||||
old_out3 = out[-1];
|
||||
for (n = 0; n <= buffer_length - 4; n+=4) {
|
||||
float tmp0,tmp1,tmp2,tmp3;
|
||||
float tmp0,tmp1,tmp2;
|
||||
float val;
|
||||
|
||||
out0 = in[0];
|
||||
@ -160,7 +160,6 @@ void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs,
|
||||
tmp0 = out0;
|
||||
tmp1 = out1;
|
||||
tmp2 = out2;
|
||||
tmp3 = out3;
|
||||
|
||||
out3 -= a * tmp2;
|
||||
out2 -= a * tmp1;
|
||||
|
@ -45,4 +45,4 @@ extern const uint32_t ff_ega_palette[64];
|
||||
*/
|
||||
void ff_draw_pc_font(uint8_t *dst, int linesize, const uint8_t *font, int font_height, int ch, int fg, int bg);
|
||||
|
||||
#endif
|
||||
#endif /* AVCODEC_CGA_DATA_H */
|
||||
|
@ -66,7 +66,6 @@
|
||||
|
||||
#define SUBBAND_SIZE 20
|
||||
#define MAX_SUBPACKETS 5
|
||||
//#define COOKDEBUG
|
||||
|
||||
typedef struct {
|
||||
int *now;
|
||||
@ -166,38 +165,6 @@ typedef struct cook {
|
||||
static float pow2tab[127];
|
||||
static float rootpow2tab[127];
|
||||
|
||||
/* debug functions */
|
||||
|
||||
#ifdef COOKDEBUG
|
||||
static void dump_float_table(float* table, int size, int delimiter) {
|
||||
int i=0;
|
||||
av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
|
||||
for (i=0 ; i<size ; i++) {
|
||||
av_log(NULL, AV_LOG_ERROR, "%5.1f, ", table[i]);
|
||||
if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_int_table(int* table, int size, int delimiter) {
|
||||
int i=0;
|
||||
av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
|
||||
for (i=0 ; i<size ; i++) {
|
||||
av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
|
||||
if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_short_table(short* table, int size, int delimiter) {
|
||||
int i=0;
|
||||
av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i);
|
||||
for (i=0 ; i<size ; i++) {
|
||||
av_log(NULL, AV_LOG_ERROR, "%d, ", table[i]);
|
||||
if ((i+1)%delimiter == 0) av_log(NULL,AV_LOG_ERROR,"\n[%d]: ",i+1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*************** init functions ***************/
|
||||
|
||||
/* table generator */
|
||||
@ -1037,7 +1004,7 @@ static int cook_decode_frame(AVCodecContext *avctx,
|
||||
return avctx->block_align;
|
||||
}
|
||||
|
||||
#ifdef COOKDEBUG
|
||||
#ifdef DEBUG
|
||||
static void dump_cook_context(COOKContext *q)
|
||||
{
|
||||
//int i=0;
|
||||
@ -1055,7 +1022,6 @@ static void dump_cook_context(COOKContext *q)
|
||||
PRINT("samples_per_channel",q->subpacket[0].samples_per_channel);
|
||||
PRINT("samples_per_frame",q->subpacket[0].samples_per_frame);
|
||||
PRINT("subbands",q->subpacket[0].subbands);
|
||||
PRINT("random_state",q->random_state);
|
||||
PRINT("js_subband_start",q->subpacket[0].js_subband_start);
|
||||
PRINT("log2_numvector_size",q->subpacket[0].log2_numvector_size);
|
||||
PRINT("numvector_size",q->subpacket[0].numvector_size);
|
||||
@ -1280,7 +1246,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
|
||||
else
|
||||
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
|
||||
|
||||
#ifdef COOKDEBUG
|
||||
#ifdef DEBUG
|
||||
dump_cook_context(q);
|
||||
#endif
|
||||
return 0;
|
||||
|
@ -51,10 +51,10 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int i, j;
|
||||
int do_sin = argc > 1 && !strcmp(argv[1], "sin");
|
||||
int fixed = argc > 2 && !strcmp(argv[2], "fixed");
|
||||
int fixed = argc > 1 && strstr(argv[1], "fixed");
|
||||
double (*func)(double) = do_sin ? sin : cos;
|
||||
|
||||
printf("/* This file was generated by libavcodec/costablegen */\n");
|
||||
printf("/* This file was automatically generated. */\n");
|
||||
printf("#define CONFIG_FFT_FLOAT %d\n", !fixed);
|
||||
printf("#include \"libavcodec/%s\"\n", do_sin ? "rdft.h" : "fft.h");
|
||||
for (i = 4; i <= BITS; i++) {
|
@ -124,6 +124,7 @@ typedef struct {
|
||||
AVFrame pic;
|
||||
HANDLE dev;
|
||||
|
||||
AVBitStreamFilterContext *bsfc;
|
||||
AVCodecParserContext *parser;
|
||||
|
||||
uint8_t is_70012;
|
||||
@ -338,6 +339,9 @@ static av_cold int uninit(AVCodecContext *avctx)
|
||||
DtsDeviceClose(device);
|
||||
|
||||
av_parser_close(priv->parser);
|
||||
if (priv->bsfc) {
|
||||
av_bitstream_filter_close(priv->bsfc);
|
||||
}
|
||||
|
||||
av_free(priv->sps_pps_buf);
|
||||
|
||||
@ -397,7 +401,6 @@ static av_cold int init(AVCodecContext *avctx)
|
||||
{
|
||||
uint8_t *dummy_p;
|
||||
int dummy_int;
|
||||
AVBitStreamFilterContext *bsfc;
|
||||
|
||||
uint32_t orig_data_size = avctx->extradata_size;
|
||||
uint8_t *orig_data = av_malloc(orig_data_size);
|
||||
@ -409,16 +412,15 @@ static av_cold int init(AVCodecContext *avctx)
|
||||
memcpy(orig_data, avctx->extradata, orig_data_size);
|
||||
|
||||
|
||||
bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
||||
if (!bsfc) {
|
||||
priv->bsfc = av_bitstream_filter_init("h264_mp4toannexb");
|
||||
if (!priv->bsfc) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Cannot open the h264_mp4toannexb BSF!\n");
|
||||
av_free(orig_data);
|
||||
return AVERROR_BSF_NOT_FOUND;
|
||||
}
|
||||
av_bitstream_filter_filter(bsfc, avctx, NULL, &dummy_p,
|
||||
av_bitstream_filter_filter(priv->bsfc, avctx, NULL, &dummy_p,
|
||||
&dummy_int, NULL, 0, 0);
|
||||
av_bitstream_filter_close(bsfc);
|
||||
|
||||
priv->sps_pps_buf = avctx->extradata;
|
||||
priv->sps_pps_size = avctx->extradata_size;
|
||||
@ -512,6 +514,7 @@ static av_cold int init(AVCodecContext *avctx)
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"Cannot open the h.264 parser! Interlaced h.264 content "
|
||||
"will not be detected reliably.\n");
|
||||
priv->parser->flags = PARSER_FLAG_COMPLETE_FRAMES;
|
||||
}
|
||||
av_log(avctx, AV_LOG_VERBOSE, "CrystalHD: Init complete.\n");
|
||||
|
||||
@ -831,24 +834,49 @@ static int decode(AVCodecContext *avctx, void *data, int *data_size, AVPacket *a
|
||||
int32_t tx_free = (int32_t)DtsTxFreeSize(dev);
|
||||
|
||||
if (priv->parser) {
|
||||
uint8_t *pout;
|
||||
int psize;
|
||||
const uint8_t *in_data = avpkt->data;
|
||||
uint8_t *in_data = avpkt->data;
|
||||
int in_len = len;
|
||||
H264Context *h = priv->parser->priv_data;
|
||||
int ret = 0;
|
||||
|
||||
while (in_len) {
|
||||
if (priv->bsfc) {
|
||||
ret = av_bitstream_filter_filter(priv->bsfc, avctx, NULL,
|
||||
&in_data, &in_len,
|
||||
avpkt->data, len, 0);
|
||||
}
|
||||
|
||||
if (ret >= 0) {
|
||||
uint8_t *pout;
|
||||
int psize;
|
||||
int index;
|
||||
H264Context *h = priv->parser->priv_data;
|
||||
|
||||
index = av_parser_parse2(priv->parser, avctx, &pout, &psize,
|
||||
in_data, in_len, avctx->pkt->pts,
|
||||
avctx->pkt->dts, 0);
|
||||
in_data += index;
|
||||
in_len -= index;
|
||||
if (index < 0) {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"CrystalHD: Failed to parse h.264 packet to "
|
||||
"detect interlacing.\n");
|
||||
} else if (index != in_len) {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"CrystalHD: Failed to parse h.264 packet "
|
||||
"completely. Interlaced frames may be "
|
||||
"incorrectly detected\n.");
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_VERBOSE,
|
||||
"CrystalHD: parser picture type %d\n",
|
||||
h->s.picture_structure);
|
||||
pic_type = h->s.picture_structure;
|
||||
}
|
||||
} else {
|
||||
av_log(avctx, AV_LOG_WARNING,
|
||||
"CrystalHD: mp4toannexb filter failed to filter "
|
||||
"packet. Interlaced frames may be incorrectly "
|
||||
"detected.\n");
|
||||
}
|
||||
if (ret > 0) {
|
||||
av_freep(&in_data);
|
||||
}
|
||||
av_log(avctx, AV_LOG_VERBOSE,
|
||||
"CrystalHD: parser picture type %d\n",
|
||||
h->s.picture_structure);
|
||||
pic_type = h->s.picture_structure;
|
||||
}
|
||||
|
||||
if (len < tx_free - 1024) {
|
||||
|
@ -1535,8 +1535,6 @@ static void dca_exss_parse_header(DCAContext *s)
|
||||
{
|
||||
int ss_index;
|
||||
int blownup;
|
||||
int header_size;
|
||||
int hd_size;
|
||||
int num_audiop = 1;
|
||||
int num_assets = 1;
|
||||
int active_ss_mask[8];
|
||||
@ -1549,8 +1547,8 @@ static void dca_exss_parse_header(DCAContext *s)
|
||||
ss_index = get_bits(&s->gb, 2);
|
||||
|
||||
blownup = get_bits1(&s->gb);
|
||||
header_size = get_bits(&s->gb, 8 + 4 * blownup) + 1;
|
||||
hd_size = get_bits_long(&s->gb, 16 + 4 * blownup) + 1;
|
||||
skip_bits(&s->gb, 8 + 4 * blownup); // header_size
|
||||
skip_bits(&s->gb, 16 + 4 * blownup); // hd_size
|
||||
|
||||
s->static_fields = get_bits1(&s->gb);
|
||||
if (s->static_fields) {
|
||||
@ -1622,13 +1620,13 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
{
|
||||
const uint8_t *buf = avpkt->data;
|
||||
int buf_size = avpkt->size;
|
||||
int data_size_tmp;
|
||||
|
||||
int lfe_samples;
|
||||
int num_core_channels = 0;
|
||||
int i;
|
||||
float *samples_flt = data;
|
||||
int16_t *samples = data;
|
||||
float *samples_flt = data;
|
||||
int16_t *samples_s16 = data;
|
||||
int out_size;
|
||||
DCAContext *s = avctx->priv_data;
|
||||
int channels;
|
||||
int core_ss_end;
|
||||
@ -1818,11 +1816,11 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
data_size_tmp = (s->sample_blocks / 8) * 256 * channels;
|
||||
data_size_tmp *= avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? sizeof(*samples_flt) : sizeof(*samples);
|
||||
if (*data_size < data_size_tmp)
|
||||
out_size = 256 / 8 * s->sample_blocks * channels *
|
||||
(av_get_bits_per_sample_fmt(avctx->sample_fmt) / 8);
|
||||
if (*data_size < out_size)
|
||||
return -1;
|
||||
*data_size = data_size_tmp;
|
||||
*data_size = out_size;
|
||||
|
||||
/* filter to get final output */
|
||||
for (i = 0; i < (s->sample_blocks / 8); i++) {
|
||||
@ -1841,13 +1839,15 @@ static int dca_decode_frame(AVCodecContext * avctx,
|
||||
}
|
||||
}
|
||||
|
||||
/* interleave samples */
|
||||
if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
float_interleave(samples_flt, s->samples_chanptr, 256, channels);
|
||||
s->fmt_conv.float_interleave(samples_flt, s->samples_chanptr, 256,
|
||||
channels);
|
||||
samples_flt += 256 * channels;
|
||||
} else {
|
||||
s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
|
||||
samples += 256 * channels;
|
||||
s->fmt_conv.float_to_int16_interleave(samples_s16,
|
||||
s->samples_chanptr, 256,
|
||||
channels);
|
||||
samples_s16 += 256 * channels;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1884,10 +1884,14 @@ static av_cold int dca_decode_init(AVCodecContext * avctx)
|
||||
|
||||
for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++)
|
||||
s->samples_chanptr[i] = s->samples + i * 256;
|
||||
avctx->sample_fmt = avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT ?
|
||||
AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16;
|
||||
|
||||
s->scale_bias = 1.0;
|
||||
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
|
||||
s->scale_bias = 1.0 / 32768.0;
|
||||
} else {
|
||||
avctx->sample_fmt = AV_SAMPLE_FMT_S16;
|
||||
s->scale_bias = 1.0;
|
||||
}
|
||||
|
||||
/* allow downmixing to stereo */
|
||||
if (avctx->channels > 0 && avctx->request_channels < avctx->channels &&
|
||||
@ -1924,5 +1928,8 @@ AVCodec ff_dca_decoder = {
|
||||
.close = dca_decode_end,
|
||||
.long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"),
|
||||
.capabilities = CODEC_CAP_CHANNEL_CONF,
|
||||
.sample_fmts = (const enum AVSampleFormat[]) {
|
||||
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
|
||||
},
|
||||
.profiles = NULL_IF_CONFIG_SMALL(profiles),
|
||||
};
|
||||
|
@ -30,9 +30,7 @@
|
||||
#include <math.h>
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "dct.h"
|
||||
|
||||
#define DCT32_FLOAT
|
||||
#include "dct32.c"
|
||||
#include "dct32.h"
|
||||
|
||||
/* sin((M_PI * x / (2*n)) */
|
||||
#define SIN(s,n,x) (s->costab[(n) - (x)])
|
||||
@ -180,34 +178,37 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
|
||||
int n = 1 << nbits;
|
||||
int i;
|
||||
|
||||
memset(s, 0, sizeof(*s));
|
||||
|
||||
s->nbits = nbits;
|
||||
s->inverse = inverse;
|
||||
|
||||
ff_init_ff_cos_tabs(nbits+2);
|
||||
|
||||
s->costab = ff_cos_tabs[nbits+2];
|
||||
|
||||
s->csc2 = av_malloc(n/2 * sizeof(FFTSample));
|
||||
|
||||
if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
|
||||
av_free(s->csc2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < n/2; i++)
|
||||
s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
|
||||
|
||||
switch(inverse) {
|
||||
case DCT_I : s->dct_calc = ff_dct_calc_I_c; break;
|
||||
case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
|
||||
case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
|
||||
case DST_I : s->dct_calc = ff_dst_calc_I_c; break;
|
||||
}
|
||||
|
||||
if (inverse == DCT_II && nbits == 5)
|
||||
if (inverse == DCT_II && nbits == 5) {
|
||||
s->dct_calc = dct32_func;
|
||||
} else {
|
||||
ff_init_ff_cos_tabs(nbits+2);
|
||||
|
||||
s->dct32 = dct32;
|
||||
s->costab = ff_cos_tabs[nbits+2];
|
||||
|
||||
s->csc2 = av_malloc(n/2 * sizeof(FFTSample));
|
||||
|
||||
if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
|
||||
av_free(s->csc2);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < n/2; i++)
|
||||
s->csc2[i] = 0.5 / sin((M_PI / (2*n) * (2*i + 1)));
|
||||
|
||||
switch(inverse) {
|
||||
case DCT_I : s->dct_calc = ff_dct_calc_I_c; break;
|
||||
case DCT_II : s->dct_calc = ff_dct_calc_II_c ; break;
|
||||
case DCT_III: s->dct_calc = ff_dct_calc_III_c; break;
|
||||
case DST_I : s->dct_calc = ff_dst_calc_I_c; break;
|
||||
}
|
||||
}
|
||||
|
||||
s->dct32 = ff_dct32_float;
|
||||
if (HAVE_MMX) ff_dct_init_mmx(s);
|
||||
|
||||
return 0;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user