summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Doxyfile347
-rw-r--r--Makefile4
-rw-r--r--RELEASE2
-rw-r--r--cmdutils.c2
-rwxr-xr-xconfigure30
-rw-r--r--doc/APIchanges3
-rw-r--r--doc/TODO82
-rw-r--r--doc/developer.texi7
-rw-r--r--doc/examples/Makefile2
-rw-r--r--doc/examples/encoding.c (renamed from doc/examples/encoding-example.c)29
-rw-r--r--doc/examples/filtering.c230
-rw-r--r--doc/examples/metadata.c55
-rw-r--r--doc/examples/muxing.c (renamed from doc/examples/muxing-example.c)7
-rw-r--r--doc/ffmpeg.texi15
-rw-r--r--doc/filters.texi32
-rw-r--r--doc/general.texi45
-rw-r--r--doc/muxers.texi4
-rwxr-xr-xdoc/texi2pod.pl1
-rw-r--r--ffmpeg.c225
-rw-r--r--ffplay.c2
-rw-r--r--ffprobe.c6
-rw-r--r--ffserver.c5
-rw-r--r--libavcodec/Makefile1
-rw-r--r--libavcodec/aac.h9
-rw-r--r--libavcodec/aacdec.c42
-rw-r--r--libavcodec/aacenc.h2
-rw-r--r--libavcodec/aacps.c2
-rw-r--r--libavcodec/ac3.h4
-rw-r--r--libavcodec/ac3dec.h30
-rw-r--r--libavcodec/ac3dsp.c15
-rw-r--r--libavcodec/ac3enc.h4
-rw-r--r--libavcodec/ac3enc_fixed.c9
-rw-r--r--libavcodec/ac3enc_float.c9
-rw-r--r--libavcodec/ac3enc_template.c16
-rw-r--r--libavcodec/acelp_pitch_delay.c1
-rw-r--r--libavcodec/amrnbdec.c16
-rw-r--r--libavcodec/ansi.c2
-rw-r--r--libavcodec/apedec.c2
-rw-r--r--libavcodec/arm/ac3dsp_neon.S7
-rw-r--r--libavcodec/arm/dsputil_init_neon.c3
-rw-r--r--libavcodec/arm/dsputil_neon.S16
-rw-r--r--libavcodec/arm/fft_fixed_neon.S6
-rw-r--r--libavcodec/ass.h3
-rw-r--r--libavcodec/avcodec.h11
-rw-r--r--libavcodec/binkaudio.c3
-rw-r--r--libavcodec/bit_depth_template.c (renamed from libavcodec/high_bit_depth.h)18
-rw-r--r--libavcodec/bitstream.c4
-rw-r--r--libavcodec/cook.c3
-rw-r--r--libavcodec/dca.c3
-rw-r--r--libavcodec/dct-test.c471
-rw-r--r--libavcodec/dnxhddata.c610
-rw-r--r--libavcodec/dsputil.c17
-rw-r--r--libavcodec/dsputil.h20
-rw-r--r--libavcodec/dsputil_template.c2
-rw-r--r--libavcodec/dv.c25
-rw-r--r--libavcodec/dxva2.h2
-rw-r--r--libavcodec/dxva2_h264.c31
-rw-r--r--libavcodec/ffv1.c74
-rw-r--r--libavcodec/flashsv.c117
-rw-r--r--libavcodec/flicvideo.c1
-rw-r--r--libavcodec/get_bits.h12
-rw-r--r--libavcodec/h264.c346
-rw-r--r--libavcodec/h264.h500
-rw-r--r--libavcodec/h264_cabac.c36
-rw-r--r--libavcodec/h264_cavlc.c2
-rw-r--r--libavcodec/h264_loopfilter.c82
-rw-r--r--libavcodec/h264_mvpred.h124
-rw-r--r--libavcodec/h264dsp_template.c2
-rw-r--r--libavcodec/h264idct_template.c4
-rw-r--r--libavcodec/h264pred_template.c3
-rw-r--r--libavcodec/iirfilter.c13
-rw-r--r--libavcodec/ituh263dec.c1
-rw-r--r--libavcodec/libgsm.c2
-rw-r--r--libavcodec/libopencore-amr.c2
-rw-r--r--libavcodec/libschroedingerdec.c2
-rw-r--r--libavcodec/libvo-amrwbenc.c2
-rw-r--r--libavcodec/libvorbis.c1
-rw-r--r--libavcodec/libvpxenc.c1
-rw-r--r--libavcodec/libxvidff.c3
-rw-r--r--libavcodec/lpc.c2
-rw-r--r--libavcodec/mjpegdec.c41
-rw-r--r--libavcodec/motion_est_template.c2
-rw-r--r--libavcodec/mpeg12.c2
-rw-r--r--libavcodec/mpegvideo.c19
-rw-r--r--libavcodec/mpegvideo.h1
-rw-r--r--libavcodec/mpegvideo_enc.c7
-rw-r--r--libavcodec/opt.h18
-rw-r--r--libavcodec/pcm.c1
-rw-r--r--libavcodec/pgssubdec.c2
-rw-r--r--libavcodec/ppc/fft_altivec.c6
-rw-r--r--libavcodec/put_bits.h117
-rw-r--r--libavcodec/qcelpdata.h4
-rw-r--r--libavcodec/raw.c1
-rw-r--r--libavcodec/rawdec.c1
-rw-r--r--libavcodec/rv34.c165
-rw-r--r--libavcodec/rv40data.h2
-rw-r--r--libavcodec/sbr.h8
-rw-r--r--libavcodec/shorten.c3
-rw-r--r--libavcodec/snow.c343
-rw-r--r--libavcodec/svq3.c2
-rw-r--r--libavcodec/tableprint.h2
-rw-r--r--libavcodec/utils.c1
-rw-r--r--libavcodec/vc1.c2
-rw-r--r--libavcodec/vc1dec.c7
-rw-r--r--libavcodec/vp8.c35
-rw-r--r--libavcodec/wmavoice.c22
-rw-r--r--libavcodec/x86/Makefile1
-rw-r--r--libavcodec/x86/ac3dsp.asm102
-rw-r--r--libavcodec/x86/ac3dsp_mmx.c9
-rw-r--r--libavcodec/x86/dsputil_mmx.c161
-rw-r--r--libavcodec/x86/dsputil_yasm.asm115
-rw-r--r--libavcodec/x86/h264_intrapred_10bit.asm931
-rw-r--r--libavcodec/x86/h264_intrapred_init.c58
-rw-r--r--libavcodec/x86/h264_qpel_10bit.asm891
-rw-r--r--libavcodec/x86/h264_qpel_mmx.c98
-rw-r--r--libavcodec/x86/x86util.asm8
-rw-r--r--libavcodec/xsubdec.c2
-rw-r--r--libavdevice/alsa-audio-common.c4
-rw-r--r--libavdevice/alsa-audio-dec.c49
-rw-r--r--libavdevice/alsa-audio-enc.c13
-rw-r--r--libavdevice/alsa-audio.h8
-rw-r--r--libavdevice/libdc1394.c1
-rw-r--r--libavdevice/openal-dec.c26
-rw-r--r--libavdevice/oss_audio.c7
-rw-r--r--libavdevice/x11grab.c22
-rw-r--r--libavfilter/avfilter.h6
-rw-r--r--libavfilter/avfiltergraph.h12
-rw-r--r--libavfilter/formats.c12
-rw-r--r--libavfilter/graphparser.c60
-rw-r--r--libavfilter/internal.h3
-rw-r--r--libavfilter/vf_aspect.c1
-rw-r--r--libavfilter/vf_crop.c1
-rw-r--r--libavfilter/vf_drawtext.c17
-rw-r--r--libavfilter/vf_frei0r.c1
-rw-r--r--libavfilter/vf_lut.c18
-rw-r--r--libavfilter/vf_overlay.c1
-rw-r--r--libavfilter/vf_pad.c13
-rw-r--r--libavfilter/vf_scale.c11
-rw-r--r--libavfilter/vf_setpts.c1
-rw-r--r--libavfilter/vf_settb.c1
-rw-r--r--libavfilter/vf_yadif.c28
-rw-r--r--libavfilter/vsrc_color.c1
-rw-r--r--libavfilter/vsrc_nullsrc.c1
-rw-r--r--libavfilter/x86/gradfun.c20
-rw-r--r--libavformat/4xm.c1
-rw-r--r--libavformat/Makefile1
-rw-r--r--libavformat/a64.c1
-rw-r--r--libavformat/adtsenc.c4
-rw-r--r--libavformat/aiffenc.c1
-rw-r--r--libavformat/applehttp.c1
-rw-r--r--libavformat/asfdec.c7
-rw-r--r--libavformat/assdec.c1
-rw-r--r--libavformat/audiointerleave.c1
-rw-r--r--libavformat/avformat.h114
-rw-r--r--libavformat/avidec.c292
-rw-r--r--libavformat/avio.h12
-rw-r--r--libavformat/bethsoftvid.c2
-rw-r--r--libavformat/bink.c9
-rw-r--r--libavformat/caf.c1
-rw-r--r--libavformat/cafdec.c1
-rw-r--r--libavformat/cafenc.c3
-rw-r--r--libavformat/dv.c1
-rw-r--r--libavformat/dvenc.c1
-rw-r--r--libavformat/ffmdec.c2
-rw-r--r--libavformat/ffmenc.c2
-rw-r--r--libavformat/ffmetadec.c1
-rw-r--r--libavformat/flvdec.c2
-rw-r--r--libavformat/flvenc.c1
-rw-r--r--libavformat/gif.c29
-rw-r--r--libavformat/gxf.c27
-rw-r--r--libavformat/gxfenc.c2
-rw-r--r--libavformat/idroqdec.c1
-rw-r--r--libavformat/img2.c12
-rw-r--r--libavformat/internal.h4
-rw-r--r--libavformat/librtmp.c1
-rw-r--r--libavformat/matroskadec.c2
-rw-r--r--libavformat/matroskaenc.c4
-rw-r--r--libavformat/mm.c2
-rw-r--r--libavformat/mmsh.c1
-rw-r--r--libavformat/mov.c3
-rw-r--r--libavformat/movenc.c2
-rw-r--r--libavformat/mp3dec.c1
-rw-r--r--libavformat/mp3enc.c43
-rw-r--r--libavformat/mpegenc.c1
-rw-r--r--libavformat/mpegts.c1
-rw-r--r--libavformat/mpegtsenc.c1
-rw-r--r--libavformat/mxfdec.c1
-rw-r--r--libavformat/mxfenc.c4
-rw-r--r--libavformat/nsvdec.c2
-rw-r--r--libavformat/nut.c1
-rw-r--r--libavformat/nutdec.c1
-rw-r--r--libavformat/nutenc.c1
-rw-r--r--libavformat/nuv.c1
-rw-r--r--libavformat/oggdec.c19
-rw-r--r--libavformat/oggenc.c1
-rw-r--r--libavformat/oma.c1
-rw-r--r--libavformat/pcm.c1
-rw-r--r--libavformat/psxstr.c1
-rw-r--r--libavformat/r3d.c1
-rw-r--r--libavformat/riff.c2
-rw-r--r--libavformat/rl2.c1
-rw-r--r--libavformat/rtmppkt.c1
-rw-r--r--libavformat/rtmppkt.h2
-rw-r--r--libavformat/rtmpproto.c2
-rw-r--r--libavformat/rtpdec.c1
-rw-r--r--libavformat/rtpenc.c1
-rw-r--r--libavformat/rtsp.c19
-rw-r--r--libavformat/rtsp.h6
-rw-r--r--libavformat/rtspdec.c1
-rw-r--r--libavformat/seek.c1
-rw-r--r--libavformat/segafilm.c28
-rw-r--r--libavformat/soxdec.c1
-rw-r--r--libavformat/soxenc.c1
-rw-r--r--libavformat/swfdec.c1
-rw-r--r--libavformat/thp.c1
-rw-r--r--libavformat/udp.c2
-rw-r--r--libavformat/utils.c56
-rw-r--r--libavformat/version.h11
-rw-r--r--libavformat/vqf.c1
-rw-r--r--libavformat/wav.c2
-rw-r--r--libavformat/wc3movie.c1
-rw-r--r--libavformat/wtvdec.c2
-rw-r--r--libavutil/Makefile3
-rw-r--r--libavutil/adler32.c48
-rw-r--r--libavutil/aes.c303
-rw-r--r--libavutil/cpu.c55
-rw-r--r--libavutil/des.c12
-rw-r--r--libavutil/dict.h44
-rw-r--r--libavutil/eval.c27
-rw-r--r--libavutil/file.c1
-rw-r--r--libavutil/file.h3
-rw-r--r--libavutil/imgutils.c1
-rw-r--r--libavutil/imgutils.h6
-rw-r--r--libavutil/lfg.h2
-rw-r--r--libavutil/lls.c133
-rw-r--r--libavutil/lzo.h2
-rw-r--r--libavutil/md5.c136
-rw-r--r--libavutil/opt.c23
-rw-r--r--libavutil/parseutils.c2
-rw-r--r--libavutil/sha.c4
-rw-r--r--libpostproc/postprocess.c32
-rw-r--r--libpostproc/postprocess_internal.h1
-rw-r--r--libswscale/swscale.c13
-rw-r--r--libswscale/swscale.h3
-rw-r--r--libswscale/swscale_internal.h7
-rw-r--r--subdir.mak16
-rw-r--r--tests/Makefile11
-rw-r--r--tests/copy.regression.ref465
-rwxr-xr-xtests/fate-run.sh1
-rw-r--r--tests/fate/aac.mak12
-rw-r--r--tests/fate/dct.mak5
-rw-r--r--tests/fate/fft.mak46
-rw-r--r--tests/fate/libavutil.mak34
-rw-r--r--tests/fate2.mak8
-rw-r--r--tests/ref/fate/base649
-rw-r--r--tests/ref/fate/crc4
-rw-r--r--tests/ref/fate/eval164
-rw-r--r--tests/ref/fate/iirfilter1024
-rw-r--r--tests/ref/fate/md55
-rw-r--r--tests/ref/lavf/ffm2
-rw-r--r--tests/ref/lavf/gif4
-rw-r--r--tests/ref/seek/lavf_gif2
-rw-r--r--tests/seek_test.c1
264 files changed, 7513 insertions, 3354 deletions
diff --git a/.gitignore b/.gitignore
index 3e8ed00..c922b88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,5 +44,4 @@ tools/pktdumper
tools/probetest
tools/qt-faststart
tools/trasher
-tools/trasher*.d
version.h
diff --git a/Doxyfile b/Doxyfile
index cadb158..32f84dd 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1,4 +1,4 @@
-# Doxyfile 1.5.6
+# Doxyfile 1.7.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@@ -54,11 +54,11 @@ CREATE_SUBDIRS = NO
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
-# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
-# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
-# and Ukrainian.
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
OUTPUT_LANGUAGE = English
@@ -155,13 +155,6 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = NO
-
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
@@ -214,6 +207,18 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
@@ -268,6 +273,22 @@ SUBGROUPING = YES
TYPEDEF_HIDES_STRUCT = NO
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE = 0
+
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -366,6 +387,12 @@ HIDE_SCOPE_NAMES = NO
SHOW_INCLUDE_FILES = YES
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
@@ -385,6 +412,16 @@ SORT_MEMBER_DOCS = YES
SORT_BRIEF_DOCS = NO
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
@@ -459,7 +496,8 @@ SHOW_DIRECTORIES = NO
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page. This will remove the Namespaces entry from the Quick Index
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
@@ -474,6 +512,15 @@ SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
@@ -577,7 +624,8 @@ EXCLUDE_SYMLINKS = NO
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
-EXCLUDE_PATTERNS = *.git *.d
+EXCLUDE_PATTERNS = *.git \
+ *.d
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -591,14 +639,15 @@ EXCLUDE_SYMBOLS =
# directories that contain example code fragments that are included (see
# the \include command).
-EXAMPLE_PATH =
+EXAMPLE_PATH = libavcodec/ \
+ libavformat/
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
-EXAMPLE_PATTERNS =
+EXAMPLE_PATTERNS = *-example.c
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
@@ -618,14 +667,17 @@ IMAGE_PATH =
# by executing (via popen()) the command <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files.
@@ -675,7 +727,8 @@ REFERENCES_RELATION = NO
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentstion.
+# link to the source code.
+# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
@@ -758,18 +811,50 @@ HTML_FOOTER =
HTML_STYLESHEET =
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-GENERATE_HTMLHELP = NO
+HTML_DYNAMIC_SECTIONS = NO
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
@@ -779,6 +864,8 @@ GENERATE_HTMLHELP = NO
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
GENERATE_DOCSET = NO
@@ -796,13 +883,22 @@ DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = org.doxygen.Project
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
-HTML_DYNAMIC_SECTIONS = NO
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
@@ -841,6 +937,76 @@ BINARY_TOC = NO
TOC_EXPAND = NO
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
@@ -854,27 +1020,30 @@ ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
-# If the tag value is set to FRAME, a side panel will be generated
+# If the tag value is set to YES, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature. Other possible values
-# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
-# and Class Hiererachy pages using a tree view instead of an ordered list;
-# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
-# disables this behavior completely. For backwards compatibility with previous
-# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
-# respectively.
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
@@ -883,6 +1052,34 @@ TREEVIEW_WIDTH = 250
FORMULA_FONTSIZE = 10
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
@@ -900,6 +1097,9 @@ LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
LATEX_CMD_NAME = latex
@@ -959,6 +1159,13 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1095,8 +1302,10 @@ GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
@@ -1158,16 +1367,22 @@ INCLUDE_FILE_PATTERNS =
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
-PREDEFINED = __attribute__(x)="" "RENAME(x)=x ## _TMPL" "DEF(x)=x ## _TMPL" \
- HAVE_AV_CONFIG_H HAVE_MMX HAVE_MMX2 HAVE_AMD3DNOW \
+PREDEFINED = "__attribute__(x)=" \
+ "RENAME(x)=x ## _TMPL" \
+ "DEF(x)=x ## _TMPL" \
+ HAVE_AV_CONFIG_H \
+ HAVE_MMX \
+ HAVE_MMX2 \
+ HAVE_AMD3DNOW \
+ "DECLARE_ALIGNED(a,t,n)=t n" \
+ "offsetof(x,y)=0x42"
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
-#EXPAND_AS_DEFINED = FF_COMMON_FRAME
-EXPAND_AS_DEFINED = declare_idct(idct, table, idct_row_head, idct_row, idct_row_tail, idct_row_mid)
+EXPAND_AS_DEFINED = declare_idct
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
@@ -1185,9 +1400,11 @@ SKIP_FUNCTION_MACROS = YES
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
-# TAGFILES = file1 file2 ...
+#
+# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
@@ -1255,6 +1472,14 @@ HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
# font does not include all possible unicode characters however, so when you need
@@ -1266,6 +1491,11 @@ HAVE_DOT = NO
DOT_FONTNAME = FreeSans
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
@@ -1383,10 +1613,10 @@ DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is enabled by default, which results in a transparent
-# background. Warning: Depending on the platform used, enabling this option
-# may lead to badly anti-aliased labels on the edges of a graph (i.e. they
-# become hard to read).
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = YES
@@ -1408,12 +1638,3 @@ GENERATE_LEGEND = YES
# the various graphs.
DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
diff --git a/Makefile b/Makefile
index 1d4e494..5bc9c25 100644
--- a/Makefile
+++ b/Makefile
@@ -150,8 +150,6 @@ distclean::
config:
$(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION)
-check: test
-
include $(SRC_PATH)/doc/Makefile
include $(SRC_PATH)/tests/Makefile
@@ -166,5 +164,5 @@ $(sort $(OBJDIRS)):
# so this saves some time on slow systems.
.SUFFIXES:
-.PHONY: all all-yes alltools *clean check config examples install*
+.PHONY: all all-yes alltools *clean config examples install*
.PHONY: testprogs uninstall*
diff --git a/RELEASE b/RELEASE
index eb49d7c..5664e30 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-0.7
+git
diff --git a/cmdutils.c b/cmdutils.c
index a3f643b..53266d4 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -494,7 +494,7 @@ void set_context_opts(void *ctx, void *opts_ctx, int flags, AVCodec *codec)
if (av_find_opt(priv_ctx, opt_names[i], NULL, flags, flags)) {
if (av_set_string3(priv_ctx, opt_names[i], opt_values[i], 1, NULL) < 0) {
fprintf(stderr, "Invalid value '%s' for option '%s'\n",
- opt_names[i], opt_values[i]);
+ opt_values[i], opt_names[i]);
exit(1);
}
} else
diff --git a/configure b/configure
index fd4b034..202fffa 100755
--- a/configure
+++ b/configure
@@ -106,8 +106,8 @@ Configuration options:
--disable-lpc disable LPC code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
- --enable-vaapi enable VAAPI code
- --enable-vdpau enable VDPAU code
+ --enable-vaapi enable VAAPI code [autodetect]
+ --enable-vdpau enable VDPAU code [autodetect]
--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
@@ -1690,6 +1690,8 @@ SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
+SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
+SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
AS_O='-o $@'
CC_O='-o $@'
@@ -2455,12 +2457,11 @@ case $target_os in
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
- SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
- install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
- install -d "$(LIBDIR)"; \
- install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
- SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
+ SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
+ SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
+ SLIB_INSTALL_LINKS=
+ SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
+ SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
objformat="win32"
enable dos_paths
@@ -2518,8 +2519,7 @@ case $target_os in
emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
- SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
- SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
+ SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
enable dos_paths
;;
gnu/kfreebsd)
@@ -2560,8 +2560,6 @@ EOF
exit 1;
fi
-disabled static && LIBNAME=""
-
die_license_disabled() {
enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
}
@@ -3026,7 +3024,7 @@ enabled extra_warnings && check_cflags -Winline
# add some linker flags
check_ldflags -Wl,--warn-common
-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
+check_ldflags -Wl,-rpath-link=libpostproc:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil
test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
echo "X{};" > $TMPV
@@ -3326,8 +3324,10 @@ SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
-SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
-SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
+SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
+SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
+SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
+SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
SAMPLES:=${samples:-\$(FATE_SAMPLES)}
EOF
diff --git a/doc/APIchanges b/doc/APIchanges
index 6860b57..52d7001 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
+2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h
+ Add function av_get_output_timestamp().
+
2011-06-28 - 5129336 - lavu 51.11.0 - avutil.h
Define the AV_PICTURE_TYPE_NONE value in AVPictureType enum.
diff --git a/doc/TODO b/doc/TODO
deleted file mode 100644
index 8ff8a6b..0000000
--- a/doc/TODO
+++ /dev/null
@@ -1,82 +0,0 @@
-ffmpeg TODO list:
-----------------
-
-Fabrice's TODO list: (unordered)
--------------------
-Short term:
-
-- use AVFMTCTX_DISCARD_PKT in ffplay so that DV has a chance to work
-- add RTSP regression test (both client and server)
-- make ffserver allocate AVFormatContext
-- clean up (incompatible change, for 0.5.0):
- * AVStream -> AVComponent
- * AVFormatContext -> AVInputStream/AVOutputStream
- * suppress rate_emu from AVCodecContext
-- add new float/integer audio filterting and conversion : suppress
- CODEC_ID_PCM_xxc and use CODEC_ID_RAWAUDIO.
-- fix telecine and frame rate conversion
-
-Long term (ask me if you want to help):
-
-- commit new imgconvert API and new PIX_FMT_xxx alpha formats
-- commit new LGPL'ed float and integer-only AC3 decoder
-- add WMA integer-only decoder
-- add new MPEG4-AAC audio decoder (both integer-only and float version)
-
-Michael's TODO list: (unordered) (if anyone wanna help with sth, just ask)
--------------------
-- optimize H264 CABAC
-- more optimizations
-- simper rate control
-
-Philip'a TODO list: (alphabetically ordered) (please help)
-------------------
-- Add a multi-ffm filetype so that feeds can be recorded into multiple files rather
- than one big file.
-- Authenticated users support -- where the authentication is in the URL
-- Change ASF files so that the embedded timestamp in the frames is right rather
- than being an offset from the start of the stream
-- Make ffm files more resilient to changes in the codec structures so that you
- can play old ffm files.
-
-Baptiste's TODO list:
------------------
-- mov edit list support (AVEditList)
-- YUV 10 bit per component support "2vuy"
-- mxf muxer
-- mpeg2 non linear quantizer
-
-unassigned TODO: (unordered)
----------------
-- use AVFrame for audio codecs too
-- rework aviobuf.c buffering strategy and fix url_fskip
-- generate optimal huffman tables for mjpeg encoding
-- fix ffserver regression tests
-- support xvids motion estimation
-- support x264s motion estimation
-- support x264s rate control
-- SNOW: non translational motion compensation
-- SNOW: more optimal quantization
-- SNOW: 4x4 block support
-- SNOW: 1/8 pel motion compensation support
-- SNOW: iterative motion estimation based on subsampled images
-- SNOW: try B frames and MCTF and see how their PSNR/bitrate/complexity behaves
-- SNOW: try to use the wavelet transformed MC-ed reference frame as context for the entropy coder
-- SNOW: think about/analyize how to make snow use multiple cpus/threads
-- SNOW: finish spec
-- FLAC: lossy encoding (viterbi and naive scalar quantization)
-- libavfilter
-- JPEG2000 decoder & encoder
-- MPEG4 GMC encoding support
-- macroblock based pixel format (better cache locality, somewhat complex, one paper claimed it faster for high res)
-- regression tests for codecs which do not have an encoder (I+P-frame bitstream in the 'master' branch)
-- add support for using mplayers video filters to ffmpeg
-- H264 encoder
-- per MB ratecontrol (so VCD and such do work better)
-- write a script which iteratively changes all functions between always_inline and noinline and benchmarks the result to find the best set of inlined functions
-- convert all the non SIMD asm into small asm vs. C testcases and submit them to the gcc devels so they can improve gcc
-- generic audio mixing API
-- extract PES packetizer from PS muxer and use it for new TS muxer
-- implement automatic AVBistreamFilter activation
-- make cabac encoder use bytestream (see http://trac.videolan.org/x264/changeset/?format=diff&new=651)
-- merge imdct and windowing, the current code does considerable amounts of redundant work
diff --git a/doc/developer.texi b/doc/developer.texi
index c1ca096..7701942 100644
--- a/doc/developer.texi
+++ b/doc/developer.texi
@@ -244,7 +244,8 @@ Note, these rules are mostly borrowed from the MPlayer project.
@section Submitting patches
-First, read the (@pxref{Coding Rules}) above if you did not yet.
+First, read the @ref{Coding Rules} above if you did not yet, in particular
+the rules regarding patch submission.
When you submit your patch, please use @code{git format-patch} or
@code{git send-email}. We cannot read other diffs :-)
@@ -259,8 +260,8 @@ for us and greatly increases your chances of getting your patch applied.
Use the patcheck tool of FFmpeg to check your patch.
The tool is located in the tools directory.
-Run the regression tests before submitting a patch so that you can
-verify that there are no big problems.
+Run the @ref{Regression Tests} before submitting a patch in order to verify
+it does not cause unexpected problems.
Patches should be posted as base64 encoded attachments (or any other
encoding which ensures that the patch will not be trashed during
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index c32d524..fde2256 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -3,7 +3,7 @@ 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
+EXAMPLES=encoding filtering metadata muxing
OBJS=$(addsuffix .o,$(EXAMPLES))
diff --git a/doc/examples/encoding-example.c b/doc/examples/encoding.c
index a32c09a..2d06cf6 100644
--- a/doc/examples/encoding-example.c
+++ b/doc/examples/encoding.c
@@ -20,21 +20,13 @@
/**
* @file
- * avcodec API use example.
+ * libavcodec API use example.
*
- * Note that this library only handles codecs (mpeg, mpeg4, etc...),
+ * Note that libavcodec only handles codecs (mpeg, mpeg4, etc...),
* not file formats (avi, vob, etc...). See library 'libavformat' for the
* format handling
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#ifdef HAVE_AV_CONFIG_H
-#undef HAVE_AV_CONFIG_H
-#endif
-
#include "libavcodec/avcodec.h"
#include "libavutil/mathematics.h"
@@ -70,6 +62,7 @@ static void audio_encode_example(const char *filename)
c->bit_rate = 64000;
c->sample_rate = 44100;
c->channels = 2;
+ c->sample_fmt = AV_SAMPLE_FMT_S16;
/* open it */
if (avcodec_open(c, codec) < 0) {
@@ -204,7 +197,7 @@ static void video_encode_example(const char *filename)
int i, out_size, size, x, y, outbuf_size;
FILE *f;
AVFrame *picture;
- uint8_t *outbuf, *picture_buf;
+ uint8_t *outbuf;
printf("Video encoding\n");
@@ -244,15 +237,11 @@ static void video_encode_example(const char *filename)
/* alloc image and output buffer */
outbuf_size = 100000;
outbuf = malloc(outbuf_size);
- size = c->width * c->height;
- picture_buf = malloc((size * 3) / 2); /* size for YUV 420 */
- picture->data[0] = picture_buf;
- picture->data[1] = picture->data[0] + size;
- picture->data[2] = picture->data[1] + size / 4;
- picture->linesize[0] = c->width;
- picture->linesize[1] = c->width / 2;
- picture->linesize[2] = c->width / 2;
+ /* the image can be allocated by any means and av_image_alloc() is
+ * just the most convenient way if av_malloc() is to be used */
+ av_image_alloc(picture->data, picture->linesize,
+ c->width, c->height, c->pix_fmt, 1);
/* encode 1 second of video */
for(i=0;i<25;i++) {
@@ -295,11 +284,11 @@ static void video_encode_example(const char *filename)
outbuf[3] = 0xb7;
fwrite(outbuf, 1, 4, f);
fclose(f);
- free(picture_buf);
free(outbuf);
avcodec_close(c);
av_free(c);
+ av_free(picture->data[0]);
av_free(picture);
printf("\n");
}
diff --git a/doc/examples/filtering.c b/doc/examples/filtering.c
new file mode 100644
index 0000000..369cc03
--- /dev/null
+++ b/doc/examples/filtering.c
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2010 Nicolas George
+ * Copyright (c) 2011 Stefano Sabatini
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * API example for decoding and filtering
+ */
+
+#define _XOPEN_SOURCE 600 /* for usleep */
+
+#include <libavcodec/avcodec.h>
+#include <libavformat/avformat.h>
+#include <libavfilter/avfiltergraph.h>
+#include <libavfilter/vsink_buffer.h>
+#include <libavfilter/vsrc_buffer.h>
+
+const char *filter_descr = "scale=78:24";
+
+static AVFormatContext *fmt_ctx;
+static AVCodecContext *dec_ctx;
+AVFilterContext *buffersink_ctx;
+AVFilterContext *buffersrc_ctx;
+AVFilterGraph *filter_graph;
+static int video_stream_index = -1;
+static int64_t last_pts = AV_NOPTS_VALUE;
+
+static int open_input_file(const char *filename)
+{
+ int ret, i;
+ AVCodec *dec;
+
+ if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
+ return ret;
+ }
+
+ if ((ret = av_find_stream_info(fmt_ctx)) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
+ return ret;
+ }
+
+ /* select the video stream */
+ ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &dec, 0);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input file\n");
+ return ret;
+ }
+ video_stream_index = ret;
+ dec_ctx = fmt_ctx->streams[video_stream_index]->codec;
+
+ /* init the video decoder */
+ if ((ret = avcodec_open(dec_ctx, dec)) < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot open video decoder\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int init_filters(const char *filters_descr)
+{
+ char args[512];
+ int ret;
+ AVFilter *buffersrc = avfilter_get_by_name("buffer");
+ AVFilter *buffersink = avfilter_get_by_name("buffersink");
+ AVFilterInOut *outputs = avfilter_inout_alloc();
+ AVFilterInOut *inputs = avfilter_inout_alloc();
+ enum PixelFormat pix_fmts[] = { PIX_FMT_GRAY8, PIX_FMT_NONE };
+ filter_graph = avfilter_graph_alloc();
+
+ /* buffer video source: the decoded frames from the decoder will be inserted here. */
+ snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d",
+ dec_ctx->width, dec_ctx->height, dec_ctx->pix_fmt,
+ dec_ctx->time_base.num, dec_ctx->time_base.den,
+ dec_ctx->sample_aspect_ratio.num, dec_ctx->sample_aspect_ratio.den);
+ ret = avfilter_graph_create_filter(&buffersrc_ctx, buffersrc, "in",
+ args, NULL, filter_graph);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot create buffer source\n");
+ return ret;
+ }
+
+ /* buffer video sink: to terminate the filter chain. */
+ ret = avfilter_graph_create_filter(&buffersink_ctx, buffersink, "out",
+ NULL, pix_fmts, filter_graph);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Cannot create buffer sink\n");
+ return ret;
+ }
+
+ /* Endpoints for the filter graph. */
+ outputs->name = av_strdup("in");
+ outputs->filter_ctx = buffersrc_ctx;
+ outputs->pad_idx = 0;
+ outputs->next = NULL;
+
+ inputs->name = av_strdup("out");
+ inputs->filter_ctx = buffersink_ctx;
+ inputs->pad_idx = 0;
+ inputs->next = NULL;
+
+ if ((ret = avfilter_graph_parse(filter_graph, filter_descr,
+ &inputs, &outputs, NULL)) < 0)
+ return ret;
+
+ if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0)
+ return ret;
+}
+
+static void display_picref(AVFilterBufferRef *picref, AVRational time_base)
+{
+ int x, y;
+ uint8_t *p0, *p;
+ int64_t delay;
+
+ if (picref->pts != AV_NOPTS_VALUE) {
+ if (last_pts != AV_NOPTS_VALUE) {
+ /* sleep roughly the right amount of time;
+ * usleep is in microseconds, just like AV_TIME_BASE. */
+ delay = av_rescale_q(picref->pts - last_pts,
+ time_base, AV_TIME_BASE_Q);
+ if (delay > 0 && delay < 1000000)
+ usleep(delay);
+ }
+ last_pts = picref->pts;
+ }
+
+ /* Trivial ASCII grayscale display. */
+ p0 = picref->data[0];
+ puts("\033c");
+ for (y = 0; y < picref->video->h; y++) {
+ p = p0;
+ for (x = 0; x < picref->video->w; x++)
+ putchar(" .-+#"[*(p++) / 52]);
+ putchar('\n');
+ p0 += picref->linesize[0];
+ }
+ fflush(stdout);
+}
+
+int main(int argc, char **argv)
+{
+ int ret;
+ AVPacket packet;
+ AVFrame frame;
+ int got_frame;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s file\n", argv[0]);
+ exit(1);
+ }
+
+ avcodec_register_all();
+ av_register_all();
+ avfilter_register_all();
+
+ if ((ret = open_input_file(argv[1]) < 0))
+ goto end;
+ if ((ret = init_filters(filter_descr)) < 0)
+ goto end;
+
+ /* read all packets */
+ while (1) {
+ AVFilterBufferRef *picref;
+ if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
+ break;
+
+ if (packet.stream_index == video_stream_index) {
+ avcodec_get_frame_defaults(&frame);
+ got_frame = 0;
+ ret = avcodec_decode_video2(dec_ctx, &frame, &got_frame, &packet);
+ av_free_packet(&packet);
+ if (ret < 0) {
+ av_log(NULL, AV_LOG_ERROR, "Error decoding video\n");
+ break;
+ }
+
+ if (got_frame) {
+ if (frame.pts == AV_NOPTS_VALUE)
+ frame.pts = frame.pkt_dts == AV_NOPTS_VALUE ?
+ frame.pkt_dts : frame.pkt_pts;
+ /* push the decoded frame into the filtergraph */
+ av_vsrc_buffer_add_frame(buffersrc_ctx, &frame);
+
+ /* pull filtered pictures from the filtergraph */
+ while (avfilter_poll_frame(buffersink_ctx->inputs[0])) {
+ av_vsink_buffer_get_video_buffer_ref(buffersink_ctx, &picref, 0);
+ if (picref) {
+ display_picref(picref, buffersink_ctx->inputs[0]->time_base);
+ avfilter_unref_buffer(picref);
+ }
+ }
+ }
+ }
+ }
+end:
+ avfilter_graph_free(&filter_graph);
+ if (dec_ctx)
+ avcodec_close(dec_ctx);
+ av_close_input_file(fmt_ctx);
+
+ if (ret < 0 && ret != AVERROR_EOF) {
+ char buf[1024];
+ av_strerror(ret, buf, sizeof(buf));
+ fprintf(stderr, "Error occurred: %s\n", buf);
+ exit(1);
+ }
+
+ exit(0);
+}
diff --git a/doc/examples/metadata.c b/doc/examples/metadata.c
new file mode 100644
index 0000000..7d29be7
--- /dev/null
+++ b/doc/examples/metadata.c
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2011 Reinhard Tartler
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * Shows how the metadata API can be used in application programs.
+ */
+
+#include <stdio.h>
+
+#include <libavformat/avformat.h>
+#include <libavutil/dict.h>
+
+int main (int argc, char **argv)
+{
+ AVFormatContext *fmt_ctx = NULL;
+ AVDictionaryEntry *tag = NULL;
+ int ret;
+
+ if (argc != 2) {
+ printf("usage: %s <input_file>\n"
+ "example program to demonstrate the use of the libavformat metadata API.\n"
+ "\n", argv[0]);
+ return 1;
+ }
+
+ av_register_all();
+ if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
+ return ret;
+
+ while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
+ printf("%s=%s\n", tag->key, tag->value);
+
+ avformat_free_context(fmt_ctx);
+ return 0;
+}
diff --git a/doc/examples/muxing-example.c b/doc/examples/muxing.c
index f068e94..9f94a78 100644
--- a/doc/examples/muxing-example.c
+++ b/doc/examples/muxing.c
@@ -22,8 +22,10 @@
/**
* @file
- * Libavformat API example: Output a media file in any supported
- * libavformat format. The default codecs are used.
+ * libavformat API example.
+ *
+ * Output a media file in any supported libavformat format.
+ * The default codecs are used.
*/
#include <stdlib.h>
@@ -31,6 +33,7 @@
#include <string.h>
#include <math.h>
+#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 6f21451..2b08998 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -556,16 +556,19 @@ The timestamps must be specified in ascending order.
@item -aframes @var{number}
Set the number of audio frames to record.
@item -ar @var{freq}
-Set the audio sampling frequency. there is no default for input streams,
-for output streams it is set by default to the frequency of the input stream.
+Set the audio sampling frequency. For output streams it is set by
+default to the frequency of the corresponding input stream. For input
+streams this option only makes sense for audio grabbing devices and raw
+demuxers and is mapped to the corresponding demuxer options.
@item -ab @var{bitrate}
Set the audio bitrate in bit/s (default = 64k).
@item -aq @var{q}
Set the audio quality (codec-specific, VBR).
@item -ac @var{channels}
-Set the number of audio channels. For input streams it is set by
-default to 1, for output streams it is set by default to the same
-number of audio channels in input.
+Set the number of audio channels. For output streams it is set by
+default to the number of input audio channels. For input streams
+this option only makes sense for audio grabbing devices and raw demuxers
+and is mapped to the corresponding demuxer options.
@item -an
Disable audio recording.
@item -acodec @var{codec}
@@ -733,9 +736,11 @@ Read input at native frame rate. Mainly used to simulate a grab device.
@item -loop_input
Loop over the input stream. Currently it works only for image
streams. This option is used for automatic FFserver testing.
+This option is deprecated, use -loop.
@item -loop_output @var{number_of_times}
Repeatedly loop output for formats that support looping such as animated GIF
(0 will loop the output infinitely).
+This option is deprecated, use -loop.
@item -threads @var{count}
Thread count.
@item -vsync @var{parameter}
diff --git a/doc/filters.texi b/doc/filters.texi
index b4ffcd9..2ac4231 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1013,8 +1013,7 @@ Erode an image by using a specific structuring element.
This filter corresponds to the libopencv function @code{cvErode}.
The filter accepts the parameters: @var{struct_el}:@var{nb_iterations},
-with the same meaning and use of those of the dilate filter
-(@pxref{dilate}).
+with the same syntax and semantics as the @ref{dilate} filter.
@subsection smooth
@@ -1129,9 +1128,12 @@ same as @var{out_w} and @var{out_h}
x and y offsets as specified by the @var{x} and @var{y}
expressions, or NAN if not yet specified
-@item a
+@item dar, a
input display aspect ratio, same as @var{iw} / @var{ih}
+@item sar
+input sample aspect ratio
+
@item hsub, vsub
horizontal and vertical chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@@ -1231,9 +1233,12 @@ the output (cropped) width and heigth
@item ow, oh
same as @var{out_w} and @var{out_h}
-@item a
+@item dar, a
input display aspect ratio, same as @var{iw} / @var{ih}
+@item sar
+input sample aspect ratio
+
@item hsub, vsub
horizontal and vertical chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@@ -1426,7 +1431,7 @@ setdar=16:9
setdar=1.77777
@end example
-See also the "setsar" filter documentation (@pxref{setsar}).
+See also the @ref{setsar} filter documentation.
@section setpts
@@ -1737,7 +1742,7 @@ Flip the input video vertically.
Deinterlace the input video ("yadif" means "yet another deinterlacing
filter").
-It accepts the optional parameters: @var{mode}:@var{parity}.
+It accepts the optional parameters: @var{mode}:@var{parity}:@var{auto}.
@var{mode} specifies the interlacing mode to adopt, accepts one of the
following values:
@@ -1771,6 +1776,18 @@ Default value is -1.
If interlacing is unknown or decoder does not export this information,
top field first will be assumed.
+@var{auto} specifies if deinterlacer should trust the interlaced flag
+and only deinterlace frames marked as interlaced
+
+@table @option
+@item 0
+deinterlace all frames
+@item 1
+only deinterlace frames marked as interlaced
+@end table
+
+Default value is 0.
+
@c man end VIDEO FILTERS
@chapter Video Sources
@@ -1960,8 +1977,7 @@ form @var{width}x@var{height} or a frame size abbreviation.
the form @var{num}/@var{den} or a frame rate abbreviation.
@var{src_name} is the name to the frei0r source to load. For more
information regarding frei0r and how to set the parameters read the
-section "frei0r" (@pxref{frei0r}) in the description of the video
-filters.
+section @ref{frei0r} in the description of the video filters.
Some examples follow:
@example
diff --git a/doc/general.texi b/doc/general.texi
index 8e3d4af..f44e573 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -970,7 +970,8 @@ make install
Your install path (@file{/usr/local/} by default) should now have the
necessary DLL and LIB files under the @file{bin} directory.
-@end enumerate
+Alternatively, build the libraries with a cross compiler, according to
+the instructions below in @ref{Cross compilation for Windows with Linux}.
To use those files with MSVC++, do the same as you would do with
the static libraries, as described above. But in Step 4,
@@ -983,10 +984,7 @@ libraries (@file{libxxx.a} files) you should add the MSVC import libraries
libraries (@file{libxxx.dll.a} files), as these will give you undefined
reference errors. There should be no need for @file{libmingwex.a},
@file{libgcc.a}, and @file{wsock32.lib}, nor any other external library
-statically linked into the DLLs. The @file{bin} directory contains a bunch
-of DLL files, but the ones that are actually used to run your application
-are the ones with a major version number in their filenames
-(i.e. @file{avcodec-51.dll}).
+statically linked into the DLLs.
FFmpeg headers do not declare global data for Windows DLLs through the usual
dllexport/dllimport interface. Such data will be exported properly while
@@ -999,10 +997,41 @@ extern __declspec(dllimport) const AVPixFmtDescriptor av_pix_fmt_descriptors[];
Note that using import libraries created by dlltool requires
the linker optimization option to be set to
-"References: Keep Unreferenced Data (/OPT:NOREF)", otherwise
+"References: Keep Unreferenced Data (@code{/OPT:NOREF})", otherwise
the resulting binaries will fail during runtime. This isn't
required when using import libraries generated by lib.exe.
+This issue is reported upstream at
+@url{http://sourceware.org/bugzilla/show_bug.cgi?id=12633}.
+
+To create import libraries that work with the @code{/OPT:REF} option
+(which is enabled by default in Release mode), follow these steps:
+
+@enumerate
+
+@item Open @file{Visual Studio 2005 Command Prompt}.
+
+Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
+which sets up the environment variables for the Visual C++ tools
+(the standard location for this file is
+@file{C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat}).
+
+@item Enter the @file{bin} directory where the created LIB and DLL files
+are stored.
+
+@item Generate new import libraries with @file{lib.exe}:
+
+@example
+lib /machine:i386 /def:..\lib\avcodec-53.def /out:avcodec.lib
+lib /machine:i386 /def:..\lib\avdevice-53.def /out:avdevice.lib
+lib /machine:i386 /def:..\lib\avfilter-2.def /out:avfilter.lib
+lib /machine:i386 /def:..\lib\avformat-53.def /out:avformat.lib
+lib /machine:i386 /def:..\lib\avutil-51.def /out:avutil.lib
+lib /machine:i386 /def:..\lib\swscale-2.def /out:swscale.lib
+@end example
+
+@end enumerate
+@anchor{Cross compilation for Windows with Linux}
@subsection Cross compilation for Windows with Linux
You must use the MinGW cross compilation tools available at
@@ -1037,7 +1066,7 @@ diffutils
Then run
@example
-./configure --enable-static --disable-shared
+./configure
@end example
to make a static build.
@@ -1084,7 +1113,7 @@ and add some special flags to your configure invocation.
For a static build run
@example
-./configure --target-os=mingw32 --enable-static --disable-shared --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
+./configure --target-os=mingw32 --extra-cflags=-mno-cygwin --extra-libs=-mno-cygwin
@end example
and for a build with shared libraries
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 55b44d1..66ea95e 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -51,7 +51,7 @@ and the input video converted to MPEG-2 video, use the command:
ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc -
@end example
-See also the @code{framecrc} muxer (@pxref{framecrc}).
+See also the @ref{framecrc} muxer.
@anchor{framecrc}
@section framecrc
@@ -88,7 +88,7 @@ MPEG-2 video, use the command:
ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc -
@end example
-See also the @code{crc} muxer (@pxref{crc}).
+See also the @ref{crc} muxer.
@section image2
diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl
index 84c36ff..0eb5e8d 100755
--- a/doc/texi2pod.pl
+++ b/doc/texi2pod.pl
@@ -352,6 +352,7 @@ sub postprocess
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
s/;\s+\@pxref\{(?:[^\}]*)\}//g;
+ s/\@ref\{([^\}]*)\}/$1/g;
s/\@noindent\s*//g;
s/\@refill//g;
s/\@gol//g;
diff --git a/ffmpeg.c b/ffmpeg.c
index bd59534..0da0a1f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -40,6 +40,7 @@
#include "libavutil/fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
@@ -89,26 +90,26 @@ const char program_name[] = "ffmpeg";
const int program_birth_year = 2000;
/* select an input stream for an output stream */
-typedef struct AVStreamMap {
+typedef struct StreamMap {
int file_index;
int stream_index;
int sync_file_index;
int sync_stream_index;
-} AVStreamMap;
+} StreamMap;
/**
* select an input file for an output file
*/
-typedef struct AVMetaDataMap {
+typedef struct MetadataMap {
int file; //< file index
char type; //< type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram
int index; //< stream/chapter/program number
-} AVMetaDataMap;
+} MetadataMap;
-typedef struct AVChapterMap {
+typedef struct ChapterMap {
int in_file;
int out_file;
-} AVChapterMap;
+} ChapterMap;
static const OptionDef options[];
@@ -116,26 +117,23 @@ static const OptionDef options[];
#define MAX_STREAMS 1024 /* arbitrary sanity check value */
static const char *last_asked_format = NULL;
-static int64_t input_files_ts_offset[MAX_FILES];
static double *input_files_ts_scale[MAX_FILES] = {NULL};
-static AVCodec **input_codecs = NULL;
-static int nb_input_codecs = 0;
static int nb_input_files_ts_scale[MAX_FILES] = {0};
static AVFormatContext *output_files[MAX_FILES];
static int nb_output_files = 0;
-static AVStreamMap *stream_maps = NULL;
+static StreamMap *stream_maps = NULL;
static int nb_stream_maps;
/* first item specifies output metadata, second is input */
-static AVMetaDataMap (*meta_data_maps)[2] = NULL;
+static MetadataMap (*meta_data_maps)[2] = NULL;
static int nb_meta_data_maps;
static int metadata_global_autocopy = 1;
static int metadata_streams_autocopy = 1;
static int metadata_chapters_autocopy = 1;
-static AVChapterMap *chapter_maps = NULL;
+static ChapterMap *chapter_maps = NULL;
static int nb_chapter_maps;
/* indexed by output file stream index */
@@ -260,19 +258,19 @@ static AVBitStreamFilterContext *subtitle_bitstream_filters=NULL;
#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
-struct AVInputStream;
+struct InputStream;
-typedef struct AVOutputStream {
+typedef struct OutputStream {
int file_index; /* file index */
int index; /* stream index in the output file */
- int source_index; /* AVInputStream index */
+ int source_index; /* InputStream index */
AVStream *st; /* stream in the output file */
int encoding_needed; /* true if encoding needed for this stream */
int frame_number;
/* input pts and corresponding output pts
for A/V sync */
//double sync_ipts; /* dts from the AVPacket of the demuxer in second units */
- struct AVInputStream *sync_ist; /* input stream to sync against */
+ struct InputStream *sync_ist; /* input stream to sync against */
int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ //FIXME look at frame_number
AVBitStreamFilterContext *bitstream_filters;
AVCodec *enc;
@@ -313,17 +311,17 @@ typedef struct AVOutputStream {
#endif
int sws_flags;
-} AVOutputStream;
+} OutputStream;
-static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL };
+static OutputStream **output_streams_for_file[MAX_FILES] = { NULL };
static int nb_output_streams_for_file[MAX_FILES] = { 0 };
-typedef struct AVInputStream {
+typedef struct InputStream {
int file_index;
AVStream *st;
int discard; /* true if stream data should be discarded */
int decoding_needed; /* true if the packets must be decoded in 'raw_fifo' */
- int64_t sample_index; /* current sample */
+ AVCodec *dec;
int64_t start; /* time when read started */
int64_t next_pts; /* synthetic pts for cases where pkt.pts
@@ -332,18 +330,15 @@ typedef struct AVInputStream {
int is_start; /* is 1 at the start and after a discontinuity */
int showed_multi_packet_warning;
int is_past_recording_time;
-#if CONFIG_AVFILTER
- AVFrame *filter_frame;
- int has_filter_frame;
-#endif
-} AVInputStream;
+} InputStream;
-typedef struct AVInputFile {
+typedef struct InputFile {
AVFormatContext *ctx;
int eof_reached; /* true if eof reached */
int ist_index; /* index of first stream in ist_table */
int buffer_size; /* current total buffer size */
-} AVInputFile;
+ int64_t ts_offset;
+} InputFile;
#if HAVE_TERMIOS_H
@@ -351,14 +346,14 @@ typedef struct AVInputFile {
static struct termios oldtty;
#endif
-static AVInputStream *input_streams = NULL;
+static InputStream *input_streams = NULL;
static int nb_input_streams = 0;
-static AVInputFile *input_files = NULL;
+static InputFile *input_files = NULL;
static int nb_input_files = 0;
#if CONFIG_AVFILTER
-static int configure_video_filters(AVInputStream *ist, AVOutputStream *ost)
+static int configure_video_filters(InputStream *ist, OutputStream *ost)
{
AVFilterContext *last_filter, *filter;
/** filter graph containing all filters including input & output */
@@ -554,7 +549,6 @@ static int ffmpeg_exit(int ret)
av_free(vstats_filename);
av_free(streamid_map);
- av_free(input_codecs);
av_free(stream_maps);
av_free(meta_data_maps);
@@ -677,10 +671,10 @@ static void choose_pixel_fmt(AVStream *st, AVCodec *codec)
}
}
-static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
+static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
{
int idx = oc->nb_streams - 1;
- AVOutputStream *ost;
+ OutputStream *ost;
output_streams_for_file[file_idx] =
grow_array(output_streams_for_file[file_idx],
@@ -688,7 +682,7 @@ static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
&nb_output_streams_for_file[file_idx],
oc->nb_streams);
ost = output_streams_for_file[file_idx][idx] =
- av_mallocz(sizeof(AVOutputStream));
+ av_mallocz(sizeof(OutputStream));
if (!ost) {
fprintf(stderr, "Could not alloc output stream\n");
ffmpeg_exit(1);
@@ -758,9 +752,9 @@ static int read_ffserver_streams(AVFormatContext *s, const char *filename)
}
static double
-get_sync_ipts(const AVOutputStream *ost)
+get_sync_ipts(const OutputStream *ost)
{
- const AVInputStream *ist = ost->sync_ist;
+ const InputStream *ist = ost->sync_ist;
return (double)(ist->pts - start_time)/AV_TIME_BASE;
}
@@ -799,8 +793,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, AVCodecContext *avctx
#define MAX_AUDIO_PACKET_SIZE (128 * 1024)
static void do_audio_out(AVFormatContext *s,
- AVOutputStream *ost,
- AVInputStream *ist,
+ OutputStream *ost,
+ InputStream *ist,
unsigned char *buf, int size)
{
uint8_t *buftmp;
@@ -1042,7 +1036,7 @@ need_realloc:
}
}
-static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void **bufp)
+static void pre_process_video_frame(InputStream *ist, AVPicture *picture, void **bufp)
{
AVCodecContext *dec;
AVPicture *picture2;
@@ -1085,8 +1079,8 @@ static void pre_process_video_frame(AVInputStream *ist, AVPicture *picture, void
#define AV_DELAY_MAX 0.100
static void do_subtitle_out(AVFormatContext *s,
- AVOutputStream *ost,
- AVInputStream *ist,
+ OutputStream *ost,
+ InputStream *ist,
AVSubtitle *sub,
int64_t pts)
{
@@ -1151,10 +1145,10 @@ static int bit_buffer_size= 1024*256;
static uint8_t *bit_buffer= NULL;
static void do_video_out(AVFormatContext *s,
- AVOutputStream *ost,
- AVInputStream *ist,
+ OutputStream *ost,
+ InputStream *ist,
AVFrame *in_picture,
- int *frame_size)
+ int *frame_size, float quality)
{
int nb_frames, i, ret, av_unused resample_changed;
AVFrame *final_picture, *formatted_picture;
@@ -1285,7 +1279,7 @@ static void do_video_out(AVFormatContext *s,
/* handles sameq here. This is not correct because it may
not be a global option */
- big_picture.quality = same_quality ? ist->st->quality : ost->st->quality;
+ big_picture.quality = quality;
if(!me_threshold)
big_picture.pict_type = 0;
// big_picture.pts = AV_NOPTS_VALUE;
@@ -1336,7 +1330,7 @@ static double psnr(double d){
return -10.0*log(d)/log(10.0);
}
-static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
+static void do_video_stats(AVFormatContext *os, OutputStream *ost,
int frame_size)
{
AVCodecContext *enc;
@@ -1374,11 +1368,11 @@ static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
}
static void print_report(AVFormatContext **output_files,
- AVOutputStream **ost_table, int nb_ostreams,
+ OutputStream **ost_table, int nb_ostreams,
int is_last_report)
{
char buf[1024];
- AVOutputStream *ost;
+ OutputStream *ost;
AVFormatContext *oc;
int64_t total_size;
AVCodecContext *enc;
@@ -1513,12 +1507,12 @@ static void generate_silence(uint8_t* buf, enum AVSampleFormat sample_fmt, size_
}
/* pkt = NULL means EOF (needed to flush decoder buffers) */
-static int output_packet(AVInputStream *ist, int ist_index,
- AVOutputStream **ost_table, int nb_ostreams,
+static int output_packet(InputStream *ist, int ist_index,
+ OutputStream **ost_table, int nb_ostreams,
const AVPacket *pkt)
{
AVFormatContext *os;
- AVOutputStream *ost;
+ OutputStream *ost;
int ret, i;
int got_output;
AVFrame picture;
@@ -1529,6 +1523,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
#if CONFIG_AVFILTER
int frame_available;
#endif
+ float quality;
AVPacket avpkt;
int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
@@ -1609,7 +1604,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = avcodec_decode_video2(ist->st->codec,
&picture, &got_output, &avpkt);
- ist->st->quality= picture.quality;
+ quality = same_quality ? picture.quality : 0;
if (ret < 0)
goto fail_decode;
if (!got_output) {
@@ -1722,7 +1717,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
os = output_files[ost->file_index];
/* set the input output pts pairs */
- //ost->sync_ipts = (double)(ist->pts + input_files_ts_offset[ist->file_index] - start_time)/ AV_TIME_BASE;
+ //ost->sync_ipts = (double)(ist->pts + input_files[ist->file_index].ts_offset - start_time)/ AV_TIME_BASE;
if (ost->encoding_needed) {
av_assert0(ist->decoding_needed);
@@ -1735,7 +1730,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
if (ost->picref->video && !ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
#endif
- do_video_out(os, ost, ist, &picture, &frame_size);
+ do_video_out(os, ost, ist, &picture, &frame_size,
+ same_quality ? quality : ost->st->codec->global_quality);
if (vstats_filename && frame_size)
do_video_stats(os, ost, frame_size);
break;
@@ -1859,7 +1855,7 @@ static int output_packet(AVInputStream *ist, int ist_index,
ret = 0;
/* encode any samples remaining in fifo */
if (fifo_bytes > 0) {
- int osize = av_get_bits_per_sample_fmt(enc->sample_fmt) >> 3;
+ int osize = av_get_bytes_per_sample(enc->sample_fmt);
int fs_tmp = enc->frame_size;
av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL);
@@ -1939,7 +1935,7 @@ static int copy_chapters(int infile, int outfile)
for (i = 0; i < is->nb_chapters; i++) {
AVChapter *in_ch = is->chapters[i], *out_ch;
- int64_t ts_off = av_rescale_q(start_time - input_files_ts_offset[infile],
+ int64_t ts_off = av_rescale_q(start_time - input_files[infile].ts_offset,
AV_TIME_BASE_Q, in_ch->time_base);
int64_t rt = (recording_time == INT64_MAX) ? INT64_MAX :
av_rescale_q(recording_time, AV_TIME_BASE_Q, in_ch->time_base);
@@ -1971,7 +1967,7 @@ static int copy_chapters(int infile, int outfile)
return 0;
}
-static void parse_forced_key_frames(char *kf, AVOutputStream *ost,
+static void parse_forced_key_frames(char *kf, OutputStream *ost,
AVCodecContext *avctx)
{
char *p;
@@ -1999,16 +1995,16 @@ static void parse_forced_key_frames(char *kf, AVOutputStream *ost,
*/
static int transcode(AVFormatContext **output_files,
int nb_output_files,
- AVInputFile *input_files,
+ InputFile *input_files,
int nb_input_files,
- AVStreamMap *stream_maps, int nb_stream_maps)
+ StreamMap *stream_maps, int nb_stream_maps)
{
int ret = 0, i, j, k, n, nb_ostreams = 0, step;
AVFormatContext *is, *os;
AVCodecContext *codec, *icodec;
- AVOutputStream *ost, **ost_table = NULL;
- AVInputStream *ist;
+ OutputStream *ost, **ost_table = NULL;
+ InputStream *ist;
char error[1024];
int key;
int want_sdp = 1;
@@ -2060,7 +2056,7 @@ static int transcode(AVFormatContext **output_files,
}
}
- ost_table = av_mallocz(sizeof(AVOutputStream *) * nb_ostreams);
+ ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams);
if (!ost_table)
goto fail;
@@ -2427,7 +2423,7 @@ static int transcode(AVFormatContext **output_files,
for (i = 0; i < nb_input_streams; i++) {
ist = &input_streams[i];
if (ist->decoding_needed) {
- AVCodec *codec = i < nb_input_codecs ? input_codecs[i] : NULL;
+ AVCodec *codec = ist->dec;
if (!codec)
codec = avcodec_find_decoder(ist->st->codec->codec_id);
if (!codec) {
@@ -2482,7 +2478,7 @@ static int transcode(AVFormatContext **output_files,
files[1] = input_files[in_file_index].ctx;
for (j = 0; j < 2; j++) {
- AVMetaDataMap *map = &meta_data_maps[i][j];
+ MetadataMap *map = &meta_data_maps[i][j];
switch (map->type) {
case 'g':
@@ -2738,9 +2734,9 @@ static int transcode(AVFormatContext **output_files,
goto discard_packet;
if (pkt.dts != AV_NOPTS_VALUE)
- pkt.dts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
+ pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.pts != AV_NOPTS_VALUE)
- pkt.pts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
+ pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base);
if (pkt.stream_index < nb_input_files_ts_scale[file_index]
&& input_files_ts_scale[file_index][pkt.stream_index]){
@@ -2750,15 +2746,16 @@ static int transcode(AVFormatContext **output_files,
pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index];
}
-// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
+// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files[ist->file_index].ts_offset, ist->st->codec->codec_type);
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
&& (is->iformat->flags & AVFMT_TS_DISCONT)) {
int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
int64_t delta= pkt_dts - ist->next_pts;
if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){
- input_files_ts_offset[ist->file_index]-= delta;
+ input_files[ist->file_index].ts_offset -= delta;
if (verbose > 2)
- fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files_ts_offset[ist->file_index]);
+ fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n",
+ delta, input_files[ist->file_index].ts_offset);
pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
if(pkt.pts != AV_NOPTS_VALUE)
pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base);
@@ -3096,7 +3093,7 @@ static int opt_codec_tag(const char *opt, const char *arg)
static int opt_map(const char *opt, const char *arg)
{
- AVStreamMap *m;
+ StreamMap *m;
char *p;
stream_maps = grow_array(stream_maps, sizeof(*stream_maps), &nb_stream_maps, nb_stream_maps + 1);
@@ -3143,7 +3140,7 @@ static void parse_meta_type(char *arg, char *type, int *index, char **endptr)
static int opt_map_metadata(const char *opt, const char *arg)
{
- AVMetaDataMap *m, *m1;
+ MetadataMap *m, *m1;
char *p;
meta_data_maps = grow_array(meta_data_maps, sizeof(*meta_data_maps),
@@ -3178,7 +3175,7 @@ static int opt_map_meta_data(const char *opt, const char *arg)
static int opt_map_chapters(const char *opt, const char *arg)
{
- AVChapterMap *c;
+ ChapterMap *c;
char *p;
chapter_maps = grow_array(chapter_maps, sizeof(*chapter_maps), &nb_chapter_maps,
@@ -3360,7 +3357,10 @@ static int opt_input_file(const char *opt, const char *filename)
opt_programid=0;
}
- ic->loop_input = loop_input;
+ if (loop_input) {
+ av_log(NULL, AV_LOG_WARNING, "-loop_input is deprecated, use -loop 1\n");
+ ic->loop_input = loop_input;
+ }
/* If not enough info to get the stream parameters, we decode the
first frames to get it. (used in mpeg case for example) */
@@ -3391,10 +3391,9 @@ static int opt_input_file(const char *opt, const char *filename)
for(i=0;i<ic->nb_streams;i++) {
AVStream *st = ic->streams[i];
AVCodecContext *dec = st->codec;
- AVInputStream *ist;
+ InputStream *ist;
dec->thread_count = thread_count;
- input_codecs = grow_array(input_codecs, sizeof(*input_codecs), &nb_input_codecs, nb_input_codecs + 1);
input_streams = grow_array(input_streams, sizeof(*input_streams), &nb_input_streams, nb_input_streams + 1);
ist = &input_streams[nb_input_streams - 1];
@@ -3404,20 +3403,20 @@ static int opt_input_file(const char *opt, const char *filename)
switch (dec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(audio_codec_name);
- if(!input_codecs[nb_input_codecs-1])
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder(dec->codec_id);
- set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]);
+ ist->dec = avcodec_find_decoder_by_name(audio_codec_name);
+ if(!ist->dec)
+ ist->dec = avcodec_find_decoder(dec->codec_id);
+ set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM, ist->dec);
channel_layout = dec->channel_layout;
audio_sample_fmt = dec->sample_fmt;
if(audio_disable)
st->discard= AVDISCARD_ALL;
break;
case AVMEDIA_TYPE_VIDEO:
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(video_codec_name);
- if(!input_codecs[nb_input_codecs-1])
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder(dec->codec_id);
- set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]);
+ ist->dec= avcodec_find_decoder_by_name(video_codec_name);
+ if(!ist->dec)
+ ist->dec = avcodec_find_decoder(dec->codec_id);
+ set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, ist->dec);
rfps = ic->streams[i]->r_frame_rate.num;
rfps_base = ic->streams[i]->r_frame_rate.den;
if (dec->lowres) {
@@ -3445,9 +3444,9 @@ static int opt_input_file(const char *opt, const char *filename)
case AVMEDIA_TYPE_DATA:
break;
case AVMEDIA_TYPE_SUBTITLE:
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder_by_name(subtitle_codec_name);
- if(!input_codecs[nb_input_codecs-1])
- input_codecs[nb_input_codecs-1] = avcodec_find_decoder(dec->codec_id);
+ ist->dec = avcodec_find_decoder_by_name(subtitle_codec_name);
+ if(!ist->dec)
+ ist->dec = avcodec_find_decoder(dec->codec_id);
if(subtitle_disable)
st->discard = AVDISCARD_ALL;
break;
@@ -3459,7 +3458,6 @@ static int opt_input_file(const char *opt, const char *filename)
}
}
- input_files_ts_offset[nb_input_files] = input_ts_offset - (copy_ts ? 0 : timestamp);
/* dump the file content */
if (verbose >= 0)
av_dump_format(ic, nb_input_files, filename, 0);
@@ -3467,6 +3465,7 @@ static int opt_input_file(const char *opt, const char *filename)
input_files = grow_array(input_files, sizeof(*input_files), &nb_input_files, nb_input_files + 1);
input_files[nb_input_files - 1].ctx = ic;
input_files[nb_input_files - 1].ist_index = nb_input_streams - ic->nb_streams;
+ input_files[nb_input_files - 1].ts_offset = input_ts_offset - (copy_ts ? 0 : timestamp);
top_field_first = -1;
video_channel = 0;
@@ -3531,7 +3530,7 @@ static void check_inputs(int *has_video_ptr,
static void new_video_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
- AVOutputStream *ost;
+ OutputStream *ost;
AVCodecContext *video_enc;
enum CodecID codec_id = CODEC_ID_NONE;
AVCodec *codec= NULL;
@@ -3601,8 +3600,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
- video_enc->global_quality=
- st->quality = FF_QP2LAMBDA * video_qscale;
+ video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
@@ -3671,7 +3669,7 @@ static void new_video_stream(AVFormatContext *oc, int file_idx)
static void new_audio_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
- AVOutputStream *ost;
+ OutputStream *ost;
AVCodec *codec= NULL;
AVCodecContext *audio_enc;
enum CodecID codec_id = CODEC_ID_NONE;
@@ -3720,7 +3718,7 @@ static void new_audio_stream(AVFormatContext *oc, int file_idx)
if (audio_qscale > QSCALE_NONE) {
audio_enc->flags |= CODEC_FLAG_QSCALE;
- audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale;
+ audio_enc->global_quality = FF_QP2LAMBDA * audio_qscale;
}
if (audio_channels)
audio_enc->channels = audio_channels;
@@ -3781,7 +3779,7 @@ static void new_data_stream(AVFormatContext *oc, int file_idx)
static void new_subtitle_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
- AVOutputStream *ost;
+ OutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *subtitle_enc;
enum CodecID codec_id = CODEC_ID_NONE;
@@ -3914,23 +3912,20 @@ static int opt_output_file(const char *opt, const char *filename)
use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
use_data = data_stream_copy || data_codec_name; /* XXX once generic data codec will be available add a ->data_codec reference and use it here */
- /* disable if no corresponding type found and at least one
- input file */
- if (nb_input_files > 0) {
- check_inputs(&input_has_video,
- &input_has_audio,
- &input_has_subtitle,
- &input_has_data);
-
- if (!input_has_video)
- use_video = 0;
- if (!input_has_audio)
- use_audio = 0;
- if (!input_has_subtitle)
- use_subtitle = 0;
- if (!input_has_data)
- use_data = 0;
- }
+ /* disable if no corresponding type found */
+ check_inputs(&input_has_video,
+ &input_has_audio,
+ &input_has_subtitle,
+ &input_has_data);
+
+ if (!input_has_video)
+ use_video = 0;
+ if (!input_has_audio)
+ use_audio = 0;
+ if (!input_has_subtitle)
+ use_subtitle = 0;
+ if (!input_has_data)
+ use_data = 0;
/* manual disable */
if (audio_disable) use_audio = 0;
@@ -3997,9 +3992,13 @@ static int opt_output_file(const char *opt, const char *filename)
oc->preload= (int)(mux_preload*AV_TIME_BASE);
oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
- oc->loop_output = loop_output;
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL);
+ if (loop_output >= 0) {
+ av_log(NULL, AV_LOG_WARNING, "-loop_output is deprecated, use -loop\n");
+ oc->loop_output = loop_output;
+ }
+ oc->flags |= AVFMT_FLAG_NONBLOCK;
frame_rate = (AVRational){0, 0};
frame_width = 0;
@@ -4415,8 +4414,8 @@ static const OptionDef options[] = {
{ "hex", OPT_BOOL | OPT_EXPERT, {(void*)&do_hex_dump},
"when dumping packets, also dump the payload" },
{ "re", OPT_BOOL | OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate", "" },
- { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "loop (current only works with images)" },
- { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "number of times to loop output in formats that support looping (0 loops forever)", "" },
+ { "loop_input", OPT_BOOL | OPT_EXPERT, {(void*)&loop_input}, "deprecated, use -loop" },
+ { "loop_output", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&loop_output}, "deprecated, use -loop", "" },
{ "v", HAS_ARG, {(void*)opt_verbose}, "set ffmpeg verbosity level", "number" },
{ "target", HAS_ARG, {(void*)opt_target}, "specify target file type (\"vcd\", \"svcd\", \"dvd\", \"dv\", \"dv50\", \"pal-vcd\", \"ntsc-svcd\", ...)", "type" },
{ "threads", HAS_ARG | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
diff --git a/ffplay.c b/ffplay.c
index 599b288..40e0cc1 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -25,6 +25,7 @@
#include <limits.h>
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
+#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/dict.h"
@@ -3026,6 +3027,7 @@ int main(int argc, char **argv)
#endif
if (SDL_Init (flags)) {
fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError());
+ fprintf(stderr, "(Did you set the DISPLAY variable?)\n");
exit(1);
}
diff --git a/ffprobe.c b/ffprobe.c
index fdcdf70..61ddc3d 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -143,6 +143,7 @@ static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt)
printf("pos=%"PRId64"\n" , pkt->pos);
printf("flags=%c\n" , pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
printf("[/PACKET]\n");
+ fflush(stdout);
}
static void show_packets(AVFormatContext *fmt_ctx)
@@ -231,6 +232,7 @@ static void show_stream(AVFormatContext *fmt_ctx, int stream_idx)
printf("TAG:%s=%s\n", tag->key, tag->value);
printf("[/STREAM]\n");
+ fflush(stdout);
}
static void show_format(AVFormatContext *fmt_ctx)
@@ -257,6 +259,7 @@ static void show_format(AVFormatContext *fmt_ctx)
printf("TAG:%s=%s\n", tag->key, tag->value);
printf("[/FORMAT]\n");
+ fflush(stdout);
}
static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
@@ -364,12 +367,13 @@ static int opt_help(const char *opt, const char *arg)
return 0;
}
-static void opt_pretty(void)
+static int opt_pretty(const char *opt, const char *arg)
{
show_value_unit = 1;
use_value_prefix = 1;
use_byte_value_binary_prefix = 1;
use_value_sexagesimal_format = 1;
+ return 0;
}
static const OptionDef options[] = {
diff --git a/ffserver.c b/ffserver.c
index 83dd986..d589f6d 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -37,6 +37,7 @@
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/parseutils.h"
#include "libavutil/opt.h"
@@ -2127,13 +2128,12 @@ static int open_input_stream(HTTPContext *c, const char *info)
char buf[128];
char input_filename[1024];
AVFormatContext *s = NULL;
- int buf_size, i, ret;
+ int i, ret;
int64_t stream_pos;
/* find file name */
if (c->stream->feed) {
strcpy(input_filename, c->stream->feed->feed_filename);
- buf_size = FFM_PACKET_SIZE;
/* compute position (absolute time) */
if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0)
@@ -2145,7 +2145,6 @@ static int open_input_stream(HTTPContext *c, const char *info)
stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000;
} else {
strcpy(input_filename, c->stream->feed_filename);
- buf_size = 0;
/* compute position (relative time) */
if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0)
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 5dcdeea..d55baf2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -550,6 +550,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \
mpegaudiodata.o vorbis_data.o
+OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGTS_MUXER) += mpegvideo.o mpeg4audio.o
diff --git a/libavcodec/aac.h b/libavcodec/aac.h
index f089ee9..477acb5 100644
--- a/libavcodec/aac.h
+++ b/libavcodec/aac.h
@@ -258,7 +258,7 @@ typedef struct {
DynamicRangeControl che_drc;
/**
- * @defgroup elements Channel element related data.
+ * @name Channel element related data
* @{
*/
enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
@@ -270,14 +270,15 @@ typedef struct {
/** @} */
/**
- * @defgroup temporary aligned temporary buffers (We do not want to have these on the stack.)
+ * @name temporary aligned temporary buffers
+ * (We do not want to have these on the stack.)
* @{
*/
DECLARE_ALIGNED(32, float, buf_mdct)[1024];
/** @} */
/**
- * @defgroup tables Computed / set up during initialization.
+ * @name Computed / set up during initialization
* @{
*/
FFTContext mdct;
@@ -289,7 +290,7 @@ typedef struct {
/** @} */
/**
- * @defgroup output Members used for output interleaving.
+ * @name Members used for output interleaving
* @{
*/
float *output_data[MAX_CHANNELS]; ///< Points to each element's 'ret' buffer (PCM output).
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index cb87608..8a936da 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -532,6 +532,22 @@ static void reset_all_predictors(PredictorState *ps)
reset_predict_state(&ps[i]);
}
+static int sample_rate_idx (int rate)
+{
+ if (92017 <= rate) return 0;
+ else if (75132 <= rate) return 1;
+ else if (55426 <= rate) return 2;
+ else if (46009 <= rate) return 3;
+ else if (37566 <= rate) return 4;
+ else if (27713 <= rate) return 5;
+ else if (23004 <= rate) return 6;
+ else if (18783 <= rate) return 7;
+ else if (13856 <= rate) return 8;
+ else if (11502 <= rate) return 9;
+ else if (9391 <= rate) return 10;
+ else return 11;
+}
+
static void reset_predictor_group(PredictorState *ps, int group_num)
{
int i;
@@ -554,10 +570,33 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
ac->m4ac.sample_rate = avctx->sample_rate;
if (avctx->extradata_size > 0) {
+ avctx->channels = 0;
+ avctx->frame_size = 0;
+ avctx->sample_rate = 0;
if (decode_audio_specific_config(ac, ac->avctx, &ac->m4ac,
avctx->extradata,
avctx->extradata_size) < 0)
return -1;
+ } else {
+ int sr, i;
+ enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
+
+ sr = sample_rate_idx(avctx->sample_rate);
+ ac->m4ac.sampling_index = sr;
+ ac->m4ac.channels = avctx->channels;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++)
+ if (ff_mpeg4audio_channels[i] == avctx->channels)
+ break;
+ if (i == FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) {
+ i = 0;
+ }
+ ac->m4ac.chan_config = i;
+
+ if (ac->m4ac.chan_config) {
+ set_default_channel_config(avctx, new_che_pos, ac->m4ac.chan_config);
+ output_configure(ac, ac->che_pos, new_che_pos, ac->m4ac.chan_config, OC_GLOBAL_HDR);
+ }
}
if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
@@ -2049,6 +2088,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
if (output_configure(ac, ac->che_pos, new_che_pos, hdr_info.chan_config, OC_TRIAL_FRAME))
return -7;
} else if (ac->output_configured != OC_LOCKED) {
+ ac->m4ac.chan_config = 0;
ac->output_configured = OC_NONE;
}
if (ac->output_configured != OC_LOCKED) {
@@ -2516,6 +2556,7 @@ AVCodec ff_aac_decoder = {
.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
},
+ .capabilities = CODEC_CAP_CHANNEL_CONF,
.channel_layouts = aac_channel_layout,
};
@@ -2536,5 +2577,6 @@ AVCodec ff_aac_latm_decoder = {
.sample_fmts = (const enum AVSampleFormat[]) {
AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
},
+ .capabilities = CODEC_CAP_CHANNEL_CONF,
.channel_layouts = aac_channel_layout,
};
diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h
index 1e27ddc..150c651 100644
--- a/libavcodec/aacenc.h
+++ b/libavcodec/aacenc.h
@@ -61,7 +61,7 @@ typedef struct AACEncContext {
int16_t *samples; ///< saved preprocessed input
int samplerate_index; ///< MPEG-4 samplerate index
- uint8_t *chan_map; ///< channel configuration map
+ const uint8_t *chan_map; ///< channel configuration map
ChannelElement *cpe; ///< channel elements
FFPsyContext psy;
diff --git a/libavcodec/aacps.c b/libavcodec/aacps.c
index fc124d1..f2caedb 100644
--- a/libavcodec/aacps.c
+++ b/libavcodec/aacps.c
@@ -77,7 +77,7 @@ static VLC vlc_ps[10];
* @param avctx contains the current codec context
* @param gb pointer to the input bitstream
* @param ps pointer to the Parametric Stereo context
- * @param par pointer to the parameter to be read
+ * @param PAR pointer to the parameter to be read
* @param e envelope to decode
* @param dt 1: time delta-coded, 0: frequency delta-coded
*/
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h
index a53817e..8e8482f 100644
--- a/libavcodec/ac3.h
+++ b/libavcodec/ac3.h
@@ -94,7 +94,7 @@ typedef struct AC3BitAllocParameters {
* Coded AC-3 header values up to the lfeon element, plus derived values.
*/
typedef struct {
- /** @defgroup coded Coded elements
+ /** @name Coded elements
* @{
*/
uint16_t sync_word;
@@ -112,7 +112,7 @@ typedef struct {
int num_blocks; ///< number of audio blocks
/** @} */
- /** @defgroup derived Derived values
+ /** @name Derived values
* @{
*/
uint8_t sr_shift;
diff --git a/libavcodec/ac3dec.h b/libavcodec/ac3dec.h
index 377e515..4b3e7e3 100644
--- a/libavcodec/ac3dec.h
+++ b/libavcodec/ac3dec.h
@@ -69,7 +69,7 @@ typedef struct {
AVCodecContext *avctx; ///< parent context
GetBitContext gbc; ///< bitstream reader
-///@defgroup bsi bit stream information
+///@name Bit stream information
///@{
int frame_type; ///< frame type (strmtyp)
int substreamid; ///< substream identification
@@ -87,7 +87,7 @@ typedef struct {
int eac3; ///< indicates if current frame is E-AC-3
///@}
-///@defgroup audfrm frame syntax parameters
+///@name Frame syntax parameters
int snr_offset_strategy; ///< SNR offset strategy (snroffststr)
int block_switch_syntax; ///< block switch syntax enabled (blkswe)
int dither_flag_syntax; ///< dither flag syntax enabled (dithflage)
@@ -97,7 +97,7 @@ typedef struct {
int skip_syntax; ///< skip field syntax enabled (skipflde)
///@}
-///@defgroup cpl standard coupling
+///@name Standard coupling
int cpl_in_use[AC3_MAX_BLOCKS]; ///< coupling in use (cplinu)
int cpl_strategy_exists[AC3_MAX_BLOCKS];///< coupling strategy exists (cplstre)
int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl)
@@ -110,7 +110,7 @@ typedef struct {
int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; ///< coupling coordinates (cplco)
///@}
-///@defgroup spx spectral extension
+///@name Spectral extension
///@{
int spx_in_use; ///< spectral extension in use (spxinu)
uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension (chinspx)
@@ -126,12 +126,12 @@ typedef struct {
float spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS];///< spx signal blending factor (sblendfact)
///@}
-///@defgroup aht adaptive hybrid transform
+///@name Adaptive hybrid transform
int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu)
int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][AC3_MAX_BLOCKS]; ///< pre-IDCT mantissas
///@}
-///@defgroup channel channel
+///@name Channel
int fbw_channels; ///< number of full-bandwidth channels
int channels; ///< number of total channels
int lfe_ch; ///< index of LFE channel
@@ -141,27 +141,27 @@ typedef struct {
int out_channels; ///< number of output channels
///@}
-///@defgroup dynrng dynamic range
+///@name Dynamic range
float dynamic_range[2]; ///< dynamic range
///@}
-///@defgroup bandwidth bandwidth
+///@name Bandwidth
int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant)
int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant)
///@}
-///@defgroup rematrixing rematrixing
+///@name Rematrixing
int num_rematrixing_bands; ///< number of rematrixing bands (nrematbnd)
int rematrixing_flags[4]; ///< rematrixing flags (rematflg)
///@}
-///@defgroup exponents exponents
+///@name Exponents
int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups (nexpgrp)
int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents
int exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies (expstr)
///@}
-///@defgroup bitalloc bit allocation
+///@name Bit allocation
AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters
int first_cpl_leak; ///< first coupling leak state (firstcplleak)
int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets (snroffst)
@@ -177,25 +177,25 @@ typedef struct {
uint8_t dba_values[AC3_MAX_CHANNELS][8]; ///< delta values for each segment
///@}
-///@defgroup dithering zero-mantissa dithering
+///@name Zero-mantissa dithering
int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags (dithflg)
AVLFG dith_state; ///< for dither generation
///@}
-///@defgroup imdct IMDCT
+///@name IMDCT
int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags (blksw)
FFTContext imdct_512; ///< for 512 sample IMDCT
FFTContext imdct_256; ///< for 256 sample IMDCT
///@}
-///@defgroup opt optimization
+///@name Optimization
DSPContext dsp; ///< for optimization
AC3DSPContext ac3dsp;
FmtConvertContext fmt_conv; ///< optimized conversion functions
float mul_bias; ///< scaling for float_to_int16 conversion
///@}
-///@defgroup arrays aligned arrays
+///@name Aligned arrays
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
diff --git a/libavcodec/ac3dsp.c b/libavcodec/ac3dsp.c
index 619addc..96bd123 100644
--- a/libavcodec/ac3dsp.c
+++ b/libavcodec/ac3dsp.c
@@ -164,21 +164,8 @@ static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs)
int i;
for (i = 0; i < nb_coefs; i++) {
- int e;
int v = abs(coef[i]);
- if (v == 0)
- e = 24;
- else {
- e = 23 - av_log2(v);
- if (e >= 24) {
- e = 24;
- coef[i] = 0;
- } else if (e < 0) {
- e = 0;
- coef[i] = av_clip(coef[i], -16777215, 16777215);
- }
- }
- exp[i] = e;
+ exp[i] = v ? 23 - av_log2(v) : 24;
}
}
diff --git a/libavcodec/ac3enc.h b/libavcodec/ac3enc.h
index 5f5d2c2..be2767a 100644
--- a/libavcodec/ac3enc.h
+++ b/libavcodec/ac3enc.h
@@ -50,12 +50,16 @@
#if CONFIG_AC3ENC_FLOAT
#define AC3_NAME(x) ff_ac3_float_ ## x
#define MAC_COEF(d,a,b) ((d)+=(a)*(b))
+#define COEF_MIN (-16777215.0/16777216.0)
+#define COEF_MAX ( 16777215.0/16777216.0)
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)
+#define COEF_MIN -16777215
+#define COEF_MAX 16777215
typedef int16_t SampleType;
typedef int32_t CoefType;
typedef int64_t CoefSumType;
diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index b189609..cbe92e1 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -104,6 +104,15 @@ static void scale_coefficients(AC3EncodeContext *s)
}
+/**
+ * Clip MDCT coefficients to allowable range.
+ */
+static void clip_coefficients(DSPContext *dsp, int32_t *coef, unsigned int len)
+{
+ dsp->vector_clip_int32(coef, coef, COEF_MIN, COEF_MAX, len);
+}
+
+
static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
{
AC3EncodeContext *s = avctx->priv_data;
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 7d01b18..e21b99d 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -111,6 +111,15 @@ static void scale_coefficients(AC3EncodeContext *s)
}
+/**
+ * Clip MDCT coefficients to allowable range.
+ */
+static void clip_coefficients(DSPContext *dsp, float *coef, unsigned int len)
+{
+ dsp->vector_clipf(coef, coef, COEF_MIN, COEF_MAX, len);
+}
+
+
#if CONFIG_AC3_ENCODER
AVCodec ff_ac3_float_encoder = {
"ac3_float",
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 85eea54..c7243c7 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -41,6 +41,8 @@ static void apply_window(DSPContext *dsp, SampleType *output,
static int normalize_samples(AC3EncodeContext *s);
+static void clip_coefficients(DSPContext *dsp, CoefType *coef, unsigned int len);
+
int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
{
@@ -171,8 +173,8 @@ static void apply_channel_coupling(AC3EncodeContext *s)
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);
+ /* coefficients must be clipped in order to be encoded */
+ clip_coefficients(&s->dsp, cpl_coef, 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],
@@ -300,6 +302,7 @@ static void apply_channel_coupling(AC3EncodeContext *s)
if (!block->cpl_in_use || !block->new_cpl_coords)
continue;
+ clip_coefficients(&s->dsp, cpl_coords[blk][1], s->fbw_channels * 16);
s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1],
cpl_coords[blk][1],
s->fbw_channels * 16);
@@ -433,7 +436,11 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
apply_mdct(s);
- scale_coefficients(s);
+ if (s->fixed_point)
+ scale_coefficients(s);
+
+ clip_coefficients(&s->dsp, s->blocks[0].mdct_coef[1],
+ AC3_MAX_COEFS * AC3_MAX_BLOCKS * s->channels);
s->cpl_on = s->cpl_enabled;
ff_ac3_compute_coupling_strategy(s);
@@ -443,6 +450,9 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
compute_rematrixing_strategy(s);
+ if (!s->fixed_point)
+ scale_coefficients(s);
+
ff_ac3_apply_rematrixing(s);
ff_ac3_process_exponents(s);
diff --git a/libavcodec/acelp_pitch_delay.c b/libavcodec/acelp_pitch_delay.c
index cddf726..66d65a6 100644
--- a/libavcodec/acelp_pitch_delay.c
+++ b/libavcodec/acelp_pitch_delay.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "dsputil.h"
#include "acelp_pitch_delay.h"
diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c
index e0b6332..b8d826e 100644
--- a/libavcodec/amrnbdec.c
+++ b/libavcodec/amrnbdec.c
@@ -204,7 +204,7 @@ static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf,
}
-/// @defgroup amr_lpc_decoding AMR pitch LPC coefficient decoding functions
+/// @name AMR pitch LPC coefficient decoding functions
/// @{
/**
@@ -341,7 +341,7 @@ static void lsf2lsp_3(AMRContext *p)
/// @}
-/// @defgroup amr_pitch_vector_decoding AMR pitch vector decoding functions
+/// @name AMR pitch vector decoding functions
/// @{
/**
@@ -403,7 +403,7 @@ static void decode_pitch_vector(AMRContext *p,
/// @}
-/// @defgroup amr_algebraic_code_book AMR algebraic code book (fixed) vector decoding functions
+/// @name AMR algebraic code book (fixed) vector decoding functions
/// @{
/**
@@ -547,7 +547,7 @@ static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode,
/// @}
-/// @defgroup amr_gain_decoding AMR gain decoding functions
+/// @name AMR gain decoding functions
/// @{
/**
@@ -633,7 +633,7 @@ static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe,
/// @}
-/// @defgroup amr_pre_processing AMR pre-processing functions
+/// @name AMR preprocessing functions
/// @{
/**
@@ -751,7 +751,7 @@ static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse,
/// @}
-/// @defgroup amr_synthesis AMR synthesis functions
+/// @name AMR synthesis functions
/// @{
/**
@@ -812,7 +812,7 @@ static int synthesis(AMRContext *p, float *lpc,
/// @}
-/// @defgroup amr_update AMR update functions
+/// @name AMR update functions
/// @{
/**
@@ -837,7 +837,7 @@ static void update_state(AMRContext *p)
/// @}
-/// @defgroup amr_postproc AMR Post processing functions
+/// @name AMR Postprocessing functions
/// @{
/**
diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c
index 7043b7c..ebcc288 100644
--- a/libavcodec/ansi.c
+++ b/libavcodec/ansi.c
@@ -154,7 +154,7 @@ static void draw_char(AVCodecContext *avctx, int c)
/**
* Execute ANSI escape code
- * @param <0 error
+ * @return 0 on success, negative on error
*/
static int execute_code(AVCodecContext * avctx, int c)
{
diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 0549877..f036c4a 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -217,7 +217,7 @@ static av_cold int ape_decode_close(AVCodecContext * avctx)
}
/**
- * @defgroup rangecoder APE range decoder
+ * @name APE range decoding functions
* @{
*/
diff --git a/libavcodec/arm/ac3dsp_neon.S b/libavcodec/arm/ac3dsp_neon.S
index fdf1dea..e97197c 100644
--- a/libavcodec/arm/ac3dsp_neon.S
+++ b/libavcodec/arm/ac3dsp_neon.S
@@ -95,19 +95,14 @@ function ff_float_to_fixed24_neon, export=1
endfunc
function ff_ac3_extract_exponents_neon, export=1
- vmov.i32 q14, #24
vmov.i32 q15, #8
1:
- vld1.32 {q0}, [r1,:128]
+ vld1.32 {q0}, [r1,:128]!
vabs.s32 q1, q0
vclz.i32 q3, q1
vsub.i32 q3, q3, q15
- vcge.s32 q2, q3, q14
- vbit q3, q14, q2
- vbic q0, q0, q2
vmovn.i32 d6, q3
vmovn.i16 d6, q3
- vst1.32 {q0}, [r1,:128]!
vst1.32 {d6[0]}, [r0,:32]!
subs r2, r2, #4
bgt 1b
diff --git a/libavcodec/arm/dsputil_init_neon.c b/libavcodec/arm/dsputil_init_neon.c
index 6faf3dc..c818b33 100644
--- a/libavcodec/arm/dsputil_init_neon.c
+++ b/libavcodec/arm/dsputil_init_neon.c
@@ -160,6 +160,8 @@ void ff_vector_fmul_add_neon(float *dst, const float *src0, const float *src1,
void ff_vector_clipf_neon(float *dst, const float *src, float min, float max,
int len);
+void ff_vector_clip_int32_neon(int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
void ff_vorbis_inverse_coupling_neon(float *mag, float *ang, int blocksize);
@@ -316,6 +318,7 @@ void ff_dsputil_init_neon(DSPContext *c, AVCodecContext *avctx)
c->vector_fmul_reverse = ff_vector_fmul_reverse_neon;
c->vector_fmul_add = ff_vector_fmul_add_neon;
c->vector_clipf = ff_vector_clipf_neon;
+ c->vector_clip_int32 = ff_vector_clip_int32_neon;
c->vector_fmul_sv_scalar[0] = ff_vector_fmul_sv_scalar_2_neon;
c->vector_fmul_sv_scalar[1] = ff_vector_fmul_sv_scalar_4_neon;
diff --git a/libavcodec/arm/dsputil_neon.S b/libavcodec/arm/dsputil_neon.S
index 2147658..250a32a 100644
--- a/libavcodec/arm/dsputil_neon.S
+++ b/libavcodec/arm/dsputil_neon.S
@@ -815,3 +815,19 @@ function ff_apply_window_int16_neon, export=1
pop {r4,pc}
endfunc
+
+function ff_vector_clip_int32_neon, export=1
+ vdup.32 q0, r2
+ vdup.32 q1, r3
+ ldr r2, [sp]
+1:
+ vld1.32 {q2-q3}, [r1,:128]!
+ vmin.s32 q2, q2, q1
+ vmin.s32 q3, q3, q1
+ vmax.s32 q2, q2, q0
+ vmax.s32 q3, q3, q0
+ vst1.32 {q2-q3}, [r0,:128]!
+ subs r2, r2, #8
+ bgt 1b
+ bx lr
+endfunc
diff --git a/libavcodec/arm/fft_fixed_neon.S b/libavcodec/arm/fft_fixed_neon.S
index bd6c853..0316b80 100644
--- a/libavcodec/arm/fft_fixed_neon.S
+++ b/libavcodec/arm/fft_fixed_neon.S
@@ -56,7 +56,7 @@
vhsub.s16 \r0, \d0, \d1 @ t3, t4, t8, t7
vhsub.s16 \r1, \d1, \d0
vhadd.s16 \d0, \d0, \d1 @ t1, t2, t6, t5
- vmov.i64 \d1, #0xffff<<32
+ vmov.i64 \d1, #0xffff00000000
vbit \r0, \r1, \d1
vrev64.16 \r1, \r0 @ t7, t8, t4, t3
vtrn.32 \r0, \r1 @ t3, t4, t7, t8
@@ -75,9 +75,9 @@
.endm
function fft4_neon
- vld1.16 {d0-d1}, [r0,:128]
+ vld1.16 {d0-d1}, [r0]
fft4 d0, d1, d2, d3
- vst1.16 {d0-d1}, [r0,:128]
+ vst1.16 {d0-d1}, [r0]
bx lr
endfunc
diff --git a/libavcodec/ass.h b/libavcodec/ass.h
index 74ef61b..efff44d 100644
--- a/libavcodec/ass.h
+++ b/libavcodec/ass.h
@@ -25,8 +25,7 @@
#include "avcodec.h"
/**
- * Default values for ASS style.
- * @defgroup ass_default
+ * @name Default values for ASS style
* @{
*/
#define ASS_DEFAULT_FONT "Arial"
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 2345b7e..7e9348a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -30,6 +30,9 @@
#include "libavutil/samplefmt.h"
#include "libavutil/avutil.h"
#include "libavutil/cpu.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
#include "libavcodec/version.h"
@@ -1410,7 +1413,7 @@ typedef struct AVCodecContext {
* A demuxer should set this to what is stored in the field used to identify the codec.
* If there are multiple such fields in a container then the demuxer should choose the one
* which maximizes the information about the used codec.
- * If the codec tag field in a container is larger then 32 bits then the demuxer should
+ * If the codec tag field in a container is larger than 32 bits then the demuxer should
* remap the longer ID to 32 bits with a table or other structure. Alternatively a new
* extra_codec_tag + size could be added but for this a clear advantage must be demonstrated
* first.
@@ -2535,7 +2538,7 @@ typedef struct AVCodecContext {
#if FF_API_FLAC_GLOBAL_OPTS
/**
- * @defgroup flac_opts FLAC options
+ * @name FLAC options
* @deprecated Use FLAC encoder private options instead.
* @{
*/
@@ -2957,7 +2960,7 @@ typedef struct AVCodec {
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
/**
- * @defgroup framethreading Frame-level threading support functions.
+ * @name Frame-level threading support functions
* @{
*/
/**
@@ -3915,7 +3918,7 @@ int av_get_bits_per_sample(enum CodecID codec_id);
#if FF_API_OLD_SAMPLE_FMT
/**
- * @deprecated Use av_get_bits_per_sample_fmt() instead.
+ * @deprecated Use av_get_bytes_per_sample() instead.
*/
attribute_deprecated
int av_get_bits_per_sample_format(enum AVSampleFormat sample_fmt);
diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c
index ff36458..d7dbd28 100644
--- a/libavcodec/binkaudio.c
+++ b/libavcodec/binkaudio.c
@@ -90,8 +90,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
return -1;
}
- if (avctx->extradata && avctx->extradata_size > 0)
- s->version_b = avctx->extradata[0];
+ s->version_b = avctx->extradata && avctx->extradata[3] == 'b';
if (avctx->codec->id == CODEC_ID_BINKAUDIO_RDFT) {
// audio is already interleaved for the RDFT format variant
diff --git a/libavcodec/high_bit_depth.h b/libavcodec/bit_depth_template.c
index 511cd00..c0a6eaf 100644
--- a/libavcodec/high_bit_depth.h
+++ b/libavcodec/bit_depth_template.c
@@ -1,3 +1,21 @@
+/*
+ * 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 "dsputil.h"
#ifndef BIT_DEPTH
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index f0fa965..b164ecd 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -43,11 +43,7 @@ const uint8_t ff_log2_run[41]={
void align_put_bits(PutBitContext *s)
{
-#ifdef ALT_BITSTREAM_WRITER
- put_bits(s,( - s->index) & 7,0);
-#else
put_bits(s,s->bit_left & 7,0);
-#endif
}
void ff_put_string(PutBitContext *pb, const char *string, int terminate_string)
diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index f0dee79..6def1ac 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -335,7 +335,7 @@ static av_cold int cook_decode_close(AVCodecContext *avctx)
* Fill the gain array for the timedomain quantization.
*
* @param gb pointer to the GetBitContext
- * @param gaininfo[9] array of gain indexes
+ * @param gaininfo array[9] of gain indexes
*/
static void decode_gain_info(GetBitContext *gb, int *gaininfo)
@@ -1156,7 +1156,6 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
default:
av_log_ask_for_sample(avctx, "Unknown Cook version.\n");
return -1;
- break;
}
if(s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) {
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 4b445bc..e11439f 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -1316,7 +1316,7 @@ static int dca_convert_bitstream(const uint8_t * src, int src_size, uint8_t * ds
PutBitContext pb;
if ((unsigned)src_size > (unsigned)max_size) {
-// av_log(NULL, AV_LOG_ERROR, "Input frame size larger then DCA_MAX_FRAME_SIZE!\n");
+// av_log(NULL, AV_LOG_ERROR, "Input frame size larger than DCA_MAX_FRAME_SIZE!\n");
// return -1;
src_size = max_size;
}
@@ -1650,6 +1650,7 @@ static int dca_decode_frame(AVCodecContext * avctx,
//set AVCodec values with parsed data
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
+ avctx->frame_size = s->sample_blocks * 32;
s->profile = FF_PROFILE_DTS;
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 2abb05b..4bc59d3 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -68,12 +68,12 @@ void ff_simple_idct_neon(DCTELEM *data);
void ff_simple_idct_axp(DCTELEM *data);
struct algo {
- const char *name;
- enum { FDCT, IDCT } is_idct;
- void (* func) (DCTELEM *block);
- void (* ref) (DCTELEM *block);
- enum formattag { NO_PERM,MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM, SSE2_PERM, PARTTRANS_PERM } format;
- int mm_support;
+ const char *name;
+ void (*func)(DCTELEM *block);
+ enum formattag { NO_PERM, MMX_PERM, MMX_SIMPLE_PERM, SCALE_PERM,
+ SSE2_PERM, PARTTRANS_PERM } format;
+ int mm_support;
+ int nonspec;
};
#ifndef FAAN_POSTSCALE
@@ -84,61 +84,69 @@ struct algo {
static int cpu_flags;
-struct algo algos[] = {
- {"REF-DBL", 0, ff_ref_fdct, ff_ref_fdct, NO_PERM},
- {"FAAN", 0, ff_faandct, ff_ref_fdct, FAAN_SCALE},
- {"FAANI", 1, ff_faanidct, ff_ref_idct, NO_PERM},
- {"IJG-AAN-INT", 0, fdct_ifast, ff_ref_fdct, SCALE_PERM},
- {"IJG-LLM-INT", 0, ff_jpeg_fdct_islow, ff_ref_fdct, NO_PERM},
- {"REF-DBL", 1, ff_ref_idct, ff_ref_idct, NO_PERM},
- {"INT", 1, j_rev_dct, ff_ref_idct, MMX_PERM},
- {"SIMPLE-C", 1, ff_simple_idct, ff_ref_idct, NO_PERM},
+static const struct algo fdct_tab[] = {
+ { "REF-DBL", ff_ref_fdct, NO_PERM },
+ { "FAAN", ff_faandct, FAAN_SCALE },
+ { "IJG-AAN-INT", fdct_ifast, SCALE_PERM },
+ { "IJG-LLM-INT", ff_jpeg_fdct_islow, NO_PERM },
#if HAVE_MMX
- {"MMX", 0, ff_fdct_mmx, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_MMX},
-#if HAVE_MMX2
- {"MMX2", 0, ff_fdct_mmx2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_MMX2},
- {"SSE2", 0, ff_fdct_sse2, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_SSE2},
+ { "MMX", ff_fdct_mmx, NO_PERM, AV_CPU_FLAG_MMX },
+ { "MMX2", ff_fdct_mmx2, NO_PERM, AV_CPU_FLAG_MMX2 },
+ { "SSE2", ff_fdct_sse2, NO_PERM, AV_CPU_FLAG_SSE2 },
#endif
-#if CONFIG_GPL
- {"LIBMPEG2-MMX", 1, ff_mmx_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_MMX},
- {"LIBMPEG2-MMX2", 1, ff_mmxext_idct, ff_ref_idct, MMX_PERM, AV_CPU_FLAG_MMX2},
+#if HAVE_ALTIVEC
+ { "altivecfdct", fdct_altivec, NO_PERM, AV_CPU_FLAG_ALTIVEC },
#endif
- {"SIMPLE-MMX", 1, ff_simple_idct_mmx, ff_ref_idct, MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX},
- {"XVID-MMX", 1, ff_idct_xvid_mmx, ff_ref_idct, NO_PERM, AV_CPU_FLAG_MMX},
- {"XVID-MMX2", 1, ff_idct_xvid_mmx2, ff_ref_idct, NO_PERM, AV_CPU_FLAG_MMX2},
- {"XVID-SSE2", 1, ff_idct_xvid_sse2, ff_ref_idct, SSE2_PERM, AV_CPU_FLAG_SSE2},
+
+#if ARCH_BFIN
+ { "BFINfdct", ff_bfin_fdct, NO_PERM },
#endif
-#if HAVE_ALTIVEC
- {"altivecfdct", 0, fdct_altivec, ff_ref_fdct, NO_PERM, AV_CPU_FLAG_ALTIVEC},
+ { 0 }
+};
+
+static const struct algo idct_tab[] = {
+ { "FAANI", ff_faanidct, NO_PERM },
+ { "REF-DBL", ff_ref_idct, NO_PERM },
+ { "INT", j_rev_dct, MMX_PERM },
+ { "SIMPLE-C", ff_simple_idct, NO_PERM },
+
+#if HAVE_MMX
+#if CONFIG_GPL
+ { "LIBMPEG2-MMX", ff_mmx_idct, MMX_PERM, AV_CPU_FLAG_MMX, 1 },
+ { "LIBMPEG2-MMX2", ff_mmxext_idct, MMX_PERM, AV_CPU_FLAG_MMX2, 1 },
+#endif
+ { "SIMPLE-MMX", ff_simple_idct_mmx, MMX_SIMPLE_PERM, AV_CPU_FLAG_MMX },
+ { "XVID-MMX", ff_idct_xvid_mmx, NO_PERM, AV_CPU_FLAG_MMX, 1 },
+ { "XVID-MMX2", ff_idct_xvid_mmx2, NO_PERM, AV_CPU_FLAG_MMX2, 1 },
+ { "XVID-SSE2", ff_idct_xvid_sse2, SSE2_PERM, AV_CPU_FLAG_SSE2, 1 },
#endif
#if ARCH_BFIN
- {"BFINfdct", 0, ff_bfin_fdct, ff_ref_fdct, NO_PERM},
- {"BFINidct", 1, ff_bfin_idct, ff_ref_idct, NO_PERM},
+ { "BFINidct", ff_bfin_idct, NO_PERM },
#endif
#if ARCH_ARM
- {"SIMPLE-ARM", 1, ff_simple_idct_arm, ff_ref_idct, NO_PERM },
- {"INT-ARM", 1, ff_j_rev_dct_arm, ff_ref_idct, MMX_PERM },
+ { "SIMPLE-ARM", ff_simple_idct_arm, NO_PERM },
+ { "INT-ARM", ff_j_rev_dct_arm, MMX_PERM },
+#endif
#if HAVE_ARMV5TE
- {"SIMPLE-ARMV5TE", 1, ff_simple_idct_armv5te, ff_ref_idct, NO_PERM },
+ { "SIMPLE-ARMV5TE", ff_simple_idct_armv5te,NO_PERM },
#endif
#if HAVE_ARMV6
- {"SIMPLE-ARMV6", 1, ff_simple_idct_armv6, ff_ref_idct, MMX_PERM },
+ { "SIMPLE-ARMV6", ff_simple_idct_armv6, MMX_PERM },
#endif
#if HAVE_NEON
- {"SIMPLE-NEON", 1, ff_simple_idct_neon, ff_ref_idct, PARTTRANS_PERM },
+ { "SIMPLE-NEON", ff_simple_idct_neon, PARTTRANS_PERM },
#endif
-#endif /* ARCH_ARM */
#if ARCH_ALPHA
- {"SIMPLE-ALPHA", 1, ff_simple_idct_axp, ff_ref_idct, NO_PERM },
+ { "SIMPLE-ALPHA", ff_simple_idct_axp, NO_PERM },
#endif
- { 0 }
+ { 0 }
};
#define AANSCALE_BITS 12
@@ -148,7 +156,7 @@ uint8_t cropTbl[256 + 2 * MAX_NEG_CROP];
static int64_t gettime(void)
{
struct timeval tv;
- gettimeofday(&tv,NULL);
+ gettimeofday(&tv, NULL);
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
}
@@ -157,18 +165,18 @@ static int64_t gettime(void)
static short idct_mmx_perm[64];
-static short idct_simple_mmx_perm[64]={
- 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
- 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
- 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
- 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
- 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
- 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
- 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
- 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
+static short idct_simple_mmx_perm[64] = {
+ 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D,
+ 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D,
+ 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D,
+ 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F,
+ 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F,
+ 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D,
+ 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F,
+ 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F,
};
-static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7};
+static const uint8_t idct_sse2_row_perm[8] = { 0, 4, 1, 5, 2, 6, 3, 7 };
static void idct_mmx_init(void)
{
@@ -177,13 +185,12 @@ static void idct_mmx_init(void)
/* the mmx/mmxext idct uses a reordered input, so we patch scan tables */
for (i = 0; i < 64; i++) {
idct_mmx_perm[i] = (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
-// idct_simple_mmx_perm[i] = simple_block_permute_op(i);
}
}
DECLARE_ALIGNED(16, static DCTELEM, block)[64];
-DECLARE_ALIGNED(8, static DCTELEM, block1)[64];
-DECLARE_ALIGNED(8, static DCTELEM, block_org)[64];
+DECLARE_ALIGNED(8, static DCTELEM, block1)[64];
+DECLARE_ALIGNED(8, static DCTELEM, block_org)[64];
static inline void mmx_emms(void)
{
@@ -193,188 +200,177 @@ static inline void mmx_emms(void)
#endif
}
-static void dct_error(const char *name, int is_idct,
- void (*fdct_func)(DCTELEM *block),
- void (*fdct_ref)(DCTELEM *block), int form, int test, const int bits)
+
+static int dct_error(const struct algo *dct, int test, int is_idct, int speed, const int bits)
{
+ void (*ref)(DCTELEM *block) = is_idct ? ff_ref_idct : ff_ref_fdct;
int it, i, scale;
int err_inf, v;
- int64_t err2, ti, ti1, it1;
- int64_t sysErr[64], sysErrMax=0;
- int maxout=0;
- int blockSumErrMax=0, blockSumErr;
+ int64_t err2, ti, ti1, it1, err_sum = 0;
+ int64_t sysErr[64], sysErrMax = 0;
+ int maxout = 0;
+ int blockSumErrMax = 0, blockSumErr;
AVLFG prng;
const int vals=1<<bits;
+ double omse, ome;
+ int spec_err;
av_lfg_init(&prng, 1);
err_inf = 0;
err2 = 0;
- for(i=0; i<64; i++) sysErr[i]=0;
- for(it=0;it<NB_ITS;it++) {
- for(i=0;i<64;i++)
+ for (i = 0; i < 64; i++)
+ sysErr[i] = 0;
+ for (it = 0; it < NB_ITS; it++) {
+ for (i = 0; i < 64; i++)
block1[i] = 0;
- switch(test){
+ switch (test) {
case 0:
- for(i=0;i<64;i++)
+ for (i = 0; i < 64; i++)
block1[i] = (av_lfg_get(&prng) % (2*vals)) -vals;
- if (is_idct){
+ if (is_idct) {
ff_ref_fdct(block1);
-
- for(i=0;i<64;i++)
- block1[i]>>=3;
+ for (i = 0; i < 64; i++)
+ block1[i] >>= 3;
}
- break;
- case 1:{
- int num = av_lfg_get(&prng) % 10 + 1;
- for(i=0;i<num;i++)
- block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % (2*vals) -vals;
- }break;
+ break;
+ case 1: {
+ int num = av_lfg_get(&prng) % 10 + 1;
+ for (i = 0; i < num; i++)
+ block1[av_lfg_get(&prng) % 64] = av_lfg_get(&prng) % (2*vals) -vals;
+ }
+ break;
case 2:
block1[0] = av_lfg_get(&prng) % (16*vals) - (8*vals);
- block1[63]= (block1[0]&1)^1;
- break;
+ block1[63] = (block1[0] & 1) ^ 1;
+ break;
}
-#if 0 // simulate mismatch control
-{ int sum=0;
- for(i=0;i<64;i++)
- sum+=block1[i];
-
- if((sum&1)==0) block1[63]^=1;
-}
-#endif
+ for (i = 0; i < 64; i++)
+ block_org[i] = block1[i];
- for(i=0; i<64; i++)
- block_org[i]= block1[i];
-
- if (form == MMX_PERM) {
- for(i=0;i<64;i++)
+ if (dct->format == MMX_PERM) {
+ for (i = 0; i < 64; i++)
block[idct_mmx_perm[i]] = block1[i];
- } else if (form == MMX_SIMPLE_PERM) {
- for(i=0;i<64;i++)
+ } else if (dct->format == MMX_SIMPLE_PERM) {
+ for (i = 0; i < 64; i++)
block[idct_simple_mmx_perm[i]] = block1[i];
-
- } else if (form == SSE2_PERM) {
- for(i=0; i<64; i++)
- block[(i&0x38) | idct_sse2_row_perm[i&7]] = block1[i];
- } else if (form == PARTTRANS_PERM) {
- for(i=0; i<64; i++)
- block[(i&0x24) | ((i&3)<<3) | ((i>>3)&3)] = block1[i];
+ } else if (dct->format == SSE2_PERM) {
+ for (i = 0; i < 64; i++)
+ block[(i & 0x38) | idct_sse2_row_perm[i & 7]] = block1[i];
+ } else if (dct->format == PARTTRANS_PERM) {
+ for (i = 0; i < 64; i++)
+ block[(i & 0x24) | ((i & 3) << 3) | ((i >> 3) & 3)] = block1[i];
} else {
- for(i=0; i<64; i++)
- block[i]= block1[i];
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
}
-#if 0 // simulate mismatch control for tested IDCT but not the ref
-{ int sum=0;
- for(i=0;i<64;i++)
- sum+=block[i];
-
- if((sum&1)==0) block[63]^=1;
-}
-#endif
- fdct_func(block);
+ dct->func(block);
mmx_emms();
- if (form == SCALE_PERM) {
- for(i=0; i<64; i++) {
- scale = 8*(1 << (AANSCALE_BITS + 11)) / ff_aanscales[i];
- block[i] = (block[i] * scale /*+ (1<<(AANSCALE_BITS-1))*/) >> AANSCALE_BITS;
+ if (dct->format == SCALE_PERM) {
+ for (i = 0; i < 64; i++) {
+ scale = 8 * (1 << (AANSCALE_BITS + 11)) / ff_aanscales[i];
+ block[i] = (block[i] * scale) >> AANSCALE_BITS;
}
}
- fdct_ref(block1);
+ ref(block1);
- blockSumErr=0;
- for(i=0;i<64;i++) {
- v = abs(block[i] - block1[i]);
+ blockSumErr = 0;
+ for (i = 0; i < 64; i++) {
+ int err = block[i] - block1[i];
+ err_sum += err;
+ v = abs(err);
if (v > err_inf)
err_inf = v;
err2 += v * v;
sysErr[i] += block[i] - block1[i];
blockSumErr += v;
- if( abs(block[i])>maxout) maxout=abs(block[i]);
+ if (abs(block[i]) > maxout)
+ maxout = abs(block[i]);
}
- if(blockSumErrMax < blockSumErr) blockSumErrMax= blockSumErr;
-#if 0 // print different matrix pairs
- if(blockSumErr){
- printf("\n");
- for(i=0; i<64; i++){
- if((i&7)==0) printf("\n");
- printf("%4d ", block_org[i]);
- }
- for(i=0; i<64; i++){
- if((i&7)==0) printf("\n");
- printf("%4d ", block[i] - block1[i]);
- }
- }
-#endif
+ if (blockSumErrMax < blockSumErr)
+ blockSumErrMax = blockSumErr;
}
- for(i=0; i<64; i++) sysErrMax= FFMAX(sysErrMax, FFABS(sysErr[i]));
+ for (i = 0; i < 64; i++)
+ sysErrMax = FFMAX(sysErrMax, FFABS(sysErr[i]));
- for(i=0; i<64; i++){
- if(i%8==0) printf("\n");
- printf("%7d ", (int)sysErr[i]);
+ for (i = 0; i < 64; i++) {
+ if (i % 8 == 0)
+ printf("\n");
+ printf("%7d ", (int) sysErr[i]);
}
printf("\n");
- printf("%s %s: err_inf=%d err2=%0.8f syserr=%0.8f maxout=%d blockSumErr=%d\n",
- is_idct ? "IDCT" : "DCT",
- name, err_inf, (double)err2 / NB_ITS / 64.0, (double)sysErrMax / NB_ITS, maxout, blockSumErrMax);
+ omse = (double) err2 / NB_ITS / 64;
+ ome = (double) err_sum / NB_ITS / 64;
+
+ spec_err = is_idct && (err_inf > 1 || omse > 0.02 || fabs(ome) > 0.0015);
+
+ printf("%s %s: ppe=%d omse=%0.8f ome=%0.8f syserr=%0.8f maxout=%d blockSumErr=%d\n",
+ is_idct ? "IDCT" : "DCT", dct->name, err_inf,
+ omse, ome, (double) sysErrMax / NB_ITS,
+ maxout, blockSumErrMax);
+
+ if (spec_err && !dct->nonspec)
+ return 1;
+
+ if (!speed)
+ return 0;
/* speed test */
- for(i=0;i<64;i++)
+ for (i = 0; i < 64; i++)
block1[i] = 0;
- switch(test){
+
+ switch (test) {
case 0:
- for(i=0;i<64;i++)
+ for (i = 0; i < 64; i++)
block1[i] = av_lfg_get(&prng) % (2*vals) -vals;
- if (is_idct){
+ if (is_idct) {
ff_ref_fdct(block1);
-
- for(i=0;i<64;i++)
- block1[i]>>=3;
+ for (i = 0; i < 64; i++)
+ block1[i] >>= 3;
}
- break;
- case 1:{
+ break;
+ case 1:
case 2:
block1[0] = av_lfg_get(&prng) % (2*vals) -vals;
block1[1] = av_lfg_get(&prng) % (2*vals) -vals;
block1[2] = av_lfg_get(&prng) % (2*vals) -vals;
block1[3] = av_lfg_get(&prng) % (2*vals) -vals;
- }break;
+ break;
}
- if (form == MMX_PERM) {
- for(i=0;i<64;i++)
+ if (dct->format == MMX_PERM) {
+ for (i = 0; i < 64; i++)
block[idct_mmx_perm[i]] = block1[i];
- } else if(form == MMX_SIMPLE_PERM) {
- for(i=0;i<64;i++)
+ } else if (dct->format == MMX_SIMPLE_PERM) {
+ for (i = 0; i < 64; i++)
block[idct_simple_mmx_perm[i]] = block1[i];
} else {
- for(i=0; i<64; i++)
- block[i]= block1[i];
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
}
ti = gettime();
it1 = 0;
do {
- for(it=0;it<NB_ITS_SPEED;it++) {
- for(i=0; i<64; i++)
- block[i]= block1[i];
-// memcpy(block, block1, sizeof(DCTELEM) * 64);
-// do not memcpy especially not fastmemcpy because it does movntq !!!
- fdct_func(block);
+ for (it = 0; it < NB_ITS_SPEED; it++) {
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
+ dct->func(block);
}
it1 += NB_ITS_SPEED;
ti1 = gettime() - ti;
} while (ti1 < 1000000);
mmx_emms();
- printf("%s %s: %0.1f kdct/s\n",
- is_idct ? "IDCT" : "DCT",
- name, (double)it1 * 1000.0 / (double)ti1);
+ printf("%s %s: %0.1f kdct/s\n", is_idct ? "IDCT" : "DCT", dct->name,
+ (double) it1 * 1000.0 / (double) ti1);
+
+ return 0;
}
DECLARE_ALIGNED(8, static uint8_t, img_dest)[64];
@@ -392,19 +388,19 @@ static void idct248_ref(uint8_t *dest, int linesize, int16_t *block)
if (!init) {
init = 1;
- for(i=0;i<8;i++) {
+ for (i = 0; i < 8; i++) {
sum = 0;
- for(j=0;j<8;j++) {
- s = (i==0) ? sqrt(1.0/8.0) : sqrt(1.0/4.0);
+ for (j = 0; j < 8; j++) {
+ s = (i == 0) ? sqrt(1.0 / 8.0) : sqrt(1.0 / 4.0);
c8[i][j] = s * cos(M_PI * i * (j + 0.5) / 8.0);
sum += c8[i][j] * c8[i][j];
}
}
- for(i=0;i<4;i++) {
+ for (i = 0; i < 4; i++) {
sum = 0;
- for(j=0;j<4;j++) {
- s = (i==0) ? sqrt(1.0/4.0) : sqrt(1.0/2.0);
+ for (j = 0; j < 4; j++) {
+ s = (i == 0) ? sqrt(1.0 / 4.0) : sqrt(1.0 / 2.0);
c4[i][j] = s * cos(M_PI * i * (j + 0.5) / 4.0);
sum += c4[i][j] * c4[i][j];
}
@@ -413,58 +409,59 @@ static void idct248_ref(uint8_t *dest, int linesize, int16_t *block)
/* butterfly */
s = 0.5 * sqrt(2.0);
- for(i=0;i<4;i++) {
- for(j=0;j<8;j++) {
- block1[8*(2*i)+j] = (block[8*(2*i)+j] + block[8*(2*i+1)+j]) * s;
- block1[8*(2*i+1)+j] = (block[8*(2*i)+j] - block[8*(2*i+1)+j]) * s;
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 8; j++) {
+ block1[8 * (2 * i) + j] =
+ (block[8 * (2 * i) + j] + block[8 * (2 * i + 1) + j]) * s;
+ block1[8 * (2 * i + 1) + j] =
+ (block[8 * (2 * i) + j] - block[8 * (2 * i + 1) + j]) * s;
}
}
/* idct8 on lines */
- for(i=0;i<8;i++) {
- for(j=0;j<8;j++) {
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
sum = 0;
- for(k=0;k<8;k++)
- sum += c8[k][j] * block1[8*i+k];
- block2[8*i+j] = sum;
+ for (k = 0; k < 8; k++)
+ sum += c8[k][j] * block1[8 * i + k];
+ block2[8 * i + j] = sum;
}
}
/* idct4 */
- for(i=0;i<8;i++) {
- for(j=0;j<4;j++) {
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 4; j++) {
/* top */
sum = 0;
- for(k=0;k<4;k++)
- sum += c4[k][j] * block2[8*(2*k)+i];
- block3[8*(2*j)+i] = sum;
+ for (k = 0; k < 4; k++)
+ sum += c4[k][j] * block2[8 * (2 * k) + i];
+ block3[8 * (2 * j) + i] = sum;
/* bottom */
sum = 0;
- for(k=0;k<4;k++)
- sum += c4[k][j] * block2[8*(2*k+1)+i];
- block3[8*(2*j+1)+i] = sum;
+ for (k = 0; k < 4; k++)
+ sum += c4[k][j] * block2[8 * (2 * k + 1) + i];
+ block3[8 * (2 * j + 1) + i] = sum;
}
}
/* clamp and store the result */
- for(i=0;i<8;i++) {
- for(j=0;j<8;j++) {
- v = block3[8*i+j];
- if (v < 0)
- v = 0;
- else if (v > 255)
- v = 255;
- dest[i * linesize + j] = (int)rint(v);
+ for (i = 0; i < 8; i++) {
+ for (j = 0; j < 8; j++) {
+ v = block3[8 * i + j];
+ if (v < 0) v = 0;
+ else if (v > 255) v = 255;
+ dest[i * linesize + j] = (int) rint(v);
}
}
}
static void idct248_error(const char *name,
- void (*idct248_put)(uint8_t *dest, int line_size, int16_t *block))
+ void (*idct248_put)(uint8_t *dest, int line_size,
+ int16_t *block),
+ int speed)
{
int it, i, it1, ti, ti1, err_max, v;
-
AVLFG prng;
av_lfg_init(&prng, 1);
@@ -472,23 +469,22 @@ static void idct248_error(const char *name,
/* just one test to see if code is correct (precision is less
important here) */
err_max = 0;
- for(it=0;it<NB_ITS;it++) {
-
+ for (it = 0; it < NB_ITS; it++) {
/* XXX: use forward transform to generate values */
- for(i=0;i<64;i++)
+ for (i = 0; i < 64; i++)
block1[i] = av_lfg_get(&prng) % 256 - 128;
block1[0] += 1024;
- for(i=0; i<64; i++)
- block[i]= block1[i];
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
idct248_ref(img_dest1, 8, block);
- for(i=0; i<64; i++)
- block[i]= block1[i];
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
idct248_put(img_dest, 8, block);
- for(i=0;i<64;i++) {
- v = abs((int)img_dest[i] - (int)img_dest1[i]);
+ for (i = 0; i < 64; i++) {
+ v = abs((int) img_dest[i] - (int) img_dest1[i]);
if (v == 255)
printf("%d %d\n", img_dest[i], img_dest1[i]);
if (v > err_max)
@@ -514,18 +510,17 @@ static void idct248_error(const char *name,
}
#endif
}
- printf("%s %s: err_inf=%d\n",
- 1 ? "IDCT248" : "DCT248",
- name, err_max);
+ printf("%s %s: err_inf=%d\n", 1 ? "IDCT248" : "DCT248", name, err_max);
+
+ if (!speed)
+ return;
ti = gettime();
it1 = 0;
do {
- for(it=0;it<NB_ITS_SPEED;it++) {
- for(i=0; i<64; i++)
- block[i]= block1[i];
-// memcpy(block, block1, sizeof(DCTELEM) * 64);
-// do not memcpy especially not fastmemcpy because it does movntq !!!
+ for (it = 0; it < NB_ITS_SPEED; it++) {
+ for (i = 0; i < 64; i++)
+ block[i] = block1[i];
idct248_put(img_dest, 8, block);
}
it1 += NB_ITS_SPEED;
@@ -533,9 +528,8 @@ static void idct248_error(const char *name,
} while (ti1 < 1000000);
mmx_emms();
- printf("%s %s: %0.1f kdct/s\n",
- 1 ? "IDCT248" : "DCT248",
- name, (double)it1 * 1000.0 / (double)ti1);
+ printf("%s %s: %0.1f kdct/s\n", 1 ? "IDCT248" : "DCT248", name,
+ (double) it1 * 1000.0 / (double) ti1);
}
static void help(void)
@@ -545,56 +539,67 @@ static void help(void)
" 1 -> test with random sparse matrixes\n"
" 2 -> do 3. test from mpeg4 std\n"
"-i test IDCT implementations\n"
- "-4 test IDCT248 implementations\n");
+ "-4 test IDCT248 implementations\n"
+ "-t speed test\n");
}
int main(int argc, char **argv)
{
int test_idct = 0, test_248_dct = 0;
- int c,i;
- int test=1;
+ int c, i;
+ int test = 1;
+ int speed = 0;
+ int err = 0;
int bits=8;
+
cpu_flags = av_get_cpu_flags();
ff_ref_dct_init();
idct_mmx_init();
- for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
- for(i=0;i<MAX_NEG_CROP;i++) {
+ for (i = 0; i < 256; i++)
+ cropTbl[i + MAX_NEG_CROP] = i;
+ for (i = 0; i < MAX_NEG_CROP; i++) {
cropTbl[i] = 0;
cropTbl[i + MAX_NEG_CROP + 256] = 255;
}
- for(;;) {
- c = getopt(argc, argv, "ih4");
+ for (;;) {
+ c = getopt(argc, argv, "ih4t");
if (c == -1)
break;
- switch(c) {
+ switch (c) {
case 'i':
test_idct = 1;
break;
case '4':
test_248_dct = 1;
break;
- default :
+ case 't':
+ speed = 1;
+ break;
+ default:
case 'h':
help();
return 0;
}
}
- if(optind <argc) test= atoi(argv[optind]);
+ if (optind < argc)
+ test = atoi(argv[optind]);
if(optind+1 < argc) bits= atoi(argv[optind+1]);
printf("ffmpeg DCT/IDCT test\n");
if (test_248_dct) {
- idct248_error("SIMPLE-C", ff_simple_idct248_put);
+ idct248_error("SIMPLE-C", ff_simple_idct248_put, speed);
} else {
- for (i=0;algos[i].name;i++)
- if (algos[i].is_idct == test_idct && !(~cpu_flags & algos[i].mm_support)) {
- dct_error (algos[i].name, algos[i].is_idct, algos[i].func, algos[i].ref, algos[i].format, test, bits);
- }
+ const struct algo *algos = test_idct ? idct_tab : fdct_tab;
+ for (i = 0; algos[i].name; i++)
+ if (!(~cpu_flags & algos[i].mm_support)) {
+ err |= dct_error(&algos[i], test, test_idct, speed, bits);
+ }
}
- return 0;
+
+ return err;
}
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index f628a64..d4aefee 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -108,7 +108,7 @@ static const uint8_t dnxhd_1242_chroma_weight[] = {
48, 49, 51, 51, 52, 52, 54, 54,
49, 49, 52, 53, 54, 54, 53, 53,
55, 59, 63, 62, 60, 60, 60, 60,
- };
+};
static const uint8_t dnxhd_1243_luma_weight[] = {
0, 32, 32, 33, 33, 35, 35, 35,
@@ -184,35 +184,144 @@ static const uint8_t dnxhd_1237_dc_bits[12] = {
};
static const uint16_t dnxhd_1237_ac_codes[257] = {
- 0, 1, 4, 5, 12, 26, 27, 56, 57, 58, 59, 120, 121, 244, 245, 246, 247, 248, 498, 499, 500, 501, 502, 1006, 1007, 1008, 1009, 1010, 1011, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 4072, 4073, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 32668, 32669, 32670, 32671, 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 65370, 65371, 65372, 65373, 65374, 65375, 65376, 65377, 65378, 65379, 65380, 65381, 65382, 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390, 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398, 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406, 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
+ 0, 1, 4, 5, 12, 26, 27, 56,
+ 57, 58, 59, 120, 121, 244, 245, 246,
+ 247, 248, 498, 499, 500, 501, 502, 1006,
+ 1007, 1008, 1009, 1010, 1011, 2024, 2025, 2026,
+ 2027, 2028, 2029, 2030, 2031, 4064, 4065, 4066,
+ 4067, 4068, 4069, 4070, 4071, 4072, 4073, 8148,
+ 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
+ 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323,
+ 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331,
+ 16332, 16333, 32668, 32669, 32670, 32671, 32672, 32673,
+ 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681,
+ 32682, 32683, 32684, 65370, 65371, 65372, 65373, 65374,
+ 65375, 65376, 65377, 65378, 65379, 65380, 65381, 65382,
+ 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390,
+ 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
+ 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
+ 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
+ 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
+ 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
+ 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
+ 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
+ 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
+ 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
+ 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
+ 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
+ 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
+ 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
+ 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
+ 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
+ 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
+ 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
+ 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
+ 65535,
};
static const uint8_t dnxhd_1237_ac_bits[257] = {
- 2, 2, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 2, 2, 3, 3, 4, 5, 5, 6, 6, 6, 6, 7, 7, 8, 8, 8,
+ 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11,
+ 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16,
};
static const uint8_t dnxhd_1237_ac_level[257] = {
- 1, 1, 2, 0, 3, 4, 2, 5, 6, 7, 3, 8, 9, 10, 11, 12, 4, 5, 13, 14, 15, 16, 6, 17, 18, 19, 20, 21, 7, 22, 23, 24, 25, 26, 27, 8, 9, 28, 29, 30, 31, 32, 33, 34, 10, 11, 12, 35, 36, 37, 38, 39, 40, 41, 13, 14, 15, 16, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 17, 18, 19, 20, 21, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 1, 22, 23, 24, 25, 26, 27, 62, 63, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 1, 1, 2, 0, 3, 4, 2, 5, 6, 7, 3, 8, 9, 10, 11, 12,
+ 4, 5, 13, 14, 15, 16, 6, 17, 18, 19, 20, 21, 7, 22, 23, 24,
+ 25, 26, 27, 8, 9, 28, 29, 30, 31, 32, 33, 34, 10, 11, 12, 35,
+ 36, 37, 38, 39, 40, 41, 13, 14, 15, 16, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 17, 18, 19, 20, 21, 53, 54, 55, 56, 57, 58,
+ 59, 60, 61, 64, 1, 22, 23, 24, 25, 26, 27, 62, 63, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,
};
static const uint8_t dnxhd_1237_ac_run_flag[257] = {
- 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
+ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint8_t dnxhd_1237_ac_index_flag[257] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint16_t dnxhd_1237_run_codes[62] = {
- 0, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 58, 118, 119, 240, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
+ 0, 4, 10, 11, 24, 25, 26, 54,
+ 55, 56, 57, 58, 118, 119, 240, 482,
+ 483, 484, 485, 486, 487, 488, 489, 490,
+ 491, 492, 493, 494, 990, 991, 992, 993,
+ 994, 995, 996, 997, 998, 999, 1000, 1001,
+ 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
+ 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
+ 1018, 1019, 1020, 1021, 1022, 1023,
};
static const uint8_t dnxhd_1237_run_bits[62] = {
- 1, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 1, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 8, 9,
+ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
};
static const uint8_t dnxhd_1237_run[62] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 53, 57, 58, 59, 60, 61, 62, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 53, 57, 58, 59, 60, 61, 62, 22, 23, 24, 25,
+ 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56,
};
static const uint8_t dnxhd_1238_dc_codes[12] = {
@@ -224,35 +333,144 @@ static const uint8_t dnxhd_1238_dc_bits[12] = {
};
static const uint16_t dnxhd_1238_ac_codes[257] = {
- 0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 498, 499, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
+ 0, 1, 4, 10, 11, 24, 25, 26,
+ 54, 55, 56, 57, 116, 117, 118, 119,
+ 240, 241, 242, 243, 244, 245, 492, 493,
+ 494, 495, 496, 497, 498, 499, 1000, 1001,
+ 1002, 1003, 1004, 1005, 1006, 1007, 1008, 2018,
+ 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
+ 2027, 4056, 4057, 4058, 4059, 4060, 4061, 4062,
+ 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140,
+ 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148,
+ 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156,
+ 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321,
+ 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329,
+ 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337,
+ 16338, 32678, 32679, 32680, 32681, 32682, 32683, 32684,
+ 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692,
+ 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700,
+ 32701, 32702, 32703, 32704, 32705, 65412, 65413, 65414,
+ 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
+ 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
+ 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
+ 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
+ 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
+ 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
+ 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
+ 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
+ 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
+ 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
+ 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
+ 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
+ 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
+ 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
+ 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
+ 65535,
};
static const uint8_t dnxhd_1238_ac_bits[257] = {
- 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16,
};
static const uint8_t dnxhd_1238_ac_level[257] = {
- 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 7, 23, 24, 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 10, 11, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 12, 13, 14, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 15, 16, 17, 18, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 40, 25, 26, 27, 28, 29, 30, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
+ 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 22, 6, 7, 23, 24,
+ 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 10,
+ 11, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 12, 13, 14, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 15, 16, 17, 18,
+ 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 40, 25,
+ 26, 27, 28, 29, 30, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,
}; /* 0 is EOB */
static const uint8_t dnxhd_1238_ac_run_flag[257] = {
- 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint8_t dnxhd_1238_ac_index_flag[257] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint16_t dnxhd_1235_1238_1241_run_codes[62] = {
- 0, 4, 10, 11, 24, 25, 26, 27, 56, 57, 58, 59, 120, 242, 486, 487, 488, 489, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
+ 0, 4, 10, 11, 24, 25, 26, 27,
+ 56, 57, 58, 59, 120, 242, 486, 487,
+ 488, 489, 980, 981, 982, 983, 984, 985,
+ 986, 987, 988, 989, 990, 991, 992, 993,
+ 994, 995, 996, 997, 998, 999, 1000, 1001,
+ 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
+ 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
+ 1018, 1019, 1020, 1021, 1022, 1023,
};
static const uint8_t dnxhd_1235_1238_1241_run_bits[62] = {
- 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 1, 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 8, 9, 9,
+ 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
};
static const uint8_t dnxhd_1238_run[62] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 21, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 20, 21, 17, 18, 19, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
};
static const uint8_t dnxhd_1235_1241_dc_codes[14] = {
@@ -262,81 +480,401 @@ static const uint8_t dnxhd_1235_1241_dc_codes[14] = {
static const uint8_t dnxhd_1235_1241_dc_bits[14] = {
4, 6, 4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 7, 7,
};
+
static const uint16_t dnxhd_1235_1241_ac_codes[257] = {
- 0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 498, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707, 32708, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
+ 0, 1, 4, 10, 11, 24, 25, 26,
+ 54, 55, 56, 57, 116, 117, 118, 119,
+ 240, 241, 242, 243, 244, 245, 492, 493,
+ 494, 495, 496, 497, 498, 998, 999, 1000,
+ 1001, 1002, 1003, 1004, 1005, 1006, 1007, 2016,
+ 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024,
+ 2025, 2026, 4054, 4055, 4056, 4057, 4058, 4059,
+ 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067,
+ 4068, 4069, 8140, 8141, 8142, 8143, 8144, 8145,
+ 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153,
+ 8154, 8155, 8156, 8157, 16316, 16317, 16318, 16319,
+ 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
+ 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
+ 16336, 16337, 32676, 32677, 32678, 32679, 32680, 32681,
+ 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689,
+ 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697,
+ 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705,
+ 32706, 32707, 32708, 65418, 65419, 65420, 65421, 65422,
+ 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
+ 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
+ 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
+ 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
+ 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
+ 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
+ 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
+ 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
+ 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
+ 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
+ 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
+ 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
+ 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
+ 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
+ 65535,
};
static const uint8_t dnxhd_1235_1241_ac_bits[257] = {
- 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16,
};
static const uint8_t dnxhd_1235_1241_ac_level[257] = {
- 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 7, 22, 23, 24, 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 38, 10, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 12, 13, 14, 15, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1, 16, 17, 18, 19, 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 25, 26, 27, 28, 29, 30, 31, 32, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
+ 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 7, 22, 23, 24,
+ 25, 26, 27, 28, 29, 8, 9, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 10, 11, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 12, 13,
+ 14, 15, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 1,
+ 16, 17, 18, 19, 64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 25, 26, 27, 28, 29, 30, 31, 32, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,
};
static const uint8_t dnxhd_1235_1241_ac_run_flag[257] = {
- 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint8_t dnxhd_1235_1241_ac_index_flag[257] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
static const uint8_t dnxhd_1235_1241_run[62] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 18, 20, 17, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
};
static const uint8_t dnxhd_1251_dc_codes[12] = {
0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
};
+
static const uint8_t dnxhd_1251_dc_bits[12] = {
3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
};
+
static const uint16_t dnxhd_1251_ac_codes[257] = {
- 0, 1, 4, 10, 11, 24, 25, 26, 54, 55, 56, 57, 116, 117, 118, 119, 240, 241, 242, 243, 244, 245, 492, 493, 494, 495, 496, 497, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 4052, 4053, 4054, 4055, 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 8134, 8135, 8136, 8137, 8138, 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 16336, 16337, 16338, 16339, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699, 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707, 32708, 32709, 32710, 32711, 32712, 32713, 32714, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
+ 0, 1, 4, 10, 11, 24, 25, 26,
+ 54, 55, 56, 57, 116, 117, 118, 119,
+ 240, 241, 242, 243, 244, 245, 492, 493,
+ 494, 495, 496, 497, 996, 997, 998, 999,
+ 1000, 1001, 1002, 1003, 1004, 1005, 2012, 2013,
+ 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
+ 2022, 2023, 2024, 2025, 4052, 4053, 4054, 4055,
+ 4056, 4057, 4058, 4059, 4060, 4061, 4062, 4063,
+ 4064, 4065, 4066, 8134, 8135, 8136, 8137, 8138,
+ 8139, 8140, 8141, 8142, 8143, 8144, 8145, 8146,
+ 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154,
+ 8155, 8156, 16314, 16315, 16316, 16317, 16318, 16319,
+ 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
+ 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
+ 16336, 16337, 16338, 16339, 32680, 32681, 32682, 32683,
+ 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691,
+ 32692, 32693, 32694, 32695, 32696, 32697, 32698, 32699,
+ 32700, 32701, 32702, 32703, 32704, 32705, 32706, 32707,
+ 32708, 32709, 32710, 32711, 32712, 32713, 32714, 65430,
+ 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
+ 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
+ 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
+ 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
+ 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
+ 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
+ 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
+ 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
+ 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
+ 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
+ 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
+ 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
+ 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
+ 65535,
};
+
static const uint8_t dnxhd_1251_ac_bits[257] = {
- 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 2, 2, 3, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+ 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16,
};
+
static const uint8_t dnxhd_1251_ac_level[257] = {
- 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4, 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25, 26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 9, 10, 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 12, 13, 14, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 15, 16, 17, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18, 19, 20, 21, 22, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 23, 24, 25, 26, 27, 28, 59, 60, 61, 62, 63, 64, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 1, 1, 2, 3, 0, 4, 5, 2, 6, 7, 8, 3, 9, 10, 11, 4,
+ 12, 13, 14, 15, 16, 5, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25,
+ 26, 27, 28, 29, 7, 8, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 9, 10, 11, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 12, 13, 14, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1,
+ 2, 3, 4, 5, 6, 7, 8, 15, 16, 17, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 18,
+ 19, 20, 21, 22, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ 58, 23, 24, 25, 26, 27, 28, 59, 60, 61, 62, 63, 64, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,
};
+
static const uint8_t dnxhd_1251_ac_run_flag[257] = {
- 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
+ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
+
static const uint8_t dnxhd_1251_ac_index_flag[257] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
+
static const uint16_t dnxhd_1251_run_codes[62] = {
- 0, 4, 5, 12, 26, 27, 28, 58, 118, 119, 120, 242, 486, 487, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023,
+ 0, 4, 5, 12, 26, 27, 28, 58,
+ 118, 119, 120, 242, 486, 487, 976, 977,
+ 978, 979, 980, 981, 982, 983, 984, 985,
+ 986, 987, 988, 989, 990, 991, 992, 993,
+ 994, 995, 996, 997, 998, 999, 1000, 1001,
+ 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009,
+ 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017,
+ 1018, 1019, 1020, 1021, 1022, 1023,
};
+
static const uint8_t dnxhd_1251_run_bits[62] = {
- 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
+ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
};
+
static const uint8_t dnxhd_1251_run[62] = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
};
static const uint8_t dnxhd_1252_dc_codes[12] = {
0, 12, 13, 1, 2, 3, 4, 5, 14, 30, 62, 63,
};
+
static const uint8_t dnxhd_1252_dc_bits[12] = {
3, 4, 4, 3, 3, 3, 3, 3, 4, 5, 6, 6,
};
+
static const uint16_t dnxhd_1252_ac_codes[257] = {
- 0, 1, 4, 10, 11, 12, 26, 27, 56, 57, 58, 118, 119, 120, 242, 243, 244, 245, 246, 247, 496, 497, 498, 499, 500, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 4060, 4061, 4062, 4063, 4064, 4065, 4066, 4067, 4068, 4069, 4070, 4071, 8144, 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152, 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319, 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327, 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335, 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679, 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687, 32688, 32689, 32690, 32691, 32692, 32693, 32694, 65390, 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398, 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406, 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446, 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454, 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462, 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470, 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478, 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486, 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494, 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502, 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518, 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526, 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534, 65535,
+ 0, 1, 4, 10, 11, 12, 26, 27,
+ 56, 57, 58, 118, 119, 120, 242, 243,
+ 244, 245, 246, 247, 496, 497, 498, 499,
+ 500, 1002, 1003, 1004, 1005, 1006, 1007, 1008,
+ 1009, 2020, 2021, 2022, 2023, 2024, 2025, 2026,
+ 2027, 2028, 2029, 4060, 4061, 4062, 4063, 4064,
+ 4065, 4066, 4067, 4068, 4069, 4070, 4071, 8144,
+ 8145, 8146, 8147, 8148, 8149, 8150, 8151, 8152,
+ 8153, 8154, 8155, 8156, 8157, 8158, 16318, 16319,
+ 16320, 16321, 16322, 16323, 16324, 16325, 16326, 16327,
+ 16328, 16329, 16330, 16331, 16332, 16333, 16334, 16335,
+ 32672, 32673, 32674, 32675, 32676, 32677, 32678, 32679,
+ 32680, 32681, 32682, 32683, 32684, 32685, 32686, 32687,
+ 32688, 32689, 32690, 32691, 32692, 32693, 32694, 65390,
+ 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398,
+ 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406,
+ 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414,
+ 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422,
+ 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430,
+ 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438,
+ 65439, 65440, 65441, 65442, 65443, 65444, 65445, 65446,
+ 65447, 65448, 65449, 65450, 65451, 65452, 65453, 65454,
+ 65455, 65456, 65457, 65458, 65459, 65460, 65461, 65462,
+ 65463, 65464, 65465, 65466, 65467, 65468, 65469, 65470,
+ 65471, 65472, 65473, 65474, 65475, 65476, 65477, 65478,
+ 65479, 65480, 65481, 65482, 65483, 65484, 65485, 65486,
+ 65487, 65488, 65489, 65490, 65491, 65492, 65493, 65494,
+ 65495, 65496, 65497, 65498, 65499, 65500, 65501, 65502,
+ 65503, 65504, 65505, 65506, 65507, 65508, 65509, 65510,
+ 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65518,
+ 65519, 65520, 65521, 65522, 65523, 65524, 65525, 65526,
+ 65527, 65528, 65529, 65530, 65531, 65532, 65533, 65534,
+ 65535,
};
+
static const uint8_t dnxhd_1252_ac_bits[257] = {
- 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8,
+ 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10,
+ 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
+ 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+ 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16,
};
+
static const uint8_t dnxhd_1252_ac_level[257] = {
- 1, 1, 2, 3, 2, 0, 4, 5, 6, 7, 3, 8, 9, 10, 11, 12, 13, 14, 4, 5, 15, 16, 17, 18, 6, 19, 20, 21, 22, 23, 24, 7, 8, 25, 26, 27, 28, 29, 30, 31, 32, 9, 10, 33, 34, 35, 36, 37, 38, 39, 40, 41, 11, 12, 13, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 14, 15, 16, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 17, 18, 19, 20, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
+ 1, 1, 2, 3, 2, 0, 4, 5, 6, 7, 3, 8, 9, 10, 11, 12,
+ 13, 14, 4, 5, 15, 16, 17, 18, 6, 19, 20, 21, 22, 23, 24, 7,
+ 8, 25, 26, 27, 28, 29, 30, 31, 32, 9, 10, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 11, 12, 13, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 14, 15, 16, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 17, 18, 19, 20, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 22, 23, 24, 25, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
+ 64,
};
+
static const uint8_t dnxhd_1252_ac_run_flag[257] = {
- 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1,
+ 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
+
static const uint8_t dnxhd_1252_ac_index_flag[257] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1,
};
const CIDEntry ff_dnxhd_cid_table[] = {
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 0e596b1..bfbe12e 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2664,6 +2664,22 @@ static void apply_window_int16_c(int16_t *output, const int16_t *input,
}
}
+static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len)
+{
+ do {
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ *dst++ = av_clip(*src++, min, max);
+ len -= 8;
+ } while (len > 0);
+}
+
#define W0 2048
#define W1 2841 /* 2048*sqrt (2)*cos (1*pi/16) */
#define W2 2676 /* 2048*sqrt (2)*cos (2*pi/16) */
@@ -3106,6 +3122,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx)
c->scalarproduct_int16 = scalarproduct_int16_c;
c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
c->apply_window_int16 = apply_window_int16_c;
+ c->vector_clip_int32 = vector_clip_int32_c;
c->scalarproduct_float = scalarproduct_float_c;
c->butterflies_float = butterflies_float_c;
c->vector_fmul_scalar = vector_fmul_scalar_c;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 0143ed7..401a87a 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -150,7 +150,7 @@ void clear_blocks_c(DCTELEM *blocks);
/* add and put pixel (decoding) */
// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16
-//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller then 4
+//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller than 4
typedef void (*op_pixels_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int h);
typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h);
typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, int stride);
@@ -183,7 +183,7 @@ static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
}
/* motion estimation */
-// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller then 2
+// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller than 2
// although currently h<4 is not used as functions with width <8 are neither used nor implemented
typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/;
@@ -553,6 +553,22 @@ typedef struct DSPContext {
void (*apply_window_int16)(int16_t *output, const int16_t *input,
const int16_t *window, unsigned int len);
+ /**
+ * Clip each element in an array of int32_t to a given minimum and maximum value.
+ * @param dst destination array
+ * constraints: 16-byte aligned
+ * @param src source array
+ * constraints: 16-byte aligned
+ * @param min minimum value
+ * constraints: must in the the range [-(1<<24), 1<<24]
+ * @param max maximum value
+ * constraints: must in the the range [-(1<<24), 1<<24]
+ * @param len number of elements in the array
+ * constraints: multiple of 32 greater than zero
+ */
+ void (*vector_clip_int32)(int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
+
/* rv30 functions */
qpel_mc_func put_rv30_tpel_pixels_tab[4][16];
qpel_mc_func avg_rv30_tpel_pixels_tab[4][16];
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index 58533d2..5f7aa4f 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -27,7 +27,7 @@
* DSP utils
*/
-#include "high_bit_depth.h"
+#include "bit_depth_template.c"
static inline void FUNC(copy_block2)(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
{
diff --git a/libavcodec/dv.c b/libavcodec/dv.c
index d6c49c8..bfd5ae4 100644
--- a/libavcodec/dv.c
+++ b/libavcodec/dv.c
@@ -370,7 +370,6 @@ typedef struct BlockInfo {
/* bit budget for AC only in 5 MBs */
static const int vs_total_ac_bits = (100 * 4 + 68*2) * 5;
-/* see dv_88_areas and dv_248_areas for details */
static const int mb_area_start[5] = { 1, 6, 21, 43, 64 };
static inline int put_bits_left(PutBitContext* s)
@@ -378,7 +377,7 @@ static inline int put_bits_left(PutBitContext* s)
return (s->buf_end - s->buf) * 8 - put_bits_count(s);
}
-/* decode ac coefficients */
+/* decode AC coefficients */
static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
{
int last_index = gb->size_in_bits;
@@ -391,7 +390,7 @@ static void dv_decode_ac(GetBitContext *gb, BlockInfo *mb, DCTELEM *block)
OPEN_READER(re, gb);
UPDATE_CACHE(re, gb);
- /* if we must parse a partial vlc, we do it here */
+ /* if we must parse a partial VLC, we do it here */
if (partial_bit_count > 0) {
re_cache = ((unsigned)re_cache >> partial_bit_count) |
(mb->partial_bit_buffer << (sizeof(re_cache) * 8 - partial_bit_count));
@@ -476,8 +475,8 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
GetBitContext gb;
BlockInfo mb_data[5 * DV_MAX_BPM], *mb, *mb1;
LOCAL_ALIGNED_16(DCTELEM, sblock, [5*DV_MAX_BPM], [64]);
- LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [80 + 4]); /* allow some slack */
- LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5 * 80 + 4]); /* allow some slack */
+ LOCAL_ALIGNED_16(uint8_t, mb_bit_buffer, [ 80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
+ LOCAL_ALIGNED_16(uint8_t, vs_bit_buffer, [5*80 + FF_INPUT_BUFFER_PADDING_SIZE]); /* allow some slack */
const int log2_blocksize = 3-s->avctx->lowres;
int is_field_mode[5];
@@ -486,7 +485,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
memset(sblock, 0, 5*DV_MAX_BPM*sizeof(*sblock));
- /* pass 1 : read DC and AC coefficients in blocks */
+ /* pass 1: read DC and AC coefficients in blocks */
buf_ptr = &s->buf[work_chunk->buf_offset*80];
block1 = &sblock[0][0];
mb1 = mb_data;
@@ -503,7 +502,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
last_index = s->sys->block_sizes[j];
init_get_bits(&gb, buf_ptr, last_index);
- /* get the dc */
+ /* get the DC */
dc = get_sbits(&gb, 9);
dct_mode = get_bits1(&gb);
class1 = get_bits(&gb, 2);
@@ -530,7 +529,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
av_dlog(avctx, "MB block: %d, %d ", mb_index, j);
dv_decode_ac(&gb, mb, block);
- /* write the remaining bits in a new buffer only if the
+ /* write the remaining bits in a new buffer only if the
block is finished */
if (mb->pos >= 64)
bit_copy(&pb, &gb);
@@ -539,11 +538,12 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
mb++;
}
- /* pass 2 : we can do it just after */
+ /* pass 2: we can do it just after */
av_dlog(avctx, "***pass 2 size=%d MB#=%d\n", put_bits_count(&pb), mb_index);
block = block1;
mb = mb1;
init_get_bits(&gb, mb_bit_buffer, put_bits_count(&pb));
+ put_bits32(&pb, 0); // padding must be zeroed
flush_put_bits(&pb);
for (j = 0; j < s->sys->bpm; j++, block += 64, mb++) {
if (mb->pos < 64 && get_bits_left(&gb) > 0) {
@@ -559,11 +559,12 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
bit_copy(&vs_pb, &gb);
}
- /* we need a pass other the whole video segment */
+ /* we need a pass over the whole video segment */
av_dlog(avctx, "***pass 3 size=%d\n", put_bits_count(&vs_pb));
block = &sblock[0][0];
mb = mb_data;
init_get_bits(&gb, vs_bit_buffer, put_bits_count(&vs_pb));
+ put_bits32(&vs_pb, 0); // padding must be zeroed
flush_put_bits(&vs_pb);
for (mb_index = 0; mb_index < 5; mb_index++) {
for (j = 0; j < s->sys->bpm; j++) {
@@ -640,7 +641,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
}
#if CONFIG_SMALL
-/* Converts run and level (where level != 0) pair into vlc, returning bit size */
+/* Converts run and level (where level != 0) pair into VLC, returning bit size */
static av_always_inline int dv_rl2vlc(int run, int level, int sign, uint32_t* vlc)
{
int size;
@@ -817,7 +818,7 @@ static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
if (level + 15 > 30U) {
bi->sign[i] = (level >> 31) & 1;
- /* weigh it and and shift down into range, adding for rounding */
+ /* weight it and and shift down into range, adding for rounding */
/* the extra division by a factor of 2^4 reverses the 8x expansion of the DCT
AND the 2x doubling of the weights */
level = (FFABS(level) * weight[i] + (1 << (dv_weight_bits+3))) >> (dv_weight_bits+4);
diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h
index 5c5fe21..6eb494b 100644
--- a/libavcodec/dxva2.h
+++ b/libavcodec/dxva2.h
@@ -27,6 +27,8 @@
#include <dxva2api.h>
+#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
+
/**
* This structure is used to provides the necessary configurations and data
* to the DXVA2 FFmpeg HWAccel implementation.
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index bc80e98..2d2e475 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -113,7 +113,10 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
pp->bit_depth_luma_minus8 = h->sps.bit_depth_luma - 8;
pp->bit_depth_chroma_minus8 = h->sps.bit_depth_chroma - 8;
- pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */
+ if (ctx->workaround & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG)
+ pp->Reserved16Bits = 0;
+ else
+ pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */
pp->StatusReportFeedbackNumber = 1 + ctx->report_id++;
pp->CurrFieldOrderCnt[0] = 0;
if ((s->picture_structure & PICT_TOP_FIELD) &&
@@ -150,17 +153,27 @@ static void fill_picture_parameters(struct dxva_context *ctx, const H264Context
//pp->SliceGroupMap[810]; /* XXX not implemented by FFmpeg */
}
-static void fill_scaling_lists(const H264Context *h, DXVA_Qmatrix_H264 *qm)
+static void fill_scaling_lists(struct dxva_context *ctx, const H264Context *h, DXVA_Qmatrix_H264 *qm)
{
unsigned i, j;
memset(qm, 0, sizeof(*qm));
- for (i = 0; i < 6; i++)
- for (j = 0; j < 16; j++)
- qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][zigzag_scan[j]];
+ if (ctx->workaround & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 16; j++)
+ qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][j];
+
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 64; j++)
+ qm->bScalingLists8x8[i][j] = h->pps.scaling_matrix8[i][j];
+ } else {
+ for (i = 0; i < 6; i++)
+ for (j = 0; j < 16; j++)
+ qm->bScalingLists4x4[i][j] = h->pps.scaling_matrix4[i][zigzag_scan[j]];
- for (i = 0; i < 2; i++)
- for (j = 0; j < 64; j++)
- qm->bScalingLists8x8[i][j] = h->pps.scaling_matrix8[i][ff_zigzag_direct[j]];
+ for (i = 0; i < 2; i++)
+ for (j = 0; j < 64; j++)
+ qm->bScalingLists8x8[i][j] = h->pps.scaling_matrix8[i][ff_zigzag_direct[j]];
+ }
}
static int is_slice_short(struct dxva_context *ctx)
@@ -370,7 +383,7 @@ static int start_frame(AVCodecContext *avctx,
fill_picture_parameters(ctx, h, &ctx_pic->pp);
/* Fill up DXVA_Qmatrix_H264 */
- fill_scaling_lists(h, &ctx_pic->qm);
+ fill_scaling_lists(ctx, h, &ctx_pic->qm);
ctx_pic->slice_count = 0;
ctx_pic->bitstream_size = 0;
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index a0a4a1d..070e024 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -42,25 +42,6 @@
extern const uint8_t ff_log2_run[41];
-static const int8_t quant3[256]={
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,
-};
-
static const int8_t quant5_10bit[256]={
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -98,42 +79,7 @@ static const int8_t quant5[256]={
-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,
};
-static const int8_t quant7[256]={
- 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant9[256]={
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,
-};
+
static const int8_t quant9_10bit[256]={
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3,
@@ -171,24 +117,6 @@ static const int8_t quant11[256]={
-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
-4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
};
-static const int8_t quant13[256]={
- 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1,
-};
static const uint8_t ver2_state[256]= {
0, 10, 10, 10, 10, 16, 16, 16, 28, 16, 16, 29, 42, 49, 20, 49,
diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c
index a57e851..47a94a4 100644
--- a/libavcodec/flashsv.c
+++ b/libavcodec/flashsv.c
@@ -25,26 +25,10 @@
* Flash Screen Video decoder
* @author Alex Beregszaszi
* @author Benjamin Larsson
- */
-
-/* Bitstream description
- * The picture is divided into blocks that are zlib compressed.
- *
- * The decoder is fed complete frames, the frameheader contains:
- * 4bits of block width
- * 12bits of frame width
- * 4bits of block height
- * 12bits of frame height
- *
- * Directly after the header are the compressed blocks. The blocks
- * have their compressed size represented with 16bits in the beginnig.
- * If the size = 0 then the block is unchanged from the previous frame.
- * All blocks are decompressed until the buffer is consumed.
*
- * Encoding ideas, a basic encoder would just use a fixed block size.
- * Block sizes can be multipels of 16, from 16 to 256. The blocks don't
- * have to be quadratic. A brute force search with a set of diffrent
- * block sizes should give a better result then to just use a fixed size.
+ * A description of the bitstream format for Flash Screen Video version 1/2
+ * is part of the SWF File Format Specification (version 10), which can be
+ * downloaded from http://www.adobe.com/devnet/swf.html.
*/
#include <stdio.h>
@@ -65,18 +49,6 @@ typedef struct FlashSVContext {
} FlashSVContext;
-static void copy_region(uint8_t *sptr, uint8_t *dptr,
- int dx, int dy, int h, int w, int stride)
-{
- int i;
-
- for (i = dx + h; i > dx; i--) {
- memcpy(dptr + (i * stride) + dy * 3, sptr, w * 3);
- sptr += w * 3;
- }
-}
-
-
static av_cold int flashsv_decode_init(AVCodecContext *avctx)
{
FlashSVContext *s = avctx->priv_data;
@@ -86,7 +58,7 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
s->zstream.zalloc = Z_NULL;
s->zstream.zfree = Z_NULL;
s->zstream.opaque = Z_NULL;
- zret = inflateInit(&(s->zstream));
+ zret = inflateInit(&s->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
return 1;
@@ -102,7 +74,6 @@ static av_cold int flashsv_decode_init(AVCodecContext *avctx)
static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
- const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
FlashSVContext *s = avctx->priv_data;
int h_blocks, v_blocks, h_part, v_part, i, j;
@@ -114,7 +85,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
if (buf_size < 4)
return -1;
- init_get_bits(&gb, buf, buf_size * 8);
+ init_get_bits(&gb, avpkt->data, buf_size * 8);
/* start to parse the bitstream */
s->block_width = 16 * (get_bits(&gb, 4) + 1);
@@ -122,7 +93,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
s->block_height = 16 * (get_bits(&gb, 4) + 1);
s->image_height = get_bits(&gb, 12);
- /* calculate amount of blocks and the size of the border blocks */
+ /* calculate number of blocks and size of border (partial) blocks */
h_blocks = s->image_width / s->block_width;
h_part = s->image_width % s->block_width;
v_blocks = s->image_height / s->block_height;
@@ -139,26 +110,29 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
}
s->block_size = s->block_width * s->block_height;
- /* init the image size once */
- if ((avctx->width == 0) && (avctx->height == 0)) {
+ /* initialize the image size once */
+ if (avctx->width == 0 && avctx->height == 0) {
avctx->width = s->image_width;
avctx->height = s->image_height;
}
/* check for changes of image width and image height */
- if ((avctx->width != s->image_width) || (avctx->height != s->image_height)) {
- av_log(avctx, AV_LOG_ERROR, "Frame width or height differs from first frames!\n");
- av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n", avctx->height,
- avctx->width, s->image_height, s->image_width);
- return -1;
+ if (avctx->width != s->image_width || avctx->height != s->image_height) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Frame width or height differs from first frames!\n");
+ av_log(avctx, AV_LOG_ERROR, "fh = %d, fv %d vs ch = %d, cv = %d\n",
+ avctx->height, avctx->width, s->image_height, s->image_width);
+ return AVERROR_INVALIDDATA;
}
- av_log(avctx, AV_LOG_DEBUG, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
- s->image_width, s->image_height, s->block_width, s->block_height,
- h_blocks, v_blocks, h_part, v_part);
+ av_dlog(avctx, "image: %dx%d block: %dx%d num: %dx%d part: %dx%d\n",
+ s->image_width, s->image_height, s->block_width, s->block_height,
+ h_blocks, v_blocks, h_part, v_part);
- s->frame.reference = 1;
- s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
+ s->frame.reference = 3;
+ s->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
+ FF_BUFFER_HINTS_PRESERVE |
+ FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return -1;
@@ -167,49 +141,58 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
/* loop over all block columns */
for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) {
- int hp = j * s->block_height; // horiz position in frame
- int hs = (j < v_blocks) ? s->block_height : v_part; // size of block
-
+ int y_pos = j * s->block_height; // vertical position in frame
+ int cur_blk_height = (j < v_blocks) ? s->block_height : v_part;
/* loop over all block rows */
for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) {
- int wp = i * s->block_width; // vert position in frame
- int ws = (i < h_blocks) ? s->block_width : h_part; // size of block
+ int x_pos = i * s->block_width; // horizontal position in frame
+ int cur_blk_width = (i < h_blocks) ? s->block_width : h_part;
/* get the size of the compressed zlib chunk */
int size = get_bits(&gb, 16);
if (8 * size > get_bits_left(&gb)) {
avctx->release_buffer(avctx, &s->frame);
s->frame.data[0] = NULL;
- return -1;
+ return AVERROR_INVALIDDATA;
}
- if (size == 0) {
- /* no change, don't do anything */
- } else {
+ /* skip unchanged blocks, which have size 0 */
+ if (size) {
/* decompress block */
- int ret = inflateReset(&(s->zstream));
+ uint8_t *line = s->tmpblock;
+ int k;
+ int ret = inflateReset(&s->zstream);
if (ret != Z_OK) {
- av_log(avctx, AV_LOG_ERROR, "error in decompression (reset) of block %dx%d\n", i, j);
+ av_log(avctx, AV_LOG_ERROR,
+ "error in decompression (reset) of block %dx%d\n", i, j);
/* return -1; */
}
- s->zstream.next_in = buf + (get_bits_count(&gb) / 8);
+ s->zstream.next_in = avpkt->data + get_bits_count(&gb) / 8;
s->zstream.avail_in = size;
s->zstream.next_out = s->tmpblock;
s->zstream.avail_out = s->block_size * 3;
- ret = inflate(&(s->zstream), Z_FINISH);
+ ret = inflate(&s->zstream, Z_FINISH);
if (ret == Z_DATA_ERROR) {
av_log(avctx, AV_LOG_ERROR, "Zlib resync occurred\n");
- inflateSync(&(s->zstream));
- ret = inflate(&(s->zstream), Z_FINISH);
+ inflateSync(&s->zstream);
+ ret = inflate(&s->zstream, Z_FINISH);
}
- if ((ret != Z_OK) && (ret != Z_STREAM_END)) {
- av_log(avctx, AV_LOG_ERROR, "error in decompression of block %dx%d: %d\n", i, j, ret);
+ if (ret != Z_OK && ret != Z_STREAM_END) {
+ av_log(avctx, AV_LOG_ERROR,
+ "error in decompression of block %dx%d: %d\n", i, j, ret);
/* return -1; */
}
- copy_region(s->tmpblock, s->frame.data[0], s->image_height - (hp + hs + 1),
- wp, hs, ws, s->frame.linesize[0]);
+ /* Flash Screen Video stores the image upside down, so copy
+ * lines to destination in reverse order. */
+ for (k = 1; k <= cur_blk_height; k++) {
+ memcpy(s->frame.data[0] + x_pos * 3 +
+ (s->image_height - y_pos - k) * s->frame.linesize[0],
+ line, cur_blk_width * 3);
+ /* advance source pointer to next line */
+ line += cur_blk_width * 3;
+ }
skip_bits_long(&gb, 8 * size); /* skip the consumed bits */
}
}
@@ -230,7 +213,7 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data,
static av_cold int flashsv_decode_end(AVCodecContext *avctx)
{
FlashSVContext *s = avctx->priv_data;
- inflateEnd(&(s->zstream));
+ inflateEnd(&s->zstream);
/* release the frame if needed */
if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame);
diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index 8cc72e2..f516d23 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -112,7 +112,6 @@ static av_cold int flic_decode_init(AVCodecContext *avctx)
case 24 : avctx->pix_fmt = PIX_FMT_BGR24; /* Supposedly BGR, but havent any files to test with */
av_log(avctx, AV_LOG_ERROR, "24Bpp FLC/FLX is unsupported due to no test files.\n");
return -1;
- break;
default :
av_log(avctx, AV_LOG_ERROR, "Unknown FLC/FLX depth of %d Bpp is unsupported.\n",depth);
return -1;
diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 8579c87..96d33b3 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -201,19 +201,11 @@ static inline void skip_bits_long(GetBitContext *s, int n){
} \
} while (0)
-#if ARCH_X86
-# define SKIP_CACHE(name, gb, num) \
- __asm__("shldl %2, %1, %0 \n\t" \
- "shll %2, %1 \n\t" \
- : "+r" (name##_cache0), "+r" (name##_cache1) \
- : "Ic" ((uint8_t)(num)))
-#else
# define SKIP_CACHE(name, gb, num) do { \
name##_cache0 <<= (num); \
name##_cache0 |= NEG_USR32(name##_cache1,num); \
name##_cache1 <<= (num); \
} while (0)
-#endif
# define SKIP_COUNTER(name, gb, num) name##_bit_count += (num)
@@ -381,7 +373,7 @@ static inline int check_marker(GetBitContext *s, const char *msg)
/**
* init GetBitContext.
- * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger then the actual read bits
+ * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes larger than the actual read bits
* because some optimized bitstream readers read 32 or 64 bit at once and could read over the end
* @param bit_size the size of the buffer in bits
*
@@ -504,7 +496,7 @@ void free_vlc(VLC *vlc);
/**
- * parses a vlc code, faster then get_vlc()
+ * parses a vlc code, faster than get_vlc()
* @param bits is the number of bits which will be read at once, must be
* identical to nb_bits in init_vlc()
* @param max_depth is the number of times bits bits must be read to completely
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 8ecf9b4..1be7c2a 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -60,15 +60,6 @@ static const enum PixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = {
PIX_FMT_NONE
};
-void ff_h264_write_back_intra_pred_mode(H264Context *h){
- int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
-
- AV_COPY32(mode, h->intra4x4_pred_mode_cache + 4 + 8*4);
- mode[4]= h->intra4x4_pred_mode_cache[7+8*3];
- mode[5]= h->intra4x4_pred_mode_cache[7+8*2];
- mode[6]= h->intra4x4_pred_mode_cache[7+8*1];
-}
-
/**
* checks if the top & left blocks are available if needed & changes the dc mode so it only uses the available blocks.
*/
@@ -787,24 +778,6 @@ static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t
prefetch_motion(h, 1, pixel_shift, chroma444);
}
-#define hl_motion_fn(sh, bits) \
-static av_always_inline void hl_motion_ ## bits(H264Context *h, \
- uint8_t *dest_y, \
- uint8_t *dest_cb, uint8_t *dest_cr, \
- qpel_mc_func (*qpix_put)[16], \
- h264_chroma_mc_func (*chroma_put), \
- qpel_mc_func (*qpix_avg)[16], \
- h264_chroma_mc_func (*chroma_avg), \
- h264_weight_func *weight_op, \
- h264_biweight_func *weight_avg, \
- int chroma444) \
-{ \
- hl_motion(h, dest_y, dest_cb, dest_cr, qpix_put, chroma_put, \
- qpix_avg, chroma_avg, weight_op, weight_avg, sh, chroma444); \
-}
-hl_motion_fn(0, 8);
-hl_motion_fn(1, 16);
-
static void free_tables(H264Context *h, int free_rbsp){
int i;
H264Context *hx;
@@ -1452,7 +1425,7 @@ static void decode_postinit(H264Context *h, int setup_finished){
ff_thread_finish_setup(s->avctx);
}
-static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int chroma444, int simple){
+static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src_cb, uint8_t *src_cr, int linesize, int uvlinesize, int chroma444, int simple){
MpegEncContext * const s = &h->s;
uint8_t *top_border;
int top_idx = 1;
@@ -1527,7 +1500,7 @@ static inline void backup_mb_border(H264Context *h, uint8_t *src_y, uint8_t *src
}
}
-static inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
+static av_always_inline void xchg_mb_border(H264Context *h, uint8_t *src_y,
uint8_t *src_cb, uint8_t *src_cr,
int linesize, int uvlinesize,
int xchg, int chroma444,
@@ -1885,18 +1858,11 @@ static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, i
if(h->deblocking_filter)
xchg_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0, 0, simple, pixel_shift);
}else if(is_h264){
- if (pixel_shift) {
- hl_motion_16(h, dest_y, dest_cb, dest_cr,
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab, 0);
- } else
- hl_motion_8(h, dest_y, dest_cb, dest_cr,
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab, 0);
+ hl_motion(h, dest_y, dest_cb, dest_cr,
+ s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
+ s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
+ h->h264dsp.weight_h264_pixels_tab,
+ h->h264dsp.biweight_h264_pixels_tab, pixel_shift, 0);
}
hl_decode_mb_idct_luma(h, mb_type, is_h264, simple, transform_bypass, pixel_shift, block_offset, linesize, dest_y, 0);
@@ -2029,18 +1995,11 @@ static av_always_inline void hl_decode_mb_444_internal(H264Context *h, int simpl
if(h->deblocking_filter)
xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 0, 1, simple, pixel_shift);
}else{
- if (pixel_shift) {
- hl_motion_16(h, dest[0], dest[1], dest[2],
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab, 1);
- } else
- hl_motion_8(h, dest[0], dest[1], dest[2],
- s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
- s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
- h->h264dsp.weight_h264_pixels_tab,
- h->h264dsp.biweight_h264_pixels_tab, 1);
+ hl_motion(h, dest[0], dest[1], dest[2],
+ s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
+ s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
+ h->h264dsp.weight_h264_pixels_tab,
+ h->h264dsp.biweight_h264_pixels_tab, pixel_shift, 1);
}
for (p = 0; p < plane_count; p++)
@@ -2975,7 +2934,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
}
}
}
- h->qp_thresh= 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset) - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1]);
+ h->qp_thresh = 15 + 52 - FFMIN(h->slice_alpha_c0_offset, h->slice_beta_offset)
+ - FFMAX3(0, h->pps.chroma_qp_index_offset[0], h->pps.chroma_qp_index_offset[1])
+ + 6 * (h->sps.bit_depth_luma - 8);
#if 0 //FMO
if( h->pps.num_slice_groups > 1 && h->pps.mb_slice_group_map_type >= 3 && h->pps.mb_slice_group_map_type <= 5)
@@ -3057,6 +3018,82 @@ int ff_h264_get_slice_type(const H264Context *h)
}
}
+static av_always_inline void fill_filter_caches_inter(H264Context *h, MpegEncContext * const s, int mb_type, int top_xy,
+ int left_xy[LEFT_MBS], int top_type, int left_type[LEFT_MBS], int mb_xy, int list)
+{
+ int b_stride = h->b_stride;
+ int16_t (*mv_dst)[2] = &h->mv_cache[list][scan8[0]];
+ int8_t *ref_cache = &h->ref_cache[list][scan8[0]];
+ if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
+ if(USES_LIST(top_type, list)){
+ const int b_xy= h->mb2b_xy[top_xy] + 3*b_stride;
+ const int b8_xy= 4*top_xy + 2;
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
+ AV_COPY128(mv_dst - 1*8, s->current_picture.motion_val[list][b_xy + 0]);
+ ref_cache[0 - 1*8]=
+ ref_cache[1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]];
+ ref_cache[2 - 1*8]=
+ ref_cache[3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]];
+ }else{
+ AV_ZERO128(mv_dst - 1*8);
+ AV_WN32A(&ref_cache[0 - 1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ }
+
+ if(!IS_INTERLACED(mb_type^left_type[LTOP])){
+ if(USES_LIST(left_type[LTOP], list)){
+ const int b_xy= h->mb2b_xy[left_xy[LTOP]] + 3;
+ const int b8_xy= 4*left_xy[LTOP] + 1;
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[LTOP]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
+ AV_COPY32(mv_dst - 1 + 0, s->current_picture.motion_val[list][b_xy + b_stride*0]);
+ AV_COPY32(mv_dst - 1 + 8, s->current_picture.motion_val[list][b_xy + b_stride*1]);
+ AV_COPY32(mv_dst - 1 +16, s->current_picture.motion_val[list][b_xy + b_stride*2]);
+ AV_COPY32(mv_dst - 1 +24, s->current_picture.motion_val[list][b_xy + b_stride*3]);
+ ref_cache[-1 + 0]=
+ ref_cache[-1 + 8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*0]];
+ ref_cache[-1 + 16]=
+ ref_cache[-1 + 24]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*1]];
+ }else{
+ AV_ZERO32(mv_dst - 1 + 0);
+ AV_ZERO32(mv_dst - 1 + 8);
+ AV_ZERO32(mv_dst - 1 +16);
+ AV_ZERO32(mv_dst - 1 +24);
+ ref_cache[-1 + 0]=
+ ref_cache[-1 + 8]=
+ ref_cache[-1 + 16]=
+ ref_cache[-1 + 24]= LIST_NOT_USED;
+ }
+ }
+ }
+
+ if(!USES_LIST(mb_type, list)){
+ fill_rectangle(mv_dst, 4, 4, 8, pack16to32(0,0), 4);
+ AV_WN32A(&ref_cache[0*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ AV_WN32A(&ref_cache[1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ AV_WN32A(&ref_cache[2*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ AV_WN32A(&ref_cache[3*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
+ return;
+ }
+
+ {
+ int8_t *ref = &s->current_picture.ref_index[list][4*mb_xy];
+ int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
+ uint32_t ref01 = (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101;
+ uint32_t ref23 = (pack16to32(ref2frm[list][ref[2]],ref2frm[list][ref[3]])&0x00FF00FF)*0x0101;
+ AV_WN32A(&ref_cache[0*8], ref01);
+ AV_WN32A(&ref_cache[1*8], ref01);
+ AV_WN32A(&ref_cache[2*8], ref23);
+ AV_WN32A(&ref_cache[3*8], ref23);
+ }
+
+ {
+ int16_t (*mv_src)[2] = &s->current_picture.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride];
+ AV_COPY128(mv_dst + 8*0, mv_src + 0*b_stride);
+ AV_COPY128(mv_dst + 8*1, mv_src + 1*b_stride);
+ AV_COPY128(mv_dst + 8*2, mv_src + 2*b_stride);
+ AV_COPY128(mv_dst + 8*3, mv_src + 3*b_stride);
+ }
+}
+
/**
*
* @return non zero if the loop filter can be skiped
@@ -3064,208 +3101,124 @@ int ff_h264_get_slice_type(const H264Context *h)
static int fill_filter_caches(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
const int mb_xy= h->mb_xy;
- int top_xy, left_xy[2];
- int top_type, left_type[2];
+ int top_xy, left_xy[LEFT_MBS];
+ int top_type, left_type[LEFT_MBS];
+ uint8_t *nnz;
+ uint8_t *nnz_cache;
top_xy = mb_xy - (s->mb_stride << MB_FIELD);
- //FIXME deblocking could skip the intra and nnz parts.
-
/* Wow, what a mess, why didn't they simplify the interlacing & intra
* stuff, I can't imagine that these complex rules are worth it. */
- left_xy[1] = left_xy[0] = mb_xy-1;
+ left_xy[LBOT] = left_xy[LTOP] = mb_xy-1;
if(FRAME_MBAFF){
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
const int curr_mb_field_flag = IS_INTERLACED(mb_type);
if(s->mb_y&1){
if (left_mb_field_flag != curr_mb_field_flag) {
- left_xy[0] -= s->mb_stride;
+ left_xy[LTOP] -= s->mb_stride;
}
}else{
if(curr_mb_field_flag){
top_xy += s->mb_stride & (((s->current_picture.mb_type[top_xy ]>>7)&1)-1);
}
if (left_mb_field_flag != curr_mb_field_flag) {
- left_xy[1] += s->mb_stride;
+ left_xy[LBOT] += s->mb_stride;
}
}
}
h->top_mb_xy = top_xy;
- h->left_mb_xy[0] = left_xy[0];
- h->left_mb_xy[1] = left_xy[1];
+ h->left_mb_xy[LTOP] = left_xy[LTOP];
+ h->left_mb_xy[LBOT] = left_xy[LBOT];
{
//for sufficiently low qp, filtering wouldn't do anything
//this is a conservative estimate: could also check beta_offset and more accurate chroma_qp
int qp_thresh = h->qp_thresh; //FIXME strictly we should store qp_thresh for each mb of a slice
int qp = s->current_picture.qscale_table[mb_xy];
if(qp <= qp_thresh
- && (left_xy[0]<0 || ((qp + s->current_picture.qscale_table[left_xy[0]] + 1)>>1) <= qp_thresh)
- && (top_xy < 0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){
+ && (left_xy[LTOP]<0 || ((qp + s->current_picture.qscale_table[left_xy[LTOP]] + 1)>>1) <= qp_thresh)
+ && (top_xy <0 || ((qp + s->current_picture.qscale_table[top_xy ] + 1)>>1) <= qp_thresh)){
if(!FRAME_MBAFF)
return 1;
- if( (left_xy[0]< 0 || ((qp + s->current_picture.qscale_table[left_xy[1] ] + 1)>>1) <= qp_thresh)
- && (top_xy < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy -s->mb_stride] + 1)>>1) <= qp_thresh))
+ if( (left_xy[LTOP]< 0 || ((qp + s->current_picture.qscale_table[left_xy[LBOT] ] + 1)>>1) <= qp_thresh)
+ && (top_xy < s->mb_stride || ((qp + s->current_picture.qscale_table[top_xy -s->mb_stride] + 1)>>1) <= qp_thresh))
return 1;
}
}
- top_type = s->current_picture.mb_type[top_xy] ;
- left_type[0] = s->current_picture.mb_type[left_xy[0]];
- left_type[1] = s->current_picture.mb_type[left_xy[1]];
+ top_type = s->current_picture.mb_type[top_xy];
+ left_type[LTOP] = s->current_picture.mb_type[left_xy[LTOP]];
+ left_type[LBOT] = s->current_picture.mb_type[left_xy[LBOT]];
if(h->deblocking_filter == 2){
- if(h->slice_table[top_xy ] != h->slice_num) top_type= 0;
- if(h->slice_table[left_xy[0] ] != h->slice_num) left_type[0]= left_type[1]= 0;
+ if(h->slice_table[top_xy ] != h->slice_num) top_type= 0;
+ if(h->slice_table[left_xy[LBOT]] != h->slice_num) left_type[LTOP]= left_type[LBOT]= 0;
}else{
- if(h->slice_table[top_xy ] == 0xFFFF) top_type= 0;
- if(h->slice_table[left_xy[0] ] == 0xFFFF) left_type[0]= left_type[1] =0;
+ if(h->slice_table[top_xy ] == 0xFFFF) top_type= 0;
+ if(h->slice_table[left_xy[LBOT]] == 0xFFFF) left_type[LTOP]= left_type[LBOT] =0;
}
- h->top_type = top_type ;
- h->left_type[0]= left_type[0];
- h->left_type[1]= left_type[1];
+ h->top_type = top_type;
+ h->left_type[LTOP]= left_type[LTOP];
+ h->left_type[LBOT]= left_type[LBOT];
if(IS_INTRA(mb_type))
return 0;
- AV_COPY32(&h->non_zero_count_cache[4+8* 1], &h->non_zero_count[mb_xy][ 0]);
- AV_COPY32(&h->non_zero_count_cache[4+8* 2], &h->non_zero_count[mb_xy][ 4]);
- AV_COPY32(&h->non_zero_count_cache[4+8* 3], &h->non_zero_count[mb_xy][ 8]);
- AV_COPY32(&h->non_zero_count_cache[4+8* 4], &h->non_zero_count[mb_xy][12]);
+ fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 0);
+ if(h->list_count == 2)
+ fill_filter_caches_inter(h, s, mb_type, top_xy, left_xy, top_type, left_type, mb_xy, 1);
+ nnz = h->non_zero_count[mb_xy];
+ nnz_cache = h->non_zero_count_cache;
+ AV_COPY32(&nnz_cache[4+8*1], &nnz[ 0]);
+ AV_COPY32(&nnz_cache[4+8*2], &nnz[ 4]);
+ AV_COPY32(&nnz_cache[4+8*3], &nnz[ 8]);
+ AV_COPY32(&nnz_cache[4+8*4], &nnz[12]);
h->cbp= h->cbp_table[mb_xy];
- {
- int list;
- for(list=0; list<h->list_count; list++){
- int8_t *ref;
- int y, b_stride;
- int16_t (*mv_dst)[2];
- int16_t (*mv_src)[2];
-
- if(!USES_LIST(mb_type, list)){
- fill_rectangle( h->mv_cache[list][scan8[0]], 4, 4, 8, pack16to32(0,0), 4);
- AV_WN32A(&h->ref_cache[list][scan8[ 0]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&h->ref_cache[list][scan8[ 2]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&h->ref_cache[list][scan8[ 8]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- AV_WN32A(&h->ref_cache[list][scan8[10]], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- continue;
- }
-
- ref = &s->current_picture.ref_index[list][4*mb_xy];
- {
- int (*ref2frm)[64] = h->ref2frm[ h->slice_num&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- AV_WN32A(&h->ref_cache[list][scan8[ 0]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
- AV_WN32A(&h->ref_cache[list][scan8[ 2]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
- ref += 2;
- AV_WN32A(&h->ref_cache[list][scan8[ 8]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
- AV_WN32A(&h->ref_cache[list][scan8[10]], (pack16to32(ref2frm[list][ref[0]],ref2frm[list][ref[1]])&0x00FF00FF)*0x0101);
- }
-
- b_stride = h->b_stride;
- mv_dst = &h->mv_cache[list][scan8[0]];
- mv_src = &s->current_picture.motion_val[list][4*s->mb_x + 4*s->mb_y*b_stride];
- for(y=0; y<4; y++){
- AV_COPY128(mv_dst + 8*y, mv_src + y*b_stride);
- }
-
- }
- }
-
-
-/*
-0 . T T. T T T T
-1 L . .L . . . .
-2 L . .L . . . .
-3 . T TL . . . .
-4 L . .L . . . .
-5 L . .. . . . .
-*/
-//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec)
if(top_type){
- AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][3*4]);
+ nnz = h->non_zero_count[top_xy];
+ AV_COPY32(&nnz_cache[4+8*0], &nnz[3*4]);
}
- if(left_type[0]){
- h->non_zero_count_cache[3+8*1]= h->non_zero_count[left_xy[0]][3+0*4];
- h->non_zero_count_cache[3+8*2]= h->non_zero_count[left_xy[0]][3+1*4];
- h->non_zero_count_cache[3+8*3]= h->non_zero_count[left_xy[0]][3+2*4];
- h->non_zero_count_cache[3+8*4]= h->non_zero_count[left_xy[0]][3+3*4];
+ if(left_type[LTOP]){
+ nnz = h->non_zero_count[left_xy[LTOP]];
+ nnz_cache[3+8*1]= nnz[3+0*4];
+ nnz_cache[3+8*2]= nnz[3+1*4];
+ nnz_cache[3+8*3]= nnz[3+2*4];
+ nnz_cache[3+8*4]= nnz[3+3*4];
}
// CAVLC 8x8dct requires NNZ values for residual decoding that differ from what the loop filter needs
if(!CABAC && h->pps.transform_8x8_mode){
if(IS_8x8DCT(top_type)){
- h->non_zero_count_cache[4+8*0]=
- h->non_zero_count_cache[5+8*0]= (h->cbp_table[top_xy] & 0x4000) >> 12;
- h->non_zero_count_cache[6+8*0]=
- h->non_zero_count_cache[7+8*0]= (h->cbp_table[top_xy] & 0x8000) >> 12;
+ nnz_cache[4+8*0]=
+ nnz_cache[5+8*0]= (h->cbp_table[top_xy] & 0x4000) >> 12;
+ nnz_cache[6+8*0]=
+ nnz_cache[7+8*0]= (h->cbp_table[top_xy] & 0x8000) >> 12;
}
- if(IS_8x8DCT(left_type[0])){
- h->non_zero_count_cache[3+8*1]=
- h->non_zero_count_cache[3+8*2]= (h->cbp_table[left_xy[0]]&0x2000) >> 12; //FIXME check MBAFF
+ if(IS_8x8DCT(left_type[LTOP])){
+ nnz_cache[3+8*1]=
+ nnz_cache[3+8*2]= (h->cbp_table[left_xy[LTOP]]&0x2000) >> 12; //FIXME check MBAFF
}
- if(IS_8x8DCT(left_type[1])){
- h->non_zero_count_cache[3+8*3]=
- h->non_zero_count_cache[3+8*4]= (h->cbp_table[left_xy[1]]&0x8000) >> 12; //FIXME check MBAFF
+ if(IS_8x8DCT(left_type[LBOT])){
+ nnz_cache[3+8*3]=
+ nnz_cache[3+8*4]= (h->cbp_table[left_xy[LBOT]]&0x8000) >> 12; //FIXME check MBAFF
}
if(IS_8x8DCT(mb_type)){
- h->non_zero_count_cache[scan8[0 ]]= h->non_zero_count_cache[scan8[1 ]]=
- h->non_zero_count_cache[scan8[2 ]]= h->non_zero_count_cache[scan8[3 ]]= (h->cbp & 0x1000) >> 12;
-
- h->non_zero_count_cache[scan8[0+ 4]]= h->non_zero_count_cache[scan8[1+ 4]]=
- h->non_zero_count_cache[scan8[2+ 4]]= h->non_zero_count_cache[scan8[3+ 4]]= (h->cbp & 0x2000) >> 12;
+ nnz_cache[scan8[0 ]]= nnz_cache[scan8[1 ]]=
+ nnz_cache[scan8[2 ]]= nnz_cache[scan8[3 ]]= (h->cbp & 0x1000) >> 12;
- h->non_zero_count_cache[scan8[0+ 8]]= h->non_zero_count_cache[scan8[1+ 8]]=
- h->non_zero_count_cache[scan8[2+ 8]]= h->non_zero_count_cache[scan8[3+ 8]]= (h->cbp & 0x4000) >> 12;
-
- h->non_zero_count_cache[scan8[0+12]]= h->non_zero_count_cache[scan8[1+12]]=
- h->non_zero_count_cache[scan8[2+12]]= h->non_zero_count_cache[scan8[3+12]]= (h->cbp & 0x8000) >> 12;
- }
- }
+ nnz_cache[scan8[0+ 4]]= nnz_cache[scan8[1+ 4]]=
+ nnz_cache[scan8[2+ 4]]= nnz_cache[scan8[3+ 4]]= (h->cbp & 0x2000) >> 12;
- if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){
- int list;
- for(list=0; list<h->list_count; list++){
- if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
- const int b8_xy= 4*top_xy + 2;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[top_xy]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
- h->ref_cache[list][scan8[0] + 0 - 1*8]=
- h->ref_cache[list][scan8[0] + 1 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 0]];
- h->ref_cache[list][scan8[0] + 2 - 1*8]=
- h->ref_cache[list][scan8[0] + 3 - 1*8]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 1]];
- }else{
- AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
- AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((LIST_NOT_USED)&0xFF)*0x01010101u);
- }
+ nnz_cache[scan8[0+ 8]]= nnz_cache[scan8[1+ 8]]=
+ nnz_cache[scan8[2+ 8]]= nnz_cache[scan8[3+ 8]]= (h->cbp & 0x4000) >> 12;
- if(!IS_INTERLACED(mb_type^left_type[0])){
- if(USES_LIST(left_type[0], list)){
- const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
- const int b8_xy= 4*left_xy[0] + 1;
- int (*ref2frm)[64] = h->ref2frm[ h->slice_table[left_xy[0]]&(MAX_SLICES-1) ][0] + (MB_MBAFF ? 20 : 2);
- AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 0 ], s->current_picture.motion_val[list][b_xy + h->b_stride*0]);
- AV_COPY32(h->mv_cache[list][scan8[0] - 1 + 8 ], s->current_picture.motion_val[list][b_xy + h->b_stride*1]);
- AV_COPY32(h->mv_cache[list][scan8[0] - 1 +16 ], s->current_picture.motion_val[list][b_xy + h->b_stride*2]);
- AV_COPY32(h->mv_cache[list][scan8[0] - 1 +24 ], s->current_picture.motion_val[list][b_xy + h->b_stride*3]);
- h->ref_cache[list][scan8[0] - 1 + 0 ]=
- h->ref_cache[list][scan8[0] - 1 + 8 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*0]];
- h->ref_cache[list][scan8[0] - 1 +16 ]=
- h->ref_cache[list][scan8[0] - 1 +24 ]= ref2frm[list][s->current_picture.ref_index[list][b8_xy + 2*1]];
- }else{
- AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 0 ]);
- AV_ZERO32(h->mv_cache [list][scan8[0] - 1 + 8 ]);
- AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +16 ]);
- AV_ZERO32(h->mv_cache [list][scan8[0] - 1 +24 ]);
- h->ref_cache[list][scan8[0] - 1 + 0 ]=
- h->ref_cache[list][scan8[0] - 1 + 8 ]=
- h->ref_cache[list][scan8[0] - 1 + 16 ]=
- h->ref_cache[list][scan8[0] - 1 + 24 ]= LIST_NOT_USED;
- }
- }
+ nnz_cache[scan8[0+12]]= nnz_cache[scan8[1+12]]=
+ nnz_cache[scan8[2+12]]= nnz_cache[scan8[3+12]]= (h->cbp & 0x8000) >> 12;
}
}
@@ -3556,7 +3509,6 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg){
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
#endif
- return -1; //not reached
}
/**
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 7bad91b..1f20d40 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -70,6 +70,10 @@
#define MB_FIELD h->mb_field_decoding_flag
#define FRAME_MBAFF h->mb_aff_frame
#define FIELD_PICTURE (s->picture_structure != PICT_FRAME)
+#define LEFT_MBS 2
+#define LTOP 0
+#define LBOT 1
+#define LEFT(i) (i)
#else
#define MB_MBAFF 0
#define MB_FIELD 0
@@ -77,6 +81,10 @@
#define FIELD_PICTURE 0
#undef IS_INTERLACED
#define IS_INTERLACED(mb_type) 0
+#define LEFT_MBS 1
+#define LTOP 0
+#define LBOT 0
+#define LEFT(i) 0
#endif
#define FIELD_OR_MBAFF_PICTURE (FRAME_MBAFF || FIELD_PICTURE)
@@ -272,12 +280,12 @@ typedef struct H264Context{
int topleft_mb_xy;
int top_mb_xy;
int topright_mb_xy;
- int left_mb_xy[2];
+ int left_mb_xy[LEFT_MBS];
int topleft_type;
int top_type;
int topright_type;
- int left_type[2];
+ int left_type[LEFT_MBS];
const uint8_t * left_block;
int topleft_partition;
@@ -308,11 +316,6 @@ typedef struct H264Context{
#define PART_NOT_AVAILABLE -2
/**
- * is 1 if the specific list MV&references are set to 0,0,-2.
- */
- int mv_cache_clean[2];
-
- /**
* number of neighbors (top and/or left) that used 8x8 dct
*/
int neighbor_transform_size;
@@ -507,7 +510,7 @@ typedef struct H264Context{
int cabac_init_idc;
/**
- * @defgroup multithreading Members for slice based multithreading
+ * @name Members for slice based multithreading
* @{
*/
struct H264Context *thread_context[MAX_THREADS];
@@ -658,7 +661,6 @@ int ff_h264_check_intra4x4_pred_mode(H264Context *h);
*/
int ff_h264_check_intra_pred_mode(H264Context *h, int mode);
-void ff_h264_write_back_intra_pred_mode(H264Context *h);
void ff_h264_hl_decode_mb(H264Context *h);
int ff_h264_frame_start(H264Context *h);
int ff_h264_decode_extradata(H264Context *h);
@@ -764,16 +766,16 @@ static av_always_inline uint16_t pack8to16(int a, int b){
/**
* gets the chroma qp.
*/
-static inline int get_chroma_qp(H264Context *h, int t, int qscale){
+static av_always_inline int get_chroma_qp(H264Context *h, int t, int qscale){
return h->pps.chroma_qp_table[t][qscale];
}
-static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my);
+static av_always_inline void pred_pskip_motion(H264Context * const h);
static void fill_decode_neighbors(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
const int mb_xy= h->mb_xy;
- int topleft_xy, top_xy, topright_xy, left_xy[2];
+ int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS];
static const uint8_t left_block_options[4][32]={
{0,1,2,3,7,10,8,11,3+0*4, 3+1*4, 3+2*4, 3+3*4, 1+4*4, 1+8*4, 1+5*4, 1+9*4},
{2,2,3,3,8,11,8,11,3+2*4, 3+2*4, 3+3*4, 3+3*4, 1+5*4, 1+9*4, 1+5*4, 1+9*4},
@@ -790,16 +792,16 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
topleft_xy = top_xy - 1;
topright_xy= top_xy + 1;
- left_xy[1] = left_xy[0] = mb_xy-1;
+ left_xy[LBOT] = left_xy[LTOP] = mb_xy-1;
h->left_block = left_block_options[0];
if(FRAME_MBAFF){
const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
const int curr_mb_field_flag = IS_INTERLACED(mb_type);
if(s->mb_y&1){
if (left_mb_field_flag != curr_mb_field_flag) {
- left_xy[1] = left_xy[0] = mb_xy - s->mb_stride - 1;
+ left_xy[LBOT] = left_xy[LTOP] = mb_xy - s->mb_stride - 1;
if (curr_mb_field_flag) {
- left_xy[1] += s->mb_stride;
+ left_xy[LBOT] += s->mb_stride;
h->left_block = left_block_options[3];
} else {
topleft_xy += s->mb_stride;
@@ -816,7 +818,7 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
}
if (left_mb_field_flag != curr_mb_field_flag) {
if (curr_mb_field_flag) {
- left_xy[1] += s->mb_stride;
+ left_xy[LBOT] += s->mb_stride;
h->left_block = left_block_options[3];
} else {
h->left_block = left_block_options[2];
@@ -828,25 +830,25 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
h->topleft_mb_xy = topleft_xy;
h->top_mb_xy = top_xy;
h->topright_mb_xy= topright_xy;
- h->left_mb_xy[0] = left_xy[0];
- h->left_mb_xy[1] = left_xy[1];
+ h->left_mb_xy[LTOP] = left_xy[LTOP];
+ h->left_mb_xy[LBOT] = left_xy[LBOT];
//FIXME do we need all in the context?
h->topleft_type = s->current_picture.mb_type[topleft_xy] ;
h->top_type = s->current_picture.mb_type[top_xy] ;
h->topright_type= s->current_picture.mb_type[topright_xy];
- h->left_type[0] = s->current_picture.mb_type[left_xy[0]] ;
- h->left_type[1] = s->current_picture.mb_type[left_xy[1]] ;
+ h->left_type[LTOP] = s->current_picture.mb_type[left_xy[LTOP]] ;
+ h->left_type[LBOT] = s->current_picture.mb_type[left_xy[LBOT]] ;
if(FMO){
- if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0;
- if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
- if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
+ if(h->slice_table[topleft_xy ] != h->slice_num) h->topleft_type = 0;
+ if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
+ if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0;
}else{
if(h->slice_table[topleft_xy ] != h->slice_num){
h->topleft_type = 0;
- if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
- if(h->slice_table[left_xy[0] ] != h->slice_num) h->left_type[0] = h->left_type[1] = 0;
+ if(h->slice_table[top_xy ] != h->slice_num) h->top_type = 0;
+ if(h->slice_table[left_xy[LTOP] ] != h->slice_num) h->left_type[LTOP] = h->left_type[LBOT] = 0;
}
}
if(h->slice_table[topright_xy] != h->slice_num) h->topright_type= 0;
@@ -854,21 +856,23 @@ static void fill_decode_neighbors(H264Context *h, int mb_type){
static void fill_decode_caches(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
- int topleft_xy, top_xy, topright_xy, left_xy[2];
- int topleft_type, top_type, topright_type, left_type[2];
+ int topleft_xy, top_xy, topright_xy, left_xy[LEFT_MBS];
+ int topleft_type, top_type, topright_type, left_type[LEFT_MBS];
const uint8_t * left_block= h->left_block;
int i;
-
- topleft_xy = h->topleft_mb_xy ;
- top_xy = h->top_mb_xy ;
- topright_xy = h->topright_mb_xy;
- left_xy[0] = h->left_mb_xy[0] ;
- left_xy[1] = h->left_mb_xy[1] ;
- topleft_type = h->topleft_type ;
- top_type = h->top_type ;
- topright_type= h->topright_type ;
- left_type[0] = h->left_type[0] ;
- left_type[1] = h->left_type[1] ;
+ uint8_t *nnz;
+ uint8_t *nnz_cache;
+
+ topleft_xy = h->topleft_mb_xy;
+ top_xy = h->top_mb_xy;
+ topright_xy = h->topright_mb_xy;
+ left_xy[LTOP] = h->left_mb_xy[LTOP];
+ left_xy[LBOT] = h->left_mb_xy[LBOT];
+ topleft_type = h->topleft_type;
+ top_type = h->top_type;
+ topright_type = h->topright_type;
+ left_type[LTOP]= h->left_type[LTOP];
+ left_type[LBOT]= h->left_type[LBOT];
if(!IS_SKIP(mb_type)){
if(IS_INTRA(mb_type)){
@@ -883,27 +887,27 @@ static void fill_decode_caches(H264Context *h, int mb_type){
h->top_samples_available= 0x33FF;
h->topright_samples_available= 0x26EA;
}
- if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
+ if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[LTOP])){
if(IS_INTERLACED(mb_type)){
- if(!(left_type[0] & type_mask)){
+ if(!(left_type[LTOP] & type_mask)){
h->topleft_samples_available&= 0xDFFF;
h->left_samples_available&= 0x5FFF;
}
- if(!(left_type[1] & type_mask)){
+ if(!(left_type[LBOT] & type_mask)){
h->topleft_samples_available&= 0xFF5F;
h->left_samples_available&= 0xFF5F;
}
}else{
- int left_typei = s->current_picture.mb_type[left_xy[0] + s->mb_stride];
+ int left_typei = s->current_picture.mb_type[left_xy[LTOP] + s->mb_stride];
- assert(left_xy[0] == left_xy[1]);
- if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
+ assert(left_xy[LTOP] == left_xy[LBOT]);
+ if(!((left_typei & type_mask) && (left_type[LTOP] & type_mask))){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
}
}else{
- if(!(left_type[0] & type_mask)){
+ if(!(left_type[LTOP] & type_mask)){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
@@ -925,13 +929,13 @@ static void fill_decode_caches(H264Context *h, int mb_type){
h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
}
for(i=0; i<2; i++){
- if(IS_INTRA4x4(left_type[i])){
- int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
+ if(IS_INTRA4x4(left_type[LEFT(i)])){
+ int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[LEFT(i)]];
h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
}else{
h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
- h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask);
+ h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[LEFT(i)] & type_mask);
}
}
}
@@ -947,42 +951,45 @@ static void fill_decode_caches(H264Context *h, int mb_type){
5 L . .. . . . .
*/
//FIXME constraint_intra_pred & partitioning & nnz (let us hope this is just a typo in the spec)
+ nnz_cache = h->non_zero_count_cache;
if(top_type){
- AV_COPY32(&h->non_zero_count_cache[4+8* 0], &h->non_zero_count[top_xy][4*3]);
+ nnz = h->non_zero_count[top_xy];
+ AV_COPY32(&nnz_cache[4+8* 0], &nnz[4*3]);
if(CHROMA444){
- AV_COPY32(&h->non_zero_count_cache[4+8* 5], &h->non_zero_count[top_xy][4* 7]);
- AV_COPY32(&h->non_zero_count_cache[4+8*10], &h->non_zero_count[top_xy][4*11]);
+ AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 7]);
+ AV_COPY32(&nnz_cache[4+8*10], &nnz[4*11]);
}else{
- AV_COPY32(&h->non_zero_count_cache[4+8* 5], &h->non_zero_count[top_xy][4* 5]);
- AV_COPY32(&h->non_zero_count_cache[4+8*10], &h->non_zero_count[top_xy][4* 9]);
+ AV_COPY32(&nnz_cache[4+8* 5], &nnz[4* 5]);
+ AV_COPY32(&nnz_cache[4+8*10], &nnz[4* 9]);
}
}else{
uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
- AV_WN32A(&h->non_zero_count_cache[4+8* 0], top_empty);
- AV_WN32A(&h->non_zero_count_cache[4+8* 5], top_empty);
- AV_WN32A(&h->non_zero_count_cache[4+8*10], top_empty);
+ AV_WN32A(&nnz_cache[4+8* 0], top_empty);
+ AV_WN32A(&nnz_cache[4+8* 5], top_empty);
+ AV_WN32A(&nnz_cache[4+8*10], top_empty);
}
for (i=0; i<2; i++) {
- if(left_type[i]){
- h->non_zero_count_cache[3+8* 1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
- h->non_zero_count_cache[3+8* 2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
+ if(left_type[LEFT(i)]){
+ nnz = h->non_zero_count[left_xy[LEFT(i)]];
+ nnz_cache[3+8* 1 + 2*8*i]= nnz[left_block[8+0+2*i]];
+ nnz_cache[3+8* 2 + 2*8*i]= nnz[left_block[8+1+2*i]];
if(CHROMA444){
- h->non_zero_count_cache[3+8* 6 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]+4*4];
- h->non_zero_count_cache[3+8* 7 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]+4*4];
- h->non_zero_count_cache[3+8*11 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]+8*4];
- h->non_zero_count_cache[3+8*12 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]+8*4];
+ nnz_cache[3+8* 6 + 2*8*i]= nnz[left_block[8+0+2*i]+4*4];
+ nnz_cache[3+8* 7 + 2*8*i]= nnz[left_block[8+1+2*i]+4*4];
+ nnz_cache[3+8*11 + 2*8*i]= nnz[left_block[8+0+2*i]+8*4];
+ nnz_cache[3+8*12 + 2*8*i]= nnz[left_block[8+1+2*i]+8*4];
}else{
- h->non_zero_count_cache[3+8* 6 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
- h->non_zero_count_cache[3+8*11 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
+ nnz_cache[3+8* 6 + 8*i]= nnz[left_block[8+4+2*i]];
+ nnz_cache[3+8*11 + 8*i]= nnz[left_block[8+5+2*i]];
}
}else{
- h->non_zero_count_cache[3+8* 1 + 2*8*i]=
- h->non_zero_count_cache[3+8* 2 + 2*8*i]=
- h->non_zero_count_cache[3+8* 6 + 2*8*i]=
- h->non_zero_count_cache[3+8* 7 + 2*8*i]=
- h->non_zero_count_cache[3+8*11 + 2*8*i]=
- h->non_zero_count_cache[3+8*12 + 2*8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
+ nnz_cache[3+8* 1 + 2*8*i]=
+ nnz_cache[3+8* 2 + 2*8*i]=
+ nnz_cache[3+8* 6 + 2*8*i]=
+ nnz_cache[3+8* 7 + 2*8*i]=
+ nnz_cache[3+8*11 + 2*8*i]=
+ nnz_cache[3+8*12 + 2*8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
}
}
@@ -994,10 +1001,10 @@ static void fill_decode_caches(H264Context *h, int mb_type){
h->top_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
}
// left_cbp
- if (left_type[0]) {
- h->left_cbp = (h->cbp_table[left_xy[0]] & 0x7F0)
- | ((h->cbp_table[left_xy[0]]>>(left_block[0]&(~1)))&2)
- | (((h->cbp_table[left_xy[1]]>>(left_block[2]&(~1)))&2) << 2);
+ if (left_type[LTOP]) {
+ h->left_cbp = (h->cbp_table[left_xy[LTOP]] & 0x7F0)
+ | ((h->cbp_table[left_xy[LTOP]]>>(left_block[0]&(~1)))&2)
+ | (((h->cbp_table[left_xy[LBOT]]>>(left_block[2]&(~1)))&2) << 2);
} else {
h->left_cbp = IS_INTRA(mb_type) ? 0x7CF : 0x00F;
}
@@ -1006,144 +1013,145 @@ static void fill_decode_caches(H264Context *h, int mb_type){
if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
int list;
+ int b_stride = h->b_stride;
for(list=0; list<h->list_count; list++){
+ int8_t *ref_cache = &h->ref_cache[list][scan8[0]];
+ int8_t *ref = s->current_picture.ref_index[list];
+ int16_t (*mv_cache)[2] = &h->mv_cache[list][scan8[0]];
+ int16_t (*mv)[2] = s->current_picture.motion_val[list];
if(!USES_LIST(mb_type, list)){
- /*if(!h->mv_cache_clean[list]){
- memset(h->mv_cache [list], 0, 8*5*2*sizeof(int16_t)); //FIXME clean only input? clean at all?
- memset(h->ref_cache[list], PART_NOT_AVAILABLE, 8*5*sizeof(int8_t));
- h->mv_cache_clean[list]= 1;
- }*/
continue;
}
assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
- h->mv_cache_clean[list]= 0;
-
if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
- AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
- h->ref_cache[list][scan8[0] + 0 - 1*8]=
- h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 2];
- h->ref_cache[list][scan8[0] + 2 - 1*8]=
- h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][4*top_xy + 3];
+ const int b_xy= h->mb2b_xy[top_xy] + 3*b_stride;
+ AV_COPY128(mv_cache[0 - 1*8], mv[b_xy + 0]);
+ ref_cache[0 - 1*8]=
+ ref_cache[1 - 1*8]= ref[4*top_xy + 2];
+ ref_cache[2 - 1*8]=
+ ref_cache[3 - 1*8]= ref[4*top_xy + 3];
}else{
- AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
- AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
+ AV_ZERO128(mv_cache[0 - 1*8]);
+ AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
}
if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){
for(i=0; i<2; i++){
- int cache_idx = scan8[0] - 1 + i*2*8;
- if(USES_LIST(left_type[i], list)){
- const int b_xy= h->mb2b_xy[left_xy[i]] + 3;
- const int b8_xy= 4*left_xy[i] + 1;
- AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]);
- AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]);
- h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + (left_block[0+i*2]&~1)];
- h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + (left_block[1+i*2]&~1)];
+ int cache_idx = -1 + i*2*8;
+ if(USES_LIST(left_type[LEFT(i)], list)){
+ const int b_xy= h->mb2b_xy[left_xy[LEFT(i)]] + 3;
+ const int b8_xy= 4*left_xy[LEFT(i)] + 1;
+ AV_COPY32(mv_cache[cache_idx ], mv[b_xy + b_stride*left_block[0+i*2]]);
+ AV_COPY32(mv_cache[cache_idx+8], mv[b_xy + b_stride*left_block[1+i*2]]);
+ ref_cache[cache_idx ]= ref[b8_xy + (left_block[0+i*2]&~1)];
+ ref_cache[cache_idx+8]= ref[b8_xy + (left_block[1+i*2]&~1)];
}else{
- AV_ZERO32(h->mv_cache [list][cache_idx ]);
- AV_ZERO32(h->mv_cache [list][cache_idx+8]);
- h->ref_cache[list][cache_idx ]=
- h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[cache_idx ]);
+ AV_ZERO32(mv_cache[cache_idx+8]);
+ ref_cache[cache_idx ]=
+ ref_cache[cache_idx+8]= (left_type[LEFT(i)]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
}
}else{
- if(USES_LIST(left_type[0], list)){
- const int b_xy= h->mb2b_xy[left_xy[0]] + 3;
- const int b8_xy= 4*left_xy[0] + 1;
- AV_COPY32(h->mv_cache[list][scan8[0] - 1], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0]]);
- h->ref_cache[list][scan8[0] - 1]= s->current_picture.ref_index[list][b8_xy + (left_block[0]&~1)];
+ if(USES_LIST(left_type[LTOP], list)){
+ const int b_xy= h->mb2b_xy[left_xy[LTOP]] + 3;
+ const int b8_xy= 4*left_xy[LTOP] + 1;
+ AV_COPY32(mv_cache[-1], mv[b_xy + b_stride*left_block[0]]);
+ ref_cache[-1]= ref[b8_xy + (left_block[0]&~1)];
}else{
- AV_ZERO32(h->mv_cache [list][scan8[0] - 1]);
- h->ref_cache[list][scan8[0] - 1]= left_type[0] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[-1]);
+ ref_cache[-1]= left_type[LTOP] ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
}
if(USES_LIST(topright_type, list)){
- const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride;
- AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]);
- h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][4*topright_xy + 2];
+ const int b_xy= h->mb2b_xy[topright_xy] + 3*b_stride;
+ AV_COPY32(mv_cache[4 - 1*8], mv[b_xy]);
+ ref_cache[4 - 1*8]= ref[4*topright_xy + 2];
}else{
- AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]);
- h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[4 - 1*8]);
+ ref_cache[4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
- if(h->ref_cache[list][scan8[0] + 4 - 1*8] < 0){
+ if(ref_cache[4 - 1*8] < 0){
if(USES_LIST(topleft_type, list)){
- const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride);
+ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride);
const int b8_xy= 4*topleft_xy + 1 + (h->topleft_partition & 2);
- AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]);
- h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
+ AV_COPY32(mv_cache[-1 - 1*8], mv[b_xy]);
+ ref_cache[-1 - 1*8]= ref[b8_xy];
}else{
- AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]);
- h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[-1 - 1*8]);
+ ref_cache[-1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
}
if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
continue;
- if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) {
- h->ref_cache[list][scan8[4 ]] =
- h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
- AV_ZERO32(h->mv_cache [list][scan8[4 ]]);
- AV_ZERO32(h->mv_cache [list][scan8[12]]);
-
- if( CABAC ) {
- /* XXX beurk, Load mvd */
- if(USES_LIST(top_type, list)){
- const int b_xy= h->mb2br_xy[top_xy];
- AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
- }else{
- AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
- }
- if(USES_LIST(left_type[0], list)){
- const int b_xy= h->mb2br_xy[left_xy[0]] + 6;
- AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]);
- AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]);
- }else{
- AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]);
- AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]);
- }
- if(USES_LIST(left_type[1], list)){
- const int b_xy= h->mb2br_xy[left_xy[1]] + 6;
- AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]);
- AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]);
- }else{
- AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]);
- AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]);
- }
- AV_ZERO16(h->mvd_cache [list][scan8[4 ]]);
- AV_ZERO16(h->mvd_cache [list][scan8[12]]);
- if(h->slice_type_nos == AV_PICTURE_TYPE_B){
- fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1);
-
- if(IS_DIRECT(top_type)){
- AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1));
- }else if(IS_8X8(top_type)){
- int b8_xy = 4*top_xy;
- h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2];
- h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3];
+ if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))){
+ uint8_t (*mvd_cache)[2] = &h->mvd_cache[list][scan8[0]];
+ uint8_t (*mvd)[2] = h->mvd_table[list];
+ ref_cache[2+8*0] =
+ ref_cache[2+8*2] = PART_NOT_AVAILABLE;
+ AV_ZERO32(mv_cache[2+8*0]);
+ AV_ZERO32(mv_cache[2+8*2]);
+
+ if( CABAC ) {
+ if(USES_LIST(top_type, list)){
+ const int b_xy= h->mb2br_xy[top_xy];
+ AV_COPY64(mvd_cache[0 - 1*8], mvd[b_xy + 0]);
}else{
- AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1));
+ AV_ZERO64(mvd_cache[0 - 1*8]);
+ }
+ if(USES_LIST(left_type[LTOP], list)){
+ const int b_xy= h->mb2br_xy[left_xy[LTOP]] + 6;
+ AV_COPY16(mvd_cache[-1 + 0*8], mvd[b_xy - left_block[0]]);
+ AV_COPY16(mvd_cache[-1 + 1*8], mvd[b_xy - left_block[1]]);
+ }else{
+ AV_ZERO16(mvd_cache[-1 + 0*8]);
+ AV_ZERO16(mvd_cache[-1 + 1*8]);
+ }
+ if(USES_LIST(left_type[LBOT], list)){
+ const int b_xy= h->mb2br_xy[left_xy[LBOT]] + 6;
+ AV_COPY16(mvd_cache[-1 + 2*8], mvd[b_xy - left_block[2]]);
+ AV_COPY16(mvd_cache[-1 + 3*8], mvd[b_xy - left_block[3]]);
+ }else{
+ AV_ZERO16(mvd_cache[-1 + 2*8]);
+ AV_ZERO16(mvd_cache[-1 + 3*8]);
+ }
+ AV_ZERO16(mvd_cache[2+8*0]);
+ AV_ZERO16(mvd_cache[2+8*2]);
+ if(h->slice_type_nos == AV_PICTURE_TYPE_B){
+ uint8_t *direct_cache = &h->direct_cache[scan8[0]];
+ uint8_t *direct_table = h->direct_table;
+ fill_rectangle(direct_cache, 4, 4, 8, MB_TYPE_16x16>>1, 1);
+
+ if(IS_DIRECT(top_type)){
+ AV_WN32A(&direct_cache[-1*8], 0x01010101u*(MB_TYPE_DIRECT2>>1));
+ }else if(IS_8X8(top_type)){
+ int b8_xy = 4*top_xy;
+ direct_cache[0 - 1*8]= direct_table[b8_xy + 2];
+ direct_cache[2 - 1*8]= direct_table[b8_xy + 3];
+ }else{
+ AV_WN32A(&direct_cache[-1*8], 0x01010101*(MB_TYPE_16x16>>1));
+ }
+
+ if(IS_DIRECT(left_type[LTOP]))
+ direct_cache[-1 + 0*8]= MB_TYPE_DIRECT2>>1;
+ else if(IS_8X8(left_type[LTOP]))
+ direct_cache[-1 + 0*8]= direct_table[4*left_xy[LTOP] + 1 + (left_block[0]&~1)];
+ else
+ direct_cache[-1 + 0*8]= MB_TYPE_16x16>>1;
+
+ if(IS_DIRECT(left_type[LBOT]))
+ direct_cache[-1 + 2*8]= MB_TYPE_DIRECT2>>1;
+ else if(IS_8X8(left_type[LBOT]))
+ direct_cache[-1 + 2*8]= direct_table[4*left_xy[LBOT] + 1 + (left_block[2]&~1)];
+ else
+ direct_cache[-1 + 2*8]= MB_TYPE_16x16>>1;
}
-
- if(IS_DIRECT(left_type[0]))
- h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1;
- else if(IS_8X8(left_type[0]))
- h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)];
- else
- h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1;
-
- if(IS_DIRECT(left_type[1]))
- h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1;
- else if(IS_8X8(left_type[1]))
- h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)];
- else
- h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1;
}
}
- }
if(FRAME_MBAFF){
#define MAP_MVS\
MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
@@ -1152,10 +1160,10 @@ static void fill_decode_caches(H264Context *h, int mb_type){
MAP_F2F(scan8[0] + 2 - 1*8, top_type)\
MAP_F2F(scan8[0] + 3 - 1*8, top_type)\
MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\
- MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\
- MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\
- MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\
- MAP_F2F(scan8[0] - 1 + 3*8, left_type[1])
+ MAP_F2F(scan8[0] - 1 + 0*8, left_type[LTOP])\
+ MAP_F2F(scan8[0] - 1 + 1*8, left_type[LTOP])\
+ MAP_F2F(scan8[0] - 1 + 2*8, left_type[LBOT])\
+ MAP_F2F(scan8[0] - 1 + 3*8, left_type[LBOT])
if(MB_FIELD){
#define MAP_F2F(idx, mb_type)\
if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
@@ -1179,13 +1187,13 @@ static void fill_decode_caches(H264Context *h, int mb_type){
}
}
- h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
+ h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[LTOP]);
}
/**
* gets the predicted intra4x4 prediction mode.
*/
-static inline int pred_intra_mode(H264Context *h, int n){
+static av_always_inline int pred_intra_mode(H264Context *h, int n){
const int index8= scan8[n];
const int left= h->intra4x4_pred_mode_cache[index8 - 1];
const int top = h->intra4x4_pred_mode_cache[index8 - 8];
@@ -1197,69 +1205,83 @@ static inline int pred_intra_mode(H264Context *h, int n){
else return min;
}
-static inline void write_back_non_zero_count(H264Context *h){
- const int mb_xy= h->mb_xy;
+static av_always_inline void write_back_intra_pred_mode(H264Context *h){
+ int8_t *i4x4= h->intra4x4_pred_mode + h->mb2br_xy[h->mb_xy];
+ int8_t *i4x4_cache= h->intra4x4_pred_mode_cache;
- AV_COPY32(&h->non_zero_count[mb_xy][ 0], &h->non_zero_count_cache[4+8* 1]);
- AV_COPY32(&h->non_zero_count[mb_xy][ 4], &h->non_zero_count_cache[4+8* 2]);
- AV_COPY32(&h->non_zero_count[mb_xy][ 8], &h->non_zero_count_cache[4+8* 3]);
- AV_COPY32(&h->non_zero_count[mb_xy][12], &h->non_zero_count_cache[4+8* 4]);
- AV_COPY32(&h->non_zero_count[mb_xy][16], &h->non_zero_count_cache[4+8* 6]);
- AV_COPY32(&h->non_zero_count[mb_xy][20], &h->non_zero_count_cache[4+8* 7]);
- AV_COPY32(&h->non_zero_count[mb_xy][32], &h->non_zero_count_cache[4+8*11]);
- AV_COPY32(&h->non_zero_count[mb_xy][36], &h->non_zero_count_cache[4+8*12]);
+ AV_COPY32(i4x4, i4x4_cache + 4 + 8*4);
+ i4x4[4]= i4x4_cache[7+8*3];
+ i4x4[5]= i4x4_cache[7+8*2];
+ i4x4[6]= i4x4_cache[7+8*1];
+}
+
+static av_always_inline void write_back_non_zero_count(H264Context *h){
+ const int mb_xy= h->mb_xy;
+ uint8_t *nnz = h->non_zero_count[mb_xy];
+ uint8_t *nnz_cache = h->non_zero_count_cache;
+
+ AV_COPY32(&nnz[ 0], &nnz_cache[4+8* 1]);
+ AV_COPY32(&nnz[ 4], &nnz_cache[4+8* 2]);
+ AV_COPY32(&nnz[ 8], &nnz_cache[4+8* 3]);
+ AV_COPY32(&nnz[12], &nnz_cache[4+8* 4]);
+ AV_COPY32(&nnz[16], &nnz_cache[4+8* 6]);
+ AV_COPY32(&nnz[20], &nnz_cache[4+8* 7]);
+ AV_COPY32(&nnz[32], &nnz_cache[4+8*11]);
+ AV_COPY32(&nnz[36], &nnz_cache[4+8*12]);
if(CHROMA444){
- AV_COPY32(&h->non_zero_count[mb_xy][24], &h->non_zero_count_cache[4+8* 8]);
- AV_COPY32(&h->non_zero_count[mb_xy][28], &h->non_zero_count_cache[4+8* 9]);
- AV_COPY32(&h->non_zero_count[mb_xy][40], &h->non_zero_count_cache[4+8*13]);
- AV_COPY32(&h->non_zero_count[mb_xy][44], &h->non_zero_count_cache[4+8*14]);
+ AV_COPY32(&nnz[24], &nnz_cache[4+8* 8]);
+ AV_COPY32(&nnz[28], &nnz_cache[4+8* 9]);
+ AV_COPY32(&nnz[40], &nnz_cache[4+8*13]);
+ AV_COPY32(&nnz[44], &nnz_cache[4+8*14]);
}
}
-static inline void write_back_motion(H264Context *h, int mb_type){
+static av_always_inline void write_back_motion_list(H264Context *h, MpegEncContext * const s, int b_stride,
+ int b_xy, int b8_xy, int mb_type, int list )
+{
+ int16_t (*mv_dst)[2] = &s->current_picture.motion_val[list][b_xy];
+ int16_t (*mv_src)[2] = &h->mv_cache[list][scan8[0]];
+ AV_COPY128(mv_dst + 0*b_stride, mv_src + 8*0);
+ AV_COPY128(mv_dst + 1*b_stride, mv_src + 8*1);
+ AV_COPY128(mv_dst + 2*b_stride, mv_src + 8*2);
+ AV_COPY128(mv_dst + 3*b_stride, mv_src + 8*3);
+ if( CABAC ) {
+ uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]];
+ uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
+ if(IS_SKIP(mb_type))
+ AV_ZERO128(mvd_dst);
+ else{
+ AV_COPY64(mvd_dst, mvd_src + 8*3);
+ AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0);
+ AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1);
+ AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2);
+ }
+ }
+
+ {
+ int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
+ int8_t *ref_cache = h->ref_cache[list];
+ ref_index[0+0*2]= ref_cache[scan8[0]];
+ ref_index[1+0*2]= ref_cache[scan8[4]];
+ ref_index[0+1*2]= ref_cache[scan8[8]];
+ ref_index[1+1*2]= ref_cache[scan8[12]];
+ }
+}
+
+static av_always_inline void write_back_motion(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
+ const int b_stride = h->b_stride;
const int b_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; //try mb2b(8)_xy
const int b8_xy= 4*h->mb_xy;
- int list;
- if(!USES_LIST(mb_type, 0))
+ if(USES_LIST(mb_type, 0)){
+ write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 0);
+ }else{
fill_rectangle(&s->current_picture.ref_index[0][b8_xy], 2, 2, 2, (uint8_t)LIST_NOT_USED, 1);
-
- for(list=0; list<h->list_count; list++){
- int y, b_stride;
- int16_t (*mv_dst)[2];
- int16_t (*mv_src)[2];
-
- if(!USES_LIST(mb_type, list))
- continue;
-
- b_stride = h->b_stride;
- mv_dst = &s->current_picture.motion_val[list][b_xy];
- mv_src = &h->mv_cache[list][scan8[0]];
- for(y=0; y<4; y++){
- AV_COPY128(mv_dst + y*b_stride, mv_src + 8*y);
- }
- if( CABAC ) {
- uint8_t (*mvd_dst)[2] = &h->mvd_table[list][FMO ? 8*h->mb_xy : h->mb2br_xy[h->mb_xy]];
- uint8_t (*mvd_src)[2] = &h->mvd_cache[list][scan8[0]];
- if(IS_SKIP(mb_type))
- AV_ZERO128(mvd_dst);
- else{
- AV_COPY64(mvd_dst, mvd_src + 8*3);
- AV_COPY16(mvd_dst + 3 + 3, mvd_src + 3 + 8*0);
- AV_COPY16(mvd_dst + 3 + 2, mvd_src + 3 + 8*1);
- AV_COPY16(mvd_dst + 3 + 1, mvd_src + 3 + 8*2);
- }
- }
-
- {
- int8_t *ref_index = &s->current_picture.ref_index[list][b8_xy];
- ref_index[0+0*2]= h->ref_cache[list][scan8[0]];
- ref_index[1+0*2]= h->ref_cache[list][scan8[4]];
- ref_index[0+1*2]= h->ref_cache[list][scan8[8]];
- ref_index[1+1*2]= h->ref_cache[list][scan8[12]];
- }
+ }
+ if(USES_LIST(mb_type, 1)){
+ write_back_motion_list(h, s, b_stride, b_xy, b8_xy, mb_type, 1);
}
if(h->slice_type_nos == AV_PICTURE_TYPE_B && CABAC){
@@ -1272,7 +1294,7 @@ static inline void write_back_motion(H264Context *h, int mb_type){
}
}
-static inline int get_dct8x8_allowed(H264Context *h){
+static av_always_inline int get_dct8x8_allowed(H264Context *h){
if(h->sps.direct_8x8_inference_flag)
return !(AV_RN64A(h->sub_mb_type) & ((MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8 )*0x0001000100010001ULL));
else
@@ -1305,14 +1327,10 @@ static void av_unused decode_mb_skip(H264Context *h){
}
else
{
- int mx, my;
mb_type|= MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P1L0|MB_TYPE_SKIP;
fill_decode_neighbors(h, mb_type);
- fill_decode_caches(h, mb_type); //FIXME check what is needed and what not ...
- pred_pskip_motion(h, &mx, &my);
- fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
- fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
+ pred_pskip_motion(h);
}
write_back_motion(h, mb_type);
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c
index 3975a61..ed019fe 100644
--- a/libavcodec/h264_cabac.c
+++ b/libavcodec/h264_cabac.c
@@ -1296,9 +1296,9 @@ static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_sl
if(intra_slice){
int ctx=0;
- if( h->left_type[0] & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
+ if( h->left_type[LTOP] & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
ctx++;
- if( h->top_type & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
+ if( h->top_type & (MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM))
ctx++;
if( get_cabac_noinline( &h->cabac, &state[ctx] ) == 0 )
return 0; /* I4x4 */
@@ -1376,10 +1376,10 @@ static int decode_cabac_mb_chroma_pre_mode( H264Context *h) {
int ctx = 0;
/* No need to test for IS_INTRA4x4 and IS_INTRA16x16, as we set chroma_pred_mode_table to 0 */
- if( h->left_type[0] && h->chroma_pred_mode_table[mba_xy] != 0 )
+ if( h->left_type[LTOP] && h->chroma_pred_mode_table[mba_xy] != 0 )
ctx++;
- if( h->top_type && h->chroma_pred_mode_table[mbb_xy] != 0 )
+ if( h->top_type && h->chroma_pred_mode_table[mbb_xy] != 0 )
ctx++;
if( get_cabac_noinline( &h->cabac, &h->cabac_state[64+ctx] ) == 0 )
@@ -1819,8 +1819,7 @@ static av_always_inline void decode_cabac_luma_residual( H264Context *h, const u
}
}
} else {
- uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8+16*p] ];
- nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0;
+ fill_rectangle(&h->non_zero_count_cache[scan8[4*i8x8+16*p]], 2, 2, 8, 0, 1);
}
}
}
@@ -1881,7 +1880,7 @@ int ff_h264_decode_mb_cabac(H264Context *h) {
int ctx = 0;
assert(h->slice_type_nos == AV_PICTURE_TYPE_B);
- if( !IS_DIRECT( h->left_type[0]-1 ) )
+ if( !IS_DIRECT( h->left_type[LTOP]-1 ) )
ctx++;
if( !IS_DIRECT( h->top_type-1 ) )
ctx++;
@@ -2000,7 +1999,7 @@ decode_intra_mb:
//av_log( s->avctx, AV_LOG_ERROR, "i4x4 pred=%d mode=%d\n", pred, h->intra4x4_pred_mode_cache[ scan8[i] ] );
}
}
- ff_h264_write_back_intra_pred_mode(h);
+ write_back_intra_pred_mode(h);
if( ff_h264_check_intra4x4_pred_mode(h) < 0 ) return -1;
} else {
h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode( h, h->intra16x16_pred_mode );
@@ -2249,21 +2248,22 @@ decode_intra_mb:
* the transform mode of the current macroblock there. */
if (CHROMA444 && IS_8x8DCT(mb_type)){
int i;
+ uint8_t *nnz_cache = h->non_zero_count_cache;
for (i = 0; i < 2; i++){
- if (h->left_type[i] && !IS_8x8DCT(h->left_type[i])){
- h->non_zero_count_cache[3+8* 1 + 2*8*i]=
- h->non_zero_count_cache[3+8* 2 + 2*8*i]=
- h->non_zero_count_cache[3+8* 6 + 2*8*i]=
- h->non_zero_count_cache[3+8* 7 + 2*8*i]=
- h->non_zero_count_cache[3+8*11 + 2*8*i]=
- h->non_zero_count_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
+ if (h->left_type[LEFT(i)] && !IS_8x8DCT(h->left_type[LEFT(i)])){
+ nnz_cache[3+8* 1 + 2*8*i]=
+ nnz_cache[3+8* 2 + 2*8*i]=
+ nnz_cache[3+8* 6 + 2*8*i]=
+ nnz_cache[3+8* 7 + 2*8*i]=
+ nnz_cache[3+8*11 + 2*8*i]=
+ nnz_cache[3+8*12 + 2*8*i]= IS_INTRA(mb_type) ? 64 : 0;
}
}
if (h->top_type && !IS_8x8DCT(h->top_type)){
uint32_t top_empty = CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040;
- AV_WN32A(&h->non_zero_count_cache[4+8* 0], top_empty);
- AV_WN32A(&h->non_zero_count_cache[4+8* 5], top_empty);
- AV_WN32A(&h->non_zero_count_cache[4+8*10], top_empty);
+ AV_WN32A(&nnz_cache[4+8* 0], top_empty);
+ AV_WN32A(&nnz_cache[4+8* 5], top_empty);
+ AV_WN32A(&nnz_cache[4+8*10], top_empty);
}
}
s->current_picture.mb_type[mb_xy]= mb_type;
diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c
index 0ddc430..27ab986 100644
--- a/libavcodec/h264_cavlc.c
+++ b/libavcodec/h264_cavlc.c
@@ -731,7 +731,7 @@ decode_intra_mb:
else
h->intra4x4_pred_mode_cache[ scan8[i] ] = mode;
}
- ff_h264_write_back_intra_pred_mode(h);
+ write_back_intra_pred_mode(h);
if( ff_h264_check_intra4x4_pred_mode(h) < 0)
return -1;
}else{
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c
index 226c2ae..49a4405 100644
--- a/libavcodec/h264_loopfilter.c
+++ b/libavcodec/h264_loopfilter.c
@@ -100,7 +100,7 @@ static const uint8_t tc0_table[52*3][4] = {
{-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 }, {-1,13,17,25 },
};
-static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h) {
+static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
@@ -118,7 +118,7 @@ static void av_always_inline filter_mb_edgev( uint8_t *pix, int stride, int16_t
h->h264dsp.h264_h_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
-static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
+static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
@@ -137,7 +137,7 @@ static void av_always_inline filter_mb_edgecv( uint8_t *pix, int stride, int16_t
}
}
-static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[7], int bsi, int qp ) {
+static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
@@ -155,7 +155,7 @@ static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int
h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);
}
}
-static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, int16_t bS[7], int bsi, int qp ) {
+static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
@@ -174,7 +174,7 @@ static void filter_mb_mbaff_edgecv( H264Context *h, uint8_t *pix, int stride, in
}
}
-static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
+static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
@@ -193,7 +193,7 @@ static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, int16_t
}
}
-static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t bS[4], unsigned int qp, H264Context *h ) {
+static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
@@ -215,19 +215,20 @@ static void av_always_inline filter_mb_edgech( uint8_t *pix, int stride, int16_t
void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize) {
MpegEncContext * const s = &h->s;
int mb_xy;
- int mb_type, left_type;
- int qp, qp0, qp1, qpc, qpc0, qpc1, qp_thresh;
+ int mb_type, left_type, top_type;
+ int qp, qp0, qp1, qpc, qpc0, qpc1;
int chroma = !(CONFIG_GRAY && (s->flags&CODEC_FLAG_GRAY));
int chroma444 = CHROMA444;
mb_xy = h->mb_xy;
- if(!h->top_type || !h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
+ if(!h->h264dsp.h264_loop_filter_strength || h->pps.chroma_qp_diff) {
ff_h264_filter_mb(h, mb_x, mb_y, img_y, img_cb, img_cr, linesize, uvlinesize);
return;
}
assert(!FRAME_MBAFF);
- left_type= h->left_type[0];
+ left_type= h->left_type[LTOP];
+ top_type= h->top_type;
mb_type = s->current_picture.mb_type[mb_xy];
qp = s->current_picture.qscale_table[mb_xy];
@@ -240,26 +241,26 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
qp1 = (qp + qp1 + 1) >> 1;
qpc0 = (qpc + qpc0 + 1) >> 1;
qpc1 = (qpc + qpc1 + 1) >> 1;
- qp_thresh = 15+52 - h->slice_alpha_c0_offset;
- if(qp <= qp_thresh && qp0 <= qp_thresh && qp1 <= qp_thresh &&
- qpc <= qp_thresh && qpc0 <= qp_thresh && qpc1 <= qp_thresh)
- return;
if( IS_INTRA(mb_type) ) {
- int16_t bS4[4] = {4,4,4,4};
- int16_t bS3[4] = {3,3,3,3};
- int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
+ static const int16_t bS4[4] = {4,4,4,4};
+ static const int16_t bS3[4] = {3,3,3,3};
+ const int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
if(left_type)
filter_mb_edgev( &img_y[4*0], linesize, bS4, qp0, h);
if( IS_8x8DCT(mb_type) ) {
filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
- filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ if(top_type){
+ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ }
filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
} else {
filter_mb_edgev( &img_y[4*1], linesize, bS3, qp, h);
filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
filter_mb_edgev( &img_y[4*3], linesize, bS3, qp, h);
- filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ if(top_type){
+ filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
+ }
filter_mb_edgeh( &img_y[4*1*linesize], linesize, bS3, qp, h);
filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
filter_mb_edgeh( &img_y[4*3*linesize], linesize, bS3, qp, h);
@@ -273,8 +274,10 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
if( IS_8x8DCT(mb_type) ) {
filter_mb_edgev( &img_cb[4*2], linesize, bS3, qpc, h);
filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h);
- filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
- filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ if(top_type){
+ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ }
filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h);
filter_mb_edgeh( &img_cr[4*2*linesize], linesize, bS3, qpc, h);
} else {
@@ -284,8 +287,10 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
filter_mb_edgev( &img_cr[4*2], linesize, bS3, qpc, h);
filter_mb_edgev( &img_cb[4*3], linesize, bS3, qpc, h);
filter_mb_edgev( &img_cr[4*3], linesize, bS3, qpc, h);
- filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
- filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ if(top_type){
+ filter_mb_edgeh( &img_cb[4*0*linesize], linesize, bSH, qpc1, h);
+ filter_mb_edgeh( &img_cr[4*0*linesize], linesize, bSH, qpc1, h);
+ }
filter_mb_edgeh( &img_cb[4*1*linesize], linesize, bS3, qpc, h);
filter_mb_edgeh( &img_cr[4*1*linesize], linesize, bS3, qpc, h);
filter_mb_edgeh( &img_cb[4*2*linesize], linesize, bS3, qpc, h);
@@ -300,9 +305,11 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
}
filter_mb_edgecv( &img_cb[2*2], uvlinesize, bS3, qpc, h);
filter_mb_edgecv( &img_cr[2*2], uvlinesize, bS3, qpc, h);
- filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ if(top_type){
+ filter_mb_edgech( &img_cb[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
+ }
filter_mb_edgech( &img_cb[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
- filter_mb_edgech( &img_cr[2*0*uvlinesize], uvlinesize, bSH, qpc1, h);
filter_mb_edgech( &img_cr[2*2*uvlinesize], uvlinesize, bS3, qpc, h);
}
}
@@ -310,7 +317,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
} else {
LOCAL_ALIGNED_8(int16_t, bS, [2], [4][4]);
int edges;
- if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 ) {
+ if( IS_8x8DCT(mb_type) && (h->cbp&7) == 7 && !chroma444 ) {
edges = 4;
AV_WN64A(bS[0][0], 0x0002000200020002ULL);
AV_WN64A(bS[0][2], 0x0002000200020002ULL);
@@ -318,7 +325,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
AV_WN64A(bS[1][2], 0x0002000200020002ULL);
} else {
int mask_edge1 = (3*(((5*mb_type)>>5)&1)) | (mb_type>>4); //(mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : (mb_type & MB_TYPE_16x8) ? 1 : 0;
- int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[0] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0;
+ int mask_edge0 = 3*((mask_edge1>>1) & ((5*left_type)>>5)&1); // (mb_type & (MB_TYPE_16x16 | MB_TYPE_8x16)) && (h->left_type[LTOP] & (MB_TYPE_16x16 | MB_TYPE_8x16)) ? 3 : 0;
int step = 1+(mb_type>>24); //IS_8x8DCT(mb_type) ? 2 : 1;
edges = 4 - 3*((mb_type>>3) & !(h->cbp & 15)); //(mb_type & MB_TYPE_16x16) && !(h->cbp & 15) ? 1 : 4;
h->h264dsp.h264_loop_filter_strength( bS, h->non_zero_count_cache, h->ref_cache, h->mv_cache,
@@ -326,7 +333,7 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
}
if( IS_INTRA(left_type) )
AV_WN64A(bS[0][0], 0x0004000400040004ULL);
- if( IS_INTRA(h->top_type) )
+ if( IS_INTRA(top_type) )
AV_WN64A(bS[1][0], FIELD_PICTURE ? 0x0003000300030003ULL : 0x0004000400040004ULL);
#define FILTER(hv,dir,edge)\
@@ -345,16 +352,19 @@ void ff_h264_filter_mb_fast( H264Context *h, int mb_x, int mb_y, uint8_t *img_y,
if(left_type)
FILTER(v,0,0);
if( edges == 1 ) {
- FILTER(h,1,0);
+ if(top_type)
+ FILTER(h,1,0);
} else if( IS_8x8DCT(mb_type) ) {
FILTER(v,0,2);
- FILTER(h,1,0);
+ if(top_type)
+ FILTER(h,1,0);
FILTER(h,1,2);
} else {
FILTER(v,0,1);
FILTER(v,0,2);
FILTER(v,0,3);
- FILTER(h,1,0);
+ if(top_type)
+ FILTER(h,1,0);
FILTER(h,1,1);
FILTER(h,1,2);
FILTER(h,1,3);
@@ -397,7 +407,7 @@ static av_always_inline void filter_mb_dir(H264Context *h, int mb_x, int mb_y, u
int edge;
int chroma_qp_avg[2];
const int mbm_xy = dir == 0 ? mb_xy -1 : h->top_mb_xy;
- const int mbm_type = dir == 0 ? h->left_type[0] : h->top_type;
+ const int mbm_type = dir == 0 ? h->left_type[LTOP] : h->top_type;
// how often to recheck mv-based bS when iterating between edges
static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1},
@@ -633,9 +643,9 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
if (FRAME_MBAFF
// and current and left pair do not have the same interlaced type
- && IS_INTERLACED(mb_type^h->left_type[0])
+ && IS_INTERLACED(mb_type^h->left_type[LTOP])
// and left mb is in available to us
- && h->left_type[0]) {
+ && h->left_type[LTOP]) {
/* First vertical edge is different in MBAFF frames
* There are 8 different bS to compute and 2 different Qp
*/
@@ -663,8 +673,8 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint
const uint8_t *off= offset[MB_FIELD][mb_y&1];
for( i = 0; i < 8; i++ ) {
int j= MB_FIELD ? i>>2 : i&1;
- int mbn_xy = h->left_mb_xy[j];
- int mbn_type= h->left_type[j];
+ int mbn_xy = h->left_mb_xy[LEFT(j)];
+ int mbn_type= h->left_type[LEFT(j)];
if( IS_INTRA( mbn_type ) )
bS[i] = 4;
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index 661ef6c..dc146a4 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -35,7 +35,7 @@
//#undef NDEBUG
#include <assert.h>
-static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){
+static av_always_inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, int list, int part_width){
const int topright_ref= h->ref_cache[list][ i - 8 + part_width ];
MpegEncContext *s = &h->s;
@@ -64,7 +64,6 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in
if(!MB_FIELD
&& IS_INTERLACED(h->left_type[0])){
SET_DIAG_MV(*2, >>1, h->left_mb_xy[0]+s->mb_stride, (s->mb_y&1)*2+(i>>5));
- assert(h->left_mb_xy[0] == h->left_mb_xy[1]);
}
if(MB_FIELD
&& !IS_INTERLACED(h->left_type[0])){
@@ -93,7 +92,7 @@ static inline int fetch_diagonal_mv(H264Context *h, const int16_t **C, int i, in
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static inline void pred_motion(H264Context * const h, int n, int part_width, int list, int ref, int * const mx, int * const my){
+static av_always_inline void pred_motion(H264Context * const h, int n, int part_width, int list, int ref, int * const mx, int * const my){
const int index8= scan8[n];
const int top_ref= h->ref_cache[list][ index8 - 8 ];
const int left_ref= h->ref_cache[list][ index8 - 1 ];
@@ -148,7 +147,7 @@ static inline void pred_motion(H264Context * const h, int n, int part_width, int
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static inline void pred_16x8_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
+static av_always_inline void pred_16x8_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
if(n==0){
const int top_ref= h->ref_cache[list][ scan8[0] - 8 ];
const int16_t * const B= h->mv_cache[list][ scan8[0] - 8 ];
@@ -183,7 +182,7 @@ static inline void pred_16x8_motion(H264Context * const h, int n, int list, int
* @param mx the x component of the predicted motion vector
* @param my the y component of the predicted motion vector
*/
-static inline void pred_8x16_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
+static av_always_inline void pred_8x16_motion(H264Context * const h, int n, int list, int ref, int * const mx, int * const my){
if(n==0){
const int left_ref= h->ref_cache[list][ scan8[0] - 1 ];
const int16_t * const A= h->mv_cache[list][ scan8[0] - 1 ];
@@ -214,22 +213,117 @@ static inline void pred_8x16_motion(H264Context * const h, int n, int list, int
pred_motion(h, n, 2, list, ref, mx, my);
}
-static inline void pred_pskip_motion(H264Context * const h, int * const mx, int * const my){
- const int top_ref = h->ref_cache[0][ scan8[0] - 8 ];
- const int left_ref= h->ref_cache[0][ scan8[0] - 1 ];
+#define FIX_MV_MBAFF(type, refn, mvn, idx)\
+ if(FRAME_MBAFF){\
+ if(MB_FIELD){\
+ if(!IS_INTERLACED(type)){\
+ refn <<= 1;\
+ AV_COPY32(mvbuf[idx], mvn);\
+ mvbuf[idx][1] /= 2;\
+ mvn = mvbuf[idx];\
+ }\
+ }else{\
+ if(IS_INTERLACED(type)){\
+ refn >>= 1;\
+ AV_COPY32(mvbuf[idx], mvn);\
+ mvbuf[idx][1] <<= 1;\
+ mvn = mvbuf[idx];\
+ }\
+ }\
+ }
- tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
+static av_always_inline void pred_pskip_motion(H264Context * const h){
+ DECLARE_ALIGNED(4, static const int16_t, zeromv)[2] = {0};
+ DECLARE_ALIGNED(4, int16_t, mvbuf)[3][2];
+ MpegEncContext * const s = &h->s;
+ int8_t *ref = s->current_picture.ref_index[0];
+ int16_t (*mv)[2] = s->current_picture.motion_val[0];
+ int top_ref, left_ref, diagonal_ref, match_count, mx, my;
+ const int16_t *A, *B, *C;
+ int b_stride = h->b_stride;
+
+ fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, 0, 1);
+
+ /* To avoid doing an entire fill_decode_caches, we inline the relevant parts here.
+ * FIXME: this is a partial duplicate of the logic in fill_decode_caches, but it's
+ * faster this way. Is there a way to avoid this duplication?
+ */
+ if(USES_LIST(h->left_type[LTOP], 0)){
+ left_ref = ref[4*h->left_mb_xy[LTOP] + 1 + (h->left_block[0]&~1)];
+ A = mv[h->mb2b_xy[h->left_mb_xy[LTOP]] + 3 + b_stride*h->left_block[0]];
+ FIX_MV_MBAFF(h->left_type[LTOP], left_ref, A, 0);
+ if(!(left_ref | AV_RN32A(A))){
+ goto zeromv;
+ }
+ }else if(h->left_type[LTOP]){
+ left_ref = LIST_NOT_USED;
+ A = zeromv;
+ }else{
+ goto zeromv;
+ }
- if(top_ref == PART_NOT_AVAILABLE || left_ref == PART_NOT_AVAILABLE
- || !( top_ref | AV_RN32A(h->mv_cache[0][ scan8[0] - 8 ]))
- || !(left_ref | AV_RN32A(h->mv_cache[0][ scan8[0] - 1 ]))){
+ if(USES_LIST(h->top_type, 0)){
+ top_ref = ref[4*h->top_mb_xy + 2];
+ B = mv[h->mb2b_xy[h->top_mb_xy] + 3*b_stride];
+ FIX_MV_MBAFF(h->top_type, top_ref, B, 1);
+ if(!(top_ref | AV_RN32A(B))){
+ goto zeromv;
+ }
+ }else if(h->top_type){
+ top_ref = LIST_NOT_USED;
+ B = zeromv;
+ }else{
+ goto zeromv;
+ }
+
+ tprintf(h->s.avctx, "pred_pskip: (%d) (%d) at %2d %2d\n", top_ref, left_ref, h->s.mb_x, h->s.mb_y);
- *mx = *my = 0;
- return;
+ if(USES_LIST(h->topright_type, 0)){
+ diagonal_ref = ref[4*h->topright_mb_xy + 2];
+ C = mv[h->mb2b_xy[h->topright_mb_xy] + 3*b_stride];
+ FIX_MV_MBAFF(h->topright_type, diagonal_ref, C, 2);
+ }else if(h->topright_type){
+ diagonal_ref = LIST_NOT_USED;
+ C = zeromv;
+ }else{
+ if(USES_LIST(h->topleft_type, 0)){
+ diagonal_ref = ref[4*h->topleft_mb_xy + 1 + (h->topleft_partition & 2)];
+ C = mv[h->mb2b_xy[h->topleft_mb_xy] + 3 + b_stride + (h->topleft_partition & 2*b_stride)];
+ FIX_MV_MBAFF(h->topleft_type, diagonal_ref, C, 2);
+ }else if(h->topleft_type){
+ diagonal_ref = LIST_NOT_USED;
+ C = zeromv;
+ }else{
+ diagonal_ref = PART_NOT_AVAILABLE;
+ C = zeromv;
+ }
}
- pred_motion(h, 0, 4, 0, 0, mx, my);
+ match_count= !diagonal_ref + !top_ref + !left_ref;
+ tprintf(h->s.avctx, "pred_pskip_motion match_count=%d\n", match_count);
+ if(match_count > 1){
+ mx = mid_pred(A[0], B[0], C[0]);
+ my = mid_pred(A[1], B[1], C[1]);
+ }else if(match_count==1){
+ if(!left_ref){
+ mx = A[0];
+ my = A[1];
+ }else if(!top_ref){
+ mx = B[0];
+ my = B[1];
+ }else{
+ mx = C[0];
+ my = C[1];
+ }
+ }else{
+ mx = mid_pred(A[0], B[0], C[0]);
+ my = mid_pred(A[1], B[1], C[1]);
+ }
+ fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32(mx,my), 4);
+ return;
+zeromv:
+ fill_rectangle( h->mv_cache[0][scan8[0]], 4, 4, 8, 0, 4);
return;
}
diff --git a/libavcodec/h264dsp_template.c b/libavcodec/h264dsp_template.c
index eb336f7..906d99f 100644
--- a/libavcodec/h264dsp_template.c
+++ b/libavcodec/h264dsp_template.c
@@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
-#include "high_bit_depth.h"
+#include "bit_depth_template.c"
#define op_scale1(x) block[x] = av_clip_pixel( (block[x]*weight + offset) >> log2_denom )
#define op_scale2(x) dst[x] = av_clip_pixel( (src[x]*weights + dst[x]*weightd + offset) >> (log2_denom+1))
diff --git a/libavcodec/h264idct_template.c b/libavcodec/h264idct_template.c
index 83f6f38..94d073e 100644
--- a/libavcodec/h264idct_template.c
+++ b/libavcodec/h264idct_template.c
@@ -25,7 +25,7 @@
* @author Michael Niedermayer <michaelni@gmx.at>
*/
-#include "high_bit_depth.h"
+#include "bit_depth_template.c"
#ifndef AVCODEC_H264IDCT_INTERNAL_H
#define AVCODEC_H264IDCT_INTERNAL_H
@@ -237,7 +237,7 @@ void FUNCC(ff_h264_idct_add8)(uint8_t **dest, const int *block_offset, DCTELEM *
}
/**
* IDCT transforms the 16 dc values and dequantizes them.
- * @param qp quantization parameter
+ * @param qmul quantization parameter
*/
void FUNCC(ff_h264_luma_dc_dequant_idct)(DCTELEM *p_output, DCTELEM *p_input, int qmul){
#define stride 16
diff --git a/libavcodec/h264pred_template.c b/libavcodec/h264pred_template.c
index 3cd4463..36f6d4e 100644
--- a/libavcodec/h264pred_template.c
+++ b/libavcodec/h264pred_template.c
@@ -26,7 +26,8 @@
*/
#include "mathops.h"
-#include "high_bit_depth.h"
+
+#include "bit_depth_template.c"
static void FUNCC(pred4x4_vertical)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index 4b9aae2..4785a7c 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -311,6 +311,9 @@ av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
}
#ifdef TEST
+#undef printf
+#include <stdio.h>
+
#define FILT_ORDER 4
#define SIZE 1024
int main(void)
@@ -320,7 +323,6 @@ int main(void)
float cutoff_coeff = 0.4;
int16_t x[SIZE], y[SIZE];
int i;
- FILE* fd;
fcoeffs = ff_iir_filter_init_coeffs(NULL, FF_FILTER_TYPE_BUTTERWORTH,
FF_FILTER_MODE_LOWPASS, FILT_ORDER,
@@ -333,13 +335,8 @@ int main(void)
ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
- fd = fopen("in.bin", "w");
- fwrite(x, sizeof(x[0]), SIZE, fd);
- fclose(fd);
-
- fd = fopen("out.bin", "w");
- fwrite(y, sizeof(y[0]), SIZE, fd);
- fclose(fd);
+ for (i = 0; i < SIZE; i++)
+ printf("%6d %6d\n", x[i], y[i]);
ff_iir_filter_free_coeffs(fcoeffs);
ff_iir_filter_free_state(fstate);
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index b1e6723..c0d90ea 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -30,6 +30,7 @@
//#define DEBUG
#include <limits.h>
+#include "libavutil/mathematics.h"
#include "dsputil.h"
#include "avcodec.h"
#include "mpegvideo.h"
diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c
index 1f76f82..45cb256 100644
--- a/libavcodec/libgsm.c
+++ b/libavcodec/libgsm.c
@@ -139,7 +139,7 @@ AVCodec ff_libgsm_ms_encoder = {
static int libgsm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt) {
- const uint8_t *buf = avpkt->data;
+ uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
*data_size = 0; /* In case of error */
if(buf_size < avctx->block_align) return -1;
diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c
index 73abd75..31d1462 100644
--- a/libavcodec/libopencore-amr.c
+++ b/libavcodec/libopencore-amr.c
@@ -88,7 +88,7 @@ typedef struct AMRContext {
} AMRContext;
static const AVOption options[] = {
- { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRContext, enc_dtx), FF_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
};
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index 7603f7e..d421471 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -208,7 +208,6 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
FfmpegSchroDecoderParams *p_schro_params = avccontext->priv_data;
SchroDecoder *decoder = p_schro_params->decoder;
- SchroVideoFormat *format;
AVPicture *picture = data;
SchroBuffer *enc_buf;
SchroFrame* frame;
@@ -240,7 +239,6 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
go = 1;
} else
outer = 0;
- format = p_schro_params->format;
while (go) {
/* Parse data and process result. */
diff --git a/libavcodec/libvo-amrwbenc.c b/libavcodec/libvo-amrwbenc.c
index ec23aeb..31964e6 100644
--- a/libavcodec/libvo-amrwbenc.c
+++ b/libavcodec/libvo-amrwbenc.c
@@ -34,7 +34,7 @@ typedef struct AMRWBContext {
} AMRWBContext;
static const AVOption options[] = {
- { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), FF_OPT_TYPE_INT, 0, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
+ { "dtx", "Allow DTX (generate comfort noise)", offsetof(AMRWBContext, allow_dtx), FF_OPT_TYPE_INT, { 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM },
{ NULL }
};
diff --git a/libavcodec/libvorbis.c b/libavcodec/libvorbis.c
index bc219de..4e05268 100644
--- a/libavcodec/libvorbis.c
+++ b/libavcodec/libvorbis.c
@@ -30,6 +30,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "vorbis.h"
+#include "libavutil/mathematics.h"
#undef NDEBUG
#include <assert.h>
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index f5c942e..ac1b79f 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -31,6 +31,7 @@
#include "avcodec.h"
#include "libavutil/base64.h"
#include "libavutil/opt.h"
+#include "libavutil/mathematics.h"
/**
* Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
diff --git a/libavcodec/libxvidff.c b/libavcodec/libxvidff.c
index effd2db..a739dc0 100644
--- a/libavcodec/libxvidff.c
+++ b/libavcodec/libxvidff.c
@@ -30,6 +30,7 @@
#include "avcodec.h"
#include "libavutil/cpu.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libxvid_internal.h"
#if !HAVE_MKSTEMP
#include <fcntl.h>
@@ -749,7 +750,7 @@ static int xvid_ff_2pass_before(struct xvid_context *ref,
static int xvid_ff_2pass_after(struct xvid_context *ref,
xvid_plg_data_t *param) {
char *log = ref->twopassbuffer;
- char *frame_types = " ipbs";
+ const char *frame_types = " ipbs";
char frame_type;
/* Quick bounds check */
diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
index d041caf..9488a0f 100644
--- a/libavcodec/lpc.c
+++ b/libavcodec/lpc.c
@@ -149,7 +149,7 @@ static int estimate_best_order(double *ref, int min_order, int max_order)
/**
* Calculate LPC coefficients for multiple orders
*
- * @param use_lpc LPC method for determining coefficients
+ * @param lpc_type LPC method for determining coefficients
* 0 = LPC with fixed pre-defined coeffs
* 1 = LPC with coeffs determined by Levinson-Durbin recursion
* 2+ = LPC with coeffs determined by Cholesky factorization using (use_lpc-1) passes.
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 02c66f5..b875f5b 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1505,29 +1505,26 @@ eoi_parser:
av_log(avctx, AV_LOG_WARNING, "Found EOI before any SOF, ignoring\n");
break;
}
- {
- if (s->interlaced) {
- s->bottom_field ^= 1;
- /* if not bottom field, do not output image yet */
- if (s->bottom_field == !s->interlace_polarity)
- goto not_the_end;
- }
- *picture = *s->picture_ptr;
- *data_size = sizeof(AVFrame);
-
- if(!s->lossless){
- picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
- picture->qstride= 0;
- picture->qscale_table= s->qscale_table;
- memset(picture->qscale_table, picture->quality, (s->width+15)/16);
- if(avctx->debug & FF_DEBUG_QP)
- av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
- picture->quality*= FF_QP2LAMBDA;
- }
-
- goto the_end;
+ if (s->interlaced) {
+ s->bottom_field ^= 1;
+ /* if not bottom field, do not output image yet */
+ if (s->bottom_field == !s->interlace_polarity)
+ goto not_the_end;
}
- break;
+ *picture = *s->picture_ptr;
+ *data_size = sizeof(AVFrame);
+
+ if(!s->lossless){
+ picture->quality= FFMAX3(s->qscale[0], s->qscale[1], s->qscale[2]);
+ picture->qstride= 0;
+ picture->qscale_table= s->qscale_table;
+ memset(picture->qscale_table, picture->quality, (s->width+15)/16);
+ if(avctx->debug & FF_DEBUG_QP)
+ av_log(avctx, AV_LOG_DEBUG, "QP: %d\n", picture->quality);
+ picture->quality*= FF_QP2LAMBDA;
+ }
+
+ goto the_end;
case SOS:
if (!s->got_picture) {
av_log(avctx, AV_LOG_WARNING, "Can not process SOS before SOF, skipping\n");
diff --git a/libavcodec/motion_est_template.c b/libavcodec/motion_est_template.c
index 5d319c5..e9556e9 100644
--- a/libavcodec/motion_est_template.c
+++ b/libavcodec/motion_est_template.c
@@ -993,7 +993,7 @@ static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dm
}
/**
- @param P[10][2] a list of candidate mvs to check before starting the
+ @param P a list of candidate mvs to check before starting the
iterative search. If one of the candidates is close to the optimal mv, then
it takes fewer iterations. And it increases the chance that we find the
optimal mv.
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index bd858a5..e7bae57 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1965,8 +1965,6 @@ static int slice_decode_thread(AVCodecContext *c, void *arg){
if(mb_y < 0 || mb_y >= s->end_mb_y)
return -1;
}
-
- return 0; //not reached
}
/**
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index c3c3e15..170620b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -285,9 +285,10 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared){
}
FF_ALLOCZ_OR_GOTO(s->avctx, pic->mbskip_table , mb_array_size * sizeof(uint8_t)+2, fail) //the +2 is for the slice end check
- FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table , mb_array_size * sizeof(uint8_t) , fail)
+ FF_ALLOCZ_OR_GOTO(s->avctx, pic->qscale_table_base , (big_mb_num + s->mb_stride) * sizeof(uint8_t) , fail)
FF_ALLOCZ_OR_GOTO(s->avctx, pic->mb_type_base , (big_mb_num + s->mb_stride) * sizeof(uint32_t), fail)
pic->mb_type= pic->mb_type_base + 2*s->mb_stride+1;
+ pic->qscale_table = pic->qscale_table_base + 2*s->mb_stride + 1;
if(s->out_format == FMT_H264){
for(i=0; i<2; i++){
FF_ALLOCZ_OR_GOTO(s->avctx, pic->motion_val_base[i], 2 * (b4_array_size+4) * sizeof(int16_t), fail)
@@ -339,7 +340,7 @@ static void free_picture(MpegEncContext *s, Picture *pic){
av_freep(&pic->mc_mb_var);
av_freep(&pic->mb_mean);
av_freep(&pic->mbskip_table);
- av_freep(&pic->qscale_table);
+ av_freep(&pic->qscale_table_base);
av_freep(&pic->mb_type_base);
av_freep(&pic->dct_coeff);
av_freep(&pic->pan_scan);
@@ -574,7 +575,11 @@ void MPV_decode_defaults(MpegEncContext *s){
*/
av_cold int MPV_common_init(MpegEncContext *s)
{
- int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;
+ int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y,
+ threads = (s->encoding ||
+ (HAVE_THREADS &&
+ s->avctx->active_thread_type & FF_THREAD_SLICE)) ?
+ s->avctx->thread_count : 1;
if(s->codec_id == CODEC_ID_MPEG2VIDEO && !s->progressive_sequence)
s->mb_height = (s->height + 31) / 32 * 2;
@@ -588,8 +593,10 @@ av_cold int MPV_common_init(MpegEncContext *s)
if((s->encoding || (s->avctx->active_thread_type & FF_THREAD_SLICE)) &&
(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height))){
- av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
- return -1;
+ int max_threads = FFMIN(MAX_THREADS, s->mb_height);
+ av_log(s->avctx, AV_LOG_WARNING, "too many threads (%d), reducing to %d\n",
+ s->avctx->thread_count, max_threads);
+ threads = max_threads;
}
if((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx))
@@ -746,8 +753,6 @@ av_cold int MPV_common_init(MpegEncContext *s)
s->thread_context[0]= s;
if (s->encoding || (HAVE_THREADS && s->avctx->active_thread_type&FF_THREAD_SLICE)) {
- threads = s->avctx->thread_count;
-
for(i=1; i<threads; i++){
s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 2a54329..ca11543 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -88,6 +88,7 @@ typedef struct Picture{
* halfpel luma planes.
*/
uint8_t *interpolated[3];
+ int8_t *qscale_table_base;
int16_t (*motion_val_base[2])[2];
uint32_t *mb_type_base;
#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if there is just one type
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index a6e9c7c..d32b9e6 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -28,6 +28,7 @@
*/
#include "libavutil/intmath.h"
+#include "libavutil/mathematics.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
@@ -1787,7 +1788,7 @@ static av_always_inline void encode_mb(MpegEncContext *s, int motion_x, int moti
static inline void copy_context_before_encode(MpegEncContext *d, MpegEncContext *s, int type){
int i;
- memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
+ memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster than a loop?
/* mpeg1 */
d->mb_skip_run= s->mb_skip_run;
@@ -1816,7 +1817,7 @@ static inline void copy_context_after_encode(MpegEncContext *d, MpegEncContext *
int i;
memcpy(d->mv, s->mv, 2*4*2*sizeof(int));
- memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster then a loop?
+ memcpy(d->last_mv, s->last_mv, 2*2*2*sizeof(int)); //FIXME is memcpy faster than a loop?
/* mpeg1 */
d->mb_skip_run= s->mb_skip_run;
@@ -2170,9 +2171,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
int d= 100 / s->avctx->error_rate;
if(r % d == 0){
current_packet_size=0;
-#ifndef ALT_BITSTREAM_WRITER
s->pb.buf_ptr= s->ptr_lastgob;
-#endif
assert(put_bits_ptr(&s->pb) == s->ptr_lastgob);
}
}
diff --git a/libavcodec/opt.h b/libavcodec/opt.h
index 70de27d..2380e74 100644
--- a/libavcodec/opt.h
+++ b/libavcodec/opt.h
@@ -1,3 +1,21 @@
+/*
+ * 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
* This header is provided for compatibility only and will be removed
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 111ce61..852e349 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -440,7 +440,6 @@ static int pcm_decode_frame(AVCodecContext *avctx,
default:
av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
return -1;
- break;
}
samples = (short *) dst_int32_t;
break;
diff --git a/libavcodec/pgssubdec.c b/libavcodec/pgssubdec.c
index 315dbbd..96b400b 100644
--- a/libavcodec/pgssubdec.c
+++ b/libavcodec/pgssubdec.c
@@ -198,7 +198,7 @@ static int parse_picture_segment(AVCodecContext *avctx,
/* Make sure the bitmap is not too large */
if (avctx->width < width || avctx->height < height) {
- av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger then video.\n");
+ av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n");
return -1;
}
diff --git a/libavcodec/ppc/fft_altivec.c b/libavcodec/ppc/fft_altivec.c
index 1ea2369..e171665 100644
--- a/libavcodec/ppc/fft_altivec.c
+++ b/libavcodec/ppc/fft_altivec.c
@@ -141,7 +141,9 @@ av_cold void ff_fft_init_altivec(FFTContext *s)
{
#if HAVE_GNU_AS
s->fft_calc = ff_fft_calc_interleave_altivec;
- s->imdct_calc = ff_imdct_calc_altivec;
- s->imdct_half = ff_imdct_half_altivec;
+ if (s->mdct_bits >= 5) {
+ s->imdct_calc = ff_imdct_calc_altivec;
+ s->imdct_half = ff_imdct_half_altivec;
+ }
#endif
}
diff --git a/libavcodec/put_bits.h b/libavcodec/put_bits.h
index 7901691..a3fc5f1 100644
--- a/libavcodec/put_bits.h
+++ b/libavcodec/put_bits.h
@@ -36,19 +36,10 @@
#include "mathops.h"
#include "config.h"
-//#define ALT_BITSTREAM_WRITER
-//#define ALIGNED_BITSTREAM_WRITER
-
-/* buf and buf_end must be present and used by every alternative writer. */
typedef struct PutBitContext {
-#ifdef ALT_BITSTREAM_WRITER
- uint8_t *buf, *buf_end;
- int index;
-#else
uint32_t bit_buf;
int bit_left;
uint8_t *buf, *buf_ptr, *buf_end;
-#endif
int size_in_bits;
} PutBitContext;
@@ -68,15 +59,9 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_s
s->size_in_bits= 8*buffer_size;
s->buf = buffer;
s->buf_end = s->buf + buffer_size;
-#ifdef ALT_BITSTREAM_WRITER
- s->index=0;
- ((uint32_t*)(s->buf))[0]=0;
-// memset(buffer, 0, buffer_size);
-#else
s->buf_ptr = s->buf;
s->bit_left=32;
s->bit_buf=0;
-#endif
}
/**
@@ -84,11 +69,7 @@ static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_s
*/
static inline int put_bits_count(PutBitContext *s)
{
-#ifdef ALT_BITSTREAM_WRITER
- return s->index;
-#else
return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left;
-#endif
}
/**
@@ -96,9 +77,6 @@ static inline int put_bits_count(PutBitContext *s)
*/
static inline void flush_put_bits(PutBitContext *s)
{
-#ifdef ALT_BITSTREAM_WRITER
- align_put_bits(s);
-#else
#ifndef BITSTREAM_WRITER_LE
s->bit_buf<<= s->bit_left;
#endif
@@ -115,10 +93,9 @@ static inline void flush_put_bits(PutBitContext *s)
}
s->bit_left=32;
s->bit_buf=0;
-#endif
}
-#if defined(ALT_BITSTREAM_WRITER) || defined(BITSTREAM_WRITER_LE)
+#ifdef BITSTREAM_WRITER_LE
#define align_put_bits align_put_bits_unsupported_here
#define ff_put_string ff_put_string_unsupported_here
#define ff_copy_bits ff_copy_bits_unsupported_here
@@ -148,7 +125,6 @@ void ff_copy_bits(PutBitContext *pb, const uint8_t *src, int length);
* Use put_bits32 to write 32 bits.
*/
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
-#ifndef ALT_BITSTREAM_WRITER
{
unsigned int bit_buf;
int bit_left;
@@ -164,12 +140,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
#ifdef BITSTREAM_WRITER_LE
bit_buf |= value << (32 - bit_left);
if (n >= bit_left) {
-#if !HAVE_FAST_UNALIGNED
- if (3 & (intptr_t) s->buf_ptr) {
- AV_WL32(s->buf_ptr, bit_buf);
- } else
-#endif
- *(uint32_t *)s->buf_ptr = av_le2ne32(bit_buf);
+ AV_WL32(s->buf_ptr, bit_buf);
s->buf_ptr+=4;
bit_buf = (bit_left==32)?0:value >> bit_left;
bit_left+=32;
@@ -182,12 +153,7 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
} else {
bit_buf<<=bit_left;
bit_buf |= value >> (n - bit_left);
-#if !HAVE_FAST_UNALIGNED
- if (3 & (intptr_t) s->buf_ptr) {
- AV_WB32(s->buf_ptr, bit_buf);
- } else
-#endif
- *(uint32_t *)s->buf_ptr = av_be2ne32(bit_buf);
+ AV_WB32(s->buf_ptr, bit_buf);
//printf("bitbuf = %08x\n", bit_buf);
s->buf_ptr+=4;
bit_left+=32 - n;
@@ -198,70 +164,6 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
s->bit_buf = bit_buf;
s->bit_left = bit_left;
}
-#else /* ALT_BITSTREAM_WRITER defined */
-{
-# ifdef ALIGNED_BITSTREAM_WRITER
-# if ARCH_X86
- __asm__ volatile(
- "movl %0, %%ecx \n\t"
- "xorl %%eax, %%eax \n\t"
- "shrdl %%cl, %1, %%eax \n\t"
- "shrl %%cl, %1 \n\t"
- "movl %0, %%ecx \n\t"
- "shrl $3, %%ecx \n\t"
- "andl $0xFFFFFFFC, %%ecx \n\t"
- "bswapl %1 \n\t"
- "orl %1, (%2, %%ecx) \n\t"
- "bswapl %%eax \n\t"
- "addl %3, %0 \n\t"
- "movl %%eax, 4(%2, %%ecx) \n\t"
- : "=&r" (s->index), "=&r" (value)
- : "r" (s->buf), "r" (n), "0" (s->index), "1" (value<<(-n))
- : "%eax", "%ecx"
- );
-# else
- int index= s->index;
- uint32_t *ptr= ((uint32_t *)s->buf)+(index>>5);
-
- value<<= 32-n;
-
- ptr[0] |= av_be2ne32(value>>(index&31));
- ptr[1] = av_be2ne32(value<<(32-(index&31)));
-//if(n>24) printf("%d %d\n", n, value);
- index+= n;
- s->index= index;
-# endif
-# else //ALIGNED_BITSTREAM_WRITER
-# if ARCH_X86
- __asm__ volatile(
- "movl $7, %%ecx \n\t"
- "andl %0, %%ecx \n\t"
- "addl %3, %%ecx \n\t"
- "negl %%ecx \n\t"
- "shll %%cl, %1 \n\t"
- "bswapl %1 \n\t"
- "movl %0, %%ecx \n\t"
- "shrl $3, %%ecx \n\t"
- "orl %1, (%%ecx, %2) \n\t"
- "addl %3, %0 \n\t"
- "movl $0, 4(%%ecx, %2) \n\t"
- : "=&r" (s->index), "=&r" (value)
- : "r" (s->buf), "r" (n), "0" (s->index), "1" (value)
- : "%ecx"
- );
-# else
- int index= s->index;
- uint32_t *ptr= (uint32_t*)(((uint8_t *)s->buf)+(index>>3));
-
- ptr[0] |= av_be2ne32(value<<(32-n-(index&7) ));
- ptr[1] = 0;
-//if(n>24) printf("%d %d\n", n, value);
- index+= n;
- s->index= index;
-# endif
-# endif //!ALIGNED_BITSTREAM_WRITER
-}
-#endif
static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
{
@@ -292,11 +194,7 @@ static void av_unused put_bits32(PutBitContext *s, uint32_t value)
*/
static inline uint8_t* put_bits_ptr(PutBitContext *s)
{
-#ifdef ALT_BITSTREAM_WRITER
- return s->buf + (s->index>>3);
-#else
return s->buf_ptr;
-#endif
}
/**
@@ -306,13 +204,8 @@ static inline uint8_t* put_bits_ptr(PutBitContext *s)
static inline void skip_put_bytes(PutBitContext *s, int n)
{
assert((put_bits_count(s)&7)==0);
-#ifdef ALT_BITSTREAM_WRITER
- FIXME may need some cleaning of the buffer
- s->index += n<<3;
-#else
assert(s->bit_left==32);
s->buf_ptr += n;
-#endif
}
/**
@@ -322,13 +215,9 @@ static inline void skip_put_bytes(PutBitContext *s, int n)
*/
static inline void skip_put_bits(PutBitContext *s, int n)
{
-#ifdef ALT_BITSTREAM_WRITER
- s->index += n;
-#else
s->bit_left -= n;
s->buf_ptr-= 4*(s->bit_left>>5);
s->bit_left &= 31;
-#endif
}
/**
diff --git a/libavcodec/qcelpdata.h b/libavcodec/qcelpdata.h
index 82cc61d..e71ee9f 100644
--- a/libavcodec/qcelpdata.h
+++ b/libavcodec/qcelpdata.h
@@ -38,14 +38,14 @@
* QCELP unpacked data frame
*/
typedef struct {
-/// @defgroup qcelp_codebook_parameters QCELP excitation codebook parameters
+/// @name QCELP excitation codebook parameters
/// @{
uint8_t cbsign[16]; ///!< sign of the codebook gain for each codebook subframe
uint8_t cbgain[16]; ///!< unsigned codebook gain for each codebook subframe
uint8_t cindex[16]; ///!< codebook index for each codebook subframe
/// @}
-/// @defgroup qcelp_pitch_parameters QCELP pitch prediction parameters
+/// @name QCELP pitch prediction parameters
/// @{
uint8_t plag[4]; ///!< pitch lag for each pitch subframe
uint8_t pfrac[4]; ///!< fractional pitch lag for each pitch subframe
diff --git a/libavcodec/raw.c b/libavcodec/raw.c
index d686718..e87a9af 100644
--- a/libavcodec/raw.c
+++ b/libavcodec/raw.c
@@ -137,6 +137,7 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
/* special */
{ PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */
+ { PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */
{ PIX_FMT_NONE, 0 },
};
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index d48cbed..177f08c 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -208,6 +208,7 @@ static int raw_decode(AVCodecContext *avctx,
if ( avctx->codec_tag == MKTAG('Y', 'V', '1', '2')
|| avctx->codec_tag == MKTAG('Y', 'V', '1', '6')
+ || avctx->codec_tag == MKTAG('Y', 'V', '2', '4')
|| avctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))
FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c
index ae9ae10..72635fa 100644
--- a/libavcodec/rv34.c
+++ b/libavcodec/rv34.c
@@ -62,8 +62,10 @@ static const int rv34_mb_type_to_lavc[12] = {
static RV34VLC intra_vlcs[NUM_INTRA_TABLES], inter_vlcs[NUM_INTER_TABLES];
+static int rv34_decode_mv(RV34DecContext *r, int block_type);
+
/**
- * @defgroup vlc RV30/40 VLC generating functions
+ * @name RV30/40 VLC generating functions
* @{
*/
@@ -171,7 +173,7 @@ static av_cold void rv34_init_tables(void)
/**
- * @defgroup transform RV30/40 inverse transform functions
+ * @name RV30/40 inverse transform functions
* @{
*/
@@ -246,7 +248,7 @@ static void rv34_inv_transform_noround(DCTELEM *block){
/**
- * @defgroup block RV30/40 4x4 block decoding functions
+ * @name RV30/40 4x4 block decoding functions
* @{
*/
@@ -393,7 +395,7 @@ static inline void rv34_dequant4x4_16x16(DCTELEM *block, int Qdc, int Q)
/**
- * @defgroup rv3040_bitstream RV30/40 bitstream parsing
+ * @name RV30/40 bitstream parsing
* @{
*/
@@ -422,20 +424,75 @@ static inline RV34VLC* choose_vlc_set(int quant, int mod, int type)
}
/**
- * Decode quantizer difference and return modified quantizer.
+ * Decode macroblock header and return CBP in case of success, -1 otherwise.
*/
-static inline int rv34_decode_dquant(GetBitContext *gb, int quant)
+static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
{
- if(get_bits1(gb))
- return rv34_dquant_tab[get_bits1(gb)][quant];
- else
- return get_bits(gb, 5);
+ MpegEncContext *s = &r->s;
+ GetBitContext *gb = &s->gb;
+ int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
+ int i, t;
+
+ if(!r->si.type){
+ r->is16 = get_bits1(gb);
+ if(!r->is16 && !r->rv30){
+ if(!get_bits1(gb))
+ av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");
+ }
+ s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA;
+ r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA;
+ }else{
+ r->block_type = r->decode_mb_info(r);
+ if(r->block_type == -1)
+ return -1;
+ s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];
+ r->mb_type[mb_pos] = r->block_type;
+ if(r->block_type == RV34_MB_SKIP){
+ if(s->pict_type == AV_PICTURE_TYPE_P)
+ r->mb_type[mb_pos] = RV34_MB_P_16x16;
+ if(s->pict_type == AV_PICTURE_TYPE_B)
+ r->mb_type[mb_pos] = RV34_MB_B_DIRECT;
+ }
+ r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]);
+ rv34_decode_mv(r, r->block_type);
+ if(r->block_type == RV34_MB_SKIP){
+ fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0]));
+ return 0;
+ }
+ r->chroma_vlc = 1;
+ r->luma_vlc = 0;
+ }
+ if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){
+ if(r->is16){
+ t = get_bits(gb, 2);
+ fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
+ r->luma_vlc = 2;
+ }else{
+ if(r->decode_intra_types(r, gb, intra_types) < 0)
+ return -1;
+ r->luma_vlc = 1;
+ }
+ r->chroma_vlc = 0;
+ r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
+ }else{
+ for(i = 0; i < 16; i++)
+ intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0;
+ r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
+ if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){
+ r->is16 = 1;
+ r->chroma_vlc = 1;
+ r->luma_vlc = 2;
+ r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
+ }
+ }
+
+ return rv34_decode_cbp(gb, r->cur_vlcs, r->is16);
}
/** @} */ //bitstream functions
/**
- * @defgroup mv motion vector related code (prediction, reconstruction, motion compensation)
+ * @name motion vector related code (prediction, reconstruction, motion compensation)
* @{
*/
@@ -885,7 +942,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
/** @} */ // mv group
/**
- * @defgroup recons Macroblock reconstruction functions
+ * @name Macroblock reconstruction functions
* @{
*/
/** mapping of RV30/40 intra prediction types to standard H.264 types */
@@ -1027,79 +1084,6 @@ static void rv34_output_macroblock(RV34DecContext *r, int8_t *intra_types, int c
}
}
-/** @} */ // recons group
-
-/**
- * @addtogroup bitstream
- * Decode macroblock header and return CBP in case of success, -1 otherwise.
- */
-static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
-{
- MpegEncContext *s = &r->s;
- GetBitContext *gb = &s->gb;
- int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
- int i, t;
-
- if(!r->si.type){
- r->is16 = get_bits1(gb);
- if(!r->is16 && !r->rv30){
- if(!get_bits1(gb))
- av_log(s->avctx, AV_LOG_ERROR, "Need DQUANT\n");
- }
- s->current_picture_ptr->mb_type[mb_pos] = r->is16 ? MB_TYPE_INTRA16x16 : MB_TYPE_INTRA;
- r->block_type = r->is16 ? RV34_MB_TYPE_INTRA16x16 : RV34_MB_TYPE_INTRA;
- }else{
- r->block_type = r->decode_mb_info(r);
- if(r->block_type == -1)
- return -1;
- s->current_picture_ptr->mb_type[mb_pos] = rv34_mb_type_to_lavc[r->block_type];
- r->mb_type[mb_pos] = r->block_type;
- if(r->block_type == RV34_MB_SKIP){
- if(s->pict_type == AV_PICTURE_TYPE_P)
- r->mb_type[mb_pos] = RV34_MB_P_16x16;
- if(s->pict_type == AV_PICTURE_TYPE_B)
- r->mb_type[mb_pos] = RV34_MB_B_DIRECT;
- }
- r->is16 = !!IS_INTRA16x16(s->current_picture_ptr->mb_type[mb_pos]);
- rv34_decode_mv(r, r->block_type);
- if(r->block_type == RV34_MB_SKIP){
- fill_rectangle(intra_types, 4, 4, r->intra_types_stride, 0, sizeof(intra_types[0]));
- return 0;
- }
- r->chroma_vlc = 1;
- r->luma_vlc = 0;
- }
- if(IS_INTRA(s->current_picture_ptr->mb_type[mb_pos])){
- if(r->is16){
- t = get_bits(gb, 2);
- fill_rectangle(intra_types, 4, 4, r->intra_types_stride, t, sizeof(intra_types[0]));
- r->luma_vlc = 2;
- }else{
- if(r->decode_intra_types(r, gb, intra_types) < 0)
- return -1;
- r->luma_vlc = 1;
- }
- r->chroma_vlc = 0;
- r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
- }else{
- for(i = 0; i < 16; i++)
- intra_types[(i & 3) + (i>>2) * r->intra_types_stride] = 0;
- r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
- if(r->mb_type[mb_pos] == RV34_MB_P_MIX16x16){
- r->is16 = 1;
- r->chroma_vlc = 1;
- r->luma_vlc = 2;
- r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 0);
- }
- }
-
- return rv34_decode_cbp(gb, r->cur_vlcs, r->is16);
-}
-
-/**
- * @addtogroup recons
- * @{
- */
/**
* mask for retrieving all bits in coded block pattern
* corresponding to one 8x8 block
@@ -1109,6 +1093,8 @@ static int rv34_decode_mb_header(RV34DecContext *r, int8_t *intra_types)
#define U_CBP_MASK 0x0F0000
#define V_CBP_MASK 0xF00000
+/** @} */ // recons group
+
static void rv34_apply_differences(RV34DecContext *r, int cbp)
{
@@ -1258,15 +1244,6 @@ static int check_slice_end(RV34DecContext *r, MpegEncContext *s)
return 0;
}
-static inline int slice_compare(SliceInfo *si1, SliceInfo *si2)
-{
- return si1->type != si2->type ||
- si1->start >= si2->start ||
- si1->width != si2->width ||
- si1->height != si2->height||
- si1->pts != si2->pts;
-}
-
static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int buf_size)
{
MpegEncContext *s = &r->s;
diff --git a/libavcodec/rv40data.h b/libavcodec/rv40data.h
index 7912919..436afa8 100644
--- a/libavcodec/rv40data.h
+++ b/libavcodec/rv40data.h
@@ -65,7 +65,7 @@ static const uint8_t rv40_luma_dc_quant[2][32] = {
};
/**
- * @defgroup loopfilter coefficients used by the RV40 loop filter
+ * @name Coefficients used by the RV40 loop filter
* @{
*/
/**
diff --git a/libavcodec/sbr.h b/libavcodec/sbr.h
index 82a996f..69c847a 100644
--- a/libavcodec/sbr.h
+++ b/libavcodec/sbr.h
@@ -42,7 +42,7 @@ typedef struct {
uint8_t bs_xover_band;
/**
- * @defgroup bs_header_extra_1 Variables associated with bs_header_extra_1
+ * @name Variables associated with bs_header_extra_1
* @{
*/
uint8_t bs_freq_scale;
@@ -58,7 +58,7 @@ typedef struct {
*/
typedef struct {
/**
- * @defgroup aac_bitstream Main bitstream data variables
+ * @name Main bitstream data variables
* @{
*/
unsigned bs_frame_class;
@@ -74,7 +74,7 @@ typedef struct {
/** @} */
/**
- * @defgroup state State variables
+ * @name State variables
* @{
*/
DECLARE_ALIGNED(16, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE];
@@ -116,7 +116,7 @@ typedef struct {
SpectrumParameters spectrum_params;
int bs_amp_res_header;
/**
- * @defgroup bs_header_extra_2 variables associated with bs_header_extra_2
+ * @name Variables associated with bs_header_extra_2
* @{
*/
unsigned bs_limiter_bands;
diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index f593d0a..37ba826 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -471,7 +471,6 @@ static int shorten_decode_frame(AVCodecContext *avctx,
s->cur_chan = 0;
goto frame_done;
}
- break;
}
break;
case FN_VERBATIM:
@@ -489,11 +488,9 @@ static int shorten_decode_frame(AVCodecContext *avctx,
case FN_QUIT:
*data_size = 0;
return buf_size;
- break;
default:
av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd);
return -1;
- break;
}
}
frame_done:
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index 43a7190..7b763af 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -33,42 +33,6 @@
#undef NDEBUG
#include <assert.h>
-static const int8_t quant3[256]={
- 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0,
-};
-static const int8_t quant3b[256]={
- 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
--1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-};
static const int8_t quant3bA[256]={
0, 0, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
@@ -87,153 +51,7 @@ static const int8_t quant3bA[256]={
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1,
};
-static const int8_t quant5[256]={
- 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,-1,
-};
-static const int8_t quant7[256]={
- 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
--2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant9[256]={
- 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,
--3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-2,-1,-1,
-};
-static const int8_t quant11[256]={
- 0, 1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-4,-4,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,
--4,-4,-4,-4,-4,-3,-3,-3,-3,-3,-3,-3,-2,-2,-2,-1,
-};
-static const int8_t quant13[256]={
- 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,
--6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-6,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,-5,
--4,-4,-4,-4,-4,-4,-4,-4,-4,-3,-3,-3,-3,-2,-2,-1,
-};
-#if 0 //64*cubic
-static const uint8_t obmc32[1024]={
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0,
- 0, 0, 0, 4, 4, 4, 4, 8, 8, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 12, 12, 8, 8, 4, 4, 4, 4, 0, 0, 0,
- 0, 0, 4, 4, 8, 8, 12, 16, 16, 20, 24, 24, 28, 28, 32, 32, 32, 32, 28, 28, 24, 24, 20, 16, 16, 12, 8, 8, 4, 4, 0, 0,
- 0, 0, 4, 8, 8, 12, 16, 24, 28, 32, 36, 40, 44, 48, 48, 48, 48, 48, 48, 44, 40, 36, 32, 28, 24, 16, 12, 8, 8, 4, 0, 0,
- 0, 4, 4, 8, 12, 20, 24, 32, 40, 44, 52, 56, 60, 64, 68, 72, 72, 68, 64, 60, 56, 52, 44, 40, 32, 24, 20, 12, 8, 4, 4, 0,
- 0, 4, 4, 12, 16, 24, 32, 40, 52, 60, 68, 76, 80, 88, 88, 92, 92, 88, 88, 80, 76, 68, 60, 52, 40, 32, 24, 16, 12, 4, 4, 0,
- 0, 4, 8, 16, 24, 32, 40, 52, 64, 76, 84, 92,100,108,112,116,116,112,108,100, 92, 84, 76, 64, 52, 40, 32, 24, 16, 8, 4, 0,
- 0, 4, 8, 16, 28, 40, 52, 64, 76, 88,100,112,124,132,136,140,140,136,132,124,112,100, 88, 76, 64, 52, 40, 28, 16, 8, 4, 0,
- 0, 4, 12, 20, 32, 44, 60, 76, 88,104,120,132,144,152,160,164,164,160,152,144,132,120,104, 88, 76, 60, 44, 32, 20, 12, 4, 0,
- 0, 4, 12, 24, 36, 48, 68, 84,100,120,136,152,164,176,180,184,184,180,176,164,152,136,120,100, 84, 68, 48, 36, 24, 12, 4, 0,
- 0, 4, 12, 24, 40, 56, 76, 92,112,132,152,168,180,192,204,208,208,204,192,180,168,152,132,112, 92, 76, 56, 40, 24, 12, 4, 0,
- 0, 4, 16, 28, 44, 60, 80,100,124,144,164,180,196,208,220,224,224,220,208,196,180,164,144,124,100, 80, 60, 44, 28, 16, 4, 0,
- 0, 8, 16, 28, 48, 64, 88,108,132,152,176,192,208,224,232,240,240,232,224,208,192,176,152,132,108, 88, 64, 48, 28, 16, 8, 0,
- 0, 4, 16, 32, 48, 68, 88,112,136,160,180,204,220,232,244,248,248,244,232,220,204,180,160,136,112, 88, 68, 48, 32, 16, 4, 0,
- 1, 8, 16, 32, 48, 72, 92,116,140,164,184,208,224,240,248,255,255,248,240,224,208,184,164,140,116, 92, 72, 48, 32, 16, 8, 1,
- 1, 8, 16, 32, 48, 72, 92,116,140,164,184,208,224,240,248,255,255,248,240,224,208,184,164,140,116, 92, 72, 48, 32, 16, 8, 1,
- 0, 4, 16, 32, 48, 68, 88,112,136,160,180,204,220,232,244,248,248,244,232,220,204,180,160,136,112, 88, 68, 48, 32, 16, 4, 0,
- 0, 8, 16, 28, 48, 64, 88,108,132,152,176,192,208,224,232,240,240,232,224,208,192,176,152,132,108, 88, 64, 48, 28, 16, 8, 0,
- 0, 4, 16, 28, 44, 60, 80,100,124,144,164,180,196,208,220,224,224,220,208,196,180,164,144,124,100, 80, 60, 44, 28, 16, 4, 0,
- 0, 4, 12, 24, 40, 56, 76, 92,112,132,152,168,180,192,204,208,208,204,192,180,168,152,132,112, 92, 76, 56, 40, 24, 12, 4, 0,
- 0, 4, 12, 24, 36, 48, 68, 84,100,120,136,152,164,176,180,184,184,180,176,164,152,136,120,100, 84, 68, 48, 36, 24, 12, 4, 0,
- 0, 4, 12, 20, 32, 44, 60, 76, 88,104,120,132,144,152,160,164,164,160,152,144,132,120,104, 88, 76, 60, 44, 32, 20, 12, 4, 0,
- 0, 4, 8, 16, 28, 40, 52, 64, 76, 88,100,112,124,132,136,140,140,136,132,124,112,100, 88, 76, 64, 52, 40, 28, 16, 8, 4, 0,
- 0, 4, 8, 16, 24, 32, 40, 52, 64, 76, 84, 92,100,108,112,116,116,112,108,100, 92, 84, 76, 64, 52, 40, 32, 24, 16, 8, 4, 0,
- 0, 4, 4, 12, 16, 24, 32, 40, 52, 60, 68, 76, 80, 88, 88, 92, 92, 88, 88, 80, 76, 68, 60, 52, 40, 32, 24, 16, 12, 4, 4, 0,
- 0, 4, 4, 8, 12, 20, 24, 32, 40, 44, 52, 56, 60, 64, 68, 72, 72, 68, 64, 60, 56, 52, 44, 40, 32, 24, 20, 12, 8, 4, 4, 0,
- 0, 0, 4, 8, 8, 12, 16, 24, 28, 32, 36, 40, 44, 48, 48, 48, 48, 48, 48, 44, 40, 36, 32, 28, 24, 16, 12, 8, 8, 4, 0, 0,
- 0, 0, 4, 4, 8, 8, 12, 16, 16, 20, 24, 24, 28, 28, 32, 32, 32, 32, 28, 28, 24, 24, 20, 16, 16, 12, 8, 8, 4, 4, 0, 0,
- 0, 0, 0, 4, 4, 4, 4, 8, 8, 12, 12, 12, 16, 16, 16, 16, 16, 16, 16, 16, 12, 12, 12, 8, 8, 4, 4, 4, 4, 0, 0, 0,
- 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-//error:0.000022
-};
-static const uint8_t obmc16[256]={
- 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0,
- 0, 4, 4, 8, 16, 20, 20, 24, 24, 20, 20, 16, 8, 4, 4, 0,
- 0, 4, 16, 24, 36, 44, 52, 60, 60, 52, 44, 36, 24, 16, 4, 0,
- 0, 8, 24, 44, 60, 80, 96,104,104, 96, 80, 60, 44, 24, 8, 0,
- 0, 16, 36, 60, 92,116,136,152,152,136,116, 92, 60, 36, 16, 0,
- 0, 20, 44, 80,116,152,180,196,196,180,152,116, 80, 44, 20, 0,
- 4, 20, 52, 96,136,180,212,228,228,212,180,136, 96, 52, 20, 4,
- 4, 24, 60,104,152,196,228,248,248,228,196,152,104, 60, 24, 4,
- 4, 24, 60,104,152,196,228,248,248,228,196,152,104, 60, 24, 4,
- 4, 20, 52, 96,136,180,212,228,228,212,180,136, 96, 52, 20, 4,
- 0, 20, 44, 80,116,152,180,196,196,180,152,116, 80, 44, 20, 0,
- 0, 16, 36, 60, 92,116,136,152,152,136,116, 92, 60, 36, 16, 0,
- 0, 8, 24, 44, 60, 80, 96,104,104, 96, 80, 60, 44, 24, 8, 0,
- 0, 4, 16, 24, 36, 44, 52, 60, 60, 52, 44, 36, 24, 16, 4, 0,
- 0, 4, 4, 8, 16, 20, 20, 24, 24, 20, 20, 16, 8, 4, 4, 0,
- 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0,
-//error:0.000033
-};
-#elif 1 // 64*linear
static const uint8_t obmc32[1024]={
0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0,
0, 4, 4, 4, 8, 8, 8, 12, 12, 16, 16, 16, 20, 20, 20, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 8, 8, 8, 4, 4, 4, 0,
@@ -288,62 +106,6 @@ static const uint8_t obmc16[256]={
0, 4, 4, 8, 8, 12, 12, 16, 16, 12, 12, 8, 8, 4, 4, 0,
//error:0.000015
};
-#else //64*cos
-static const uint8_t obmc32[1024]={
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 4, 4, 4, 4, 8, 8, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12, 8, 8, 4, 4, 4, 4, 0, 0, 0,
- 0, 0, 4, 4, 4, 8, 8, 12, 16, 20, 20, 24, 28, 28, 28, 28, 28, 28, 28, 28, 24, 20, 20, 16, 12, 8, 8, 4, 4, 4, 0, 0,
- 0, 0, 4, 4, 8, 12, 16, 20, 24, 28, 36, 40, 44, 44, 48, 48, 48, 48, 44, 44, 40, 36, 28, 24, 20, 16, 12, 8, 4, 4, 0, 0,
- 0, 0, 4, 8, 12, 20, 24, 32, 36, 44, 48, 56, 60, 64, 68, 68, 68, 68, 64, 60, 56, 48, 44, 36, 32, 24, 20, 12, 8, 4, 0, 0,
- 0, 4, 4, 8, 16, 24, 32, 40, 48, 60, 68, 76, 80, 84, 88, 92, 92, 88, 84, 80, 76, 68, 60, 48, 40, 32, 24, 16, 8, 4, 4, 0,
- 0, 4, 8, 12, 20, 32, 40, 52, 64, 76, 84, 96,104,108,112,116,116,112,108,104, 96, 84, 76, 64, 52, 40, 32, 20, 12, 8, 4, 0,
- 0, 4, 8, 16, 24, 36, 48, 64, 76, 92,104,116,124,132,136,140,140,136,132,124,116,104, 92, 76, 64, 48, 36, 24, 16, 8, 4, 0,
- 0, 4, 12, 20, 28, 44, 60, 76, 92,104,120,136,148,156,160,164,164,160,156,148,136,120,104, 92, 76, 60, 44, 28, 20, 12, 4, 0,
- 0, 4, 12, 20, 36, 48, 68, 84,104,120,140,152,168,176,184,188,188,184,176,168,152,140,120,104, 84, 68, 48, 36, 20, 12, 4, 0,
- 0, 4, 12, 24, 36, 56, 76, 96,116,136,152,172,184,196,204,208,208,204,196,184,172,152,136,116, 96, 76, 56, 36, 24, 12, 4, 0,
- 0, 4, 12, 24, 44, 60, 80,104,124,148,168,184,200,212,224,228,228,224,212,200,184,168,148,124,104, 80, 60, 44, 24, 12, 4, 0,
- 0, 4, 12, 28, 44, 64, 84,108,132,156,176,196,212,228,236,240,240,236,228,212,196,176,156,132,108, 84, 64, 44, 28, 12, 4, 0,
- 0, 4, 16, 28, 48, 68, 88,112,136,160,184,204,224,236,244,252,252,244,236,224,204,184,160,136,112, 88, 68, 48, 28, 16, 4, 0,
- 1, 4, 16, 28, 48, 68, 92,116,140,164,188,208,228,240,252,255,255,252,240,228,208,188,164,140,116, 92, 68, 48, 28, 16, 4, 1,
- 1, 4, 16, 28, 48, 68, 92,116,140,164,188,208,228,240,252,255,255,252,240,228,208,188,164,140,116, 92, 68, 48, 28, 16, 4, 1,
- 0, 4, 16, 28, 48, 68, 88,112,136,160,184,204,224,236,244,252,252,244,236,224,204,184,160,136,112, 88, 68, 48, 28, 16, 4, 0,
- 0, 4, 12, 28, 44, 64, 84,108,132,156,176,196,212,228,236,240,240,236,228,212,196,176,156,132,108, 84, 64, 44, 28, 12, 4, 0,
- 0, 4, 12, 24, 44, 60, 80,104,124,148,168,184,200,212,224,228,228,224,212,200,184,168,148,124,104, 80, 60, 44, 24, 12, 4, 0,
- 0, 4, 12, 24, 36, 56, 76, 96,116,136,152,172,184,196,204,208,208,204,196,184,172,152,136,116, 96, 76, 56, 36, 24, 12, 4, 0,
- 0, 4, 12, 20, 36, 48, 68, 84,104,120,140,152,168,176,184,188,188,184,176,168,152,140,120,104, 84, 68, 48, 36, 20, 12, 4, 0,
- 0, 4, 12, 20, 28, 44, 60, 76, 92,104,120,136,148,156,160,164,164,160,156,148,136,120,104, 92, 76, 60, 44, 28, 20, 12, 4, 0,
- 0, 4, 8, 16, 24, 36, 48, 64, 76, 92,104,116,124,132,136,140,140,136,132,124,116,104, 92, 76, 64, 48, 36, 24, 16, 8, 4, 0,
- 0, 4, 8, 12, 20, 32, 40, 52, 64, 76, 84, 96,104,108,112,116,116,112,108,104, 96, 84, 76, 64, 52, 40, 32, 20, 12, 8, 4, 0,
- 0, 4, 4, 8, 16, 24, 32, 40, 48, 60, 68, 76, 80, 84, 88, 92, 92, 88, 84, 80, 76, 68, 60, 48, 40, 32, 24, 16, 8, 4, 4, 0,
- 0, 0, 4, 8, 12, 20, 24, 32, 36, 44, 48, 56, 60, 64, 68, 68, 68, 68, 64, 60, 56, 48, 44, 36, 32, 24, 20, 12, 8, 4, 0, 0,
- 0, 0, 4, 4, 8, 12, 16, 20, 24, 28, 36, 40, 44, 44, 48, 48, 48, 48, 44, 44, 40, 36, 28, 24, 20, 16, 12, 8, 4, 4, 0, 0,
- 0, 0, 4, 4, 4, 8, 8, 12, 16, 20, 20, 24, 28, 28, 28, 28, 28, 28, 28, 28, 24, 20, 20, 16, 12, 8, 8, 4, 4, 4, 0, 0,
- 0, 0, 0, 4, 4, 4, 4, 8, 8, 12, 12, 12, 12, 16, 16, 16, 16, 16, 16, 12, 12, 12, 12, 8, 8, 4, 4, 4, 4, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-//error:0.000022
-};
-static const uint8_t obmc16[256]={
- 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0,
- 0, 0, 4, 8, 12, 16, 20, 20, 20, 20, 16, 12, 8, 4, 0, 0,
- 0, 4, 12, 24, 32, 44, 52, 56, 56, 52, 44, 32, 24, 12, 4, 0,
- 0, 8, 24, 40, 60, 80, 96,104,104, 96, 80, 60, 40, 24, 8, 0,
- 0, 12, 32, 64, 92,120,140,152,152,140,120, 92, 64, 32, 12, 0,
- 4, 16, 44, 80,120,156,184,196,196,184,156,120, 80, 44, 16, 4,
- 4, 20, 52, 96,140,184,216,232,232,216,184,140, 96, 52, 20, 4,
- 0, 20, 56,104,152,196,232,252,252,232,196,152,104, 56, 20, 0,
- 0, 20, 56,104,152,196,232,252,252,232,196,152,104, 56, 20, 0,
- 4, 20, 52, 96,140,184,216,232,232,216,184,140, 96, 52, 20, 4,
- 4, 16, 44, 80,120,156,184,196,196,184,156,120, 80, 44, 16, 4,
- 0, 12, 32, 64, 92,120,140,152,152,140,120, 92, 64, 32, 12, 0,
- 0, 8, 24, 40, 60, 80, 96,104,104, 96, 80, 60, 40, 24, 8, 0,
- 0, 4, 12, 24, 32, 44, 52, 56, 56, 52, 44, 32, 24, 12, 4, 0,
- 0, 0, 4, 8, 12, 16, 20, 20, 20, 20, 16, 12, 8, 4, 0, 0,
- 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0,
-//error:0.000022
-};
-#endif /* 0 */
//linear *64
static const uint8_t obmc8[64]={
@@ -509,7 +271,6 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe
if(v){
const int a= FFABS(v);
const int e= av_log2(a);
-#if 1
const int el= FFMIN(e, 10);
put_rac(c, state+0, 0);
@@ -530,35 +291,6 @@ static inline void put_symbol(RangeCoder *c, uint8_t *state, int v, int is_signe
if(is_signed)
put_rac(c, state+11 + el, v < 0); //11..21
-#else
-
- put_rac(c, state+0, 0);
- if(e<=9){
- for(i=0; i<e; i++){
- put_rac(c, state+1+i, 1); //1..10
- }
- put_rac(c, state+1+i, 0);
-
- for(i=e-1; i>=0; i--){
- put_rac(c, state+22+i, (a>>i)&1); //22..31
- }
-
- if(is_signed)
- put_rac(c, state+11 + e, v < 0); //11..21
- }else{
- for(i=0; i<e; i++){
- put_rac(c, state+1+FFMIN(i,9), 1); //1..10
- }
- put_rac(c, state+1+9, 0);
-
- for(i=e-1; i>=0; i--){
- put_rac(c, state+22+FFMIN(i,9), (a>>i)&1); //22..31
- }
-
- if(is_signed)
- put_rac(c, state+11 + 10, v < 0); //11..21
- }
-#endif /* 1 */
}else{
put_rac(c, state+0, 1);
}
@@ -789,14 +521,6 @@ static int alloc_blocks(SnowContext *s){
return 0;
}
-static inline void copy_rac_state(RangeCoder *d, RangeCoder *s){
- uint8_t *bytestream= d->bytestream;
- uint8_t *bytestream_start= d->bytestream_start;
- *d= *s;
- d->bytestream= bytestream;
- d->bytestream_start= bytestream_start;
-}
-
static inline void set_blocks(SnowContext *s, int level, int x, int y, int l, int cb, int cr, int mx, int my, int ref, int type){
const int w= s->b_width << s->block_max_depth;
const int rem_depth= s->block_max_depth - level;
@@ -1323,40 +1047,6 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
block[3]= ptmp;
pred_block(s, block[3], tmp, src_stride, src_x, src_y, b_w, b_h, rb, plane_index, w, h);
}
-#if 0
- for(y=0; y<b_h; y++){
- for(x=0; x<b_w; x++){
- int v= obmc [x + y*obmc_stride] * block[3][x + y*src_stride] * (256/OBMC_MAX);
- if(add) dst[x + y*dst_stride] += v;
- else dst[x + y*dst_stride] -= v;
- }
- }
- for(y=0; y<b_h; y++){
- uint8_t *obmc2= obmc + (obmc_stride>>1);
- for(x=0; x<b_w; x++){
- int v= obmc2[x + y*obmc_stride] * block[2][x + y*src_stride] * (256/OBMC_MAX);
- if(add) dst[x + y*dst_stride] += v;
- else dst[x + y*dst_stride] -= v;
- }
- }
- for(y=0; y<b_h; y++){
- uint8_t *obmc3= obmc + obmc_stride*(obmc_stride>>1);
- for(x=0; x<b_w; x++){
- int v= obmc3[x + y*obmc_stride] * block[1][x + y*src_stride] * (256/OBMC_MAX);
- if(add) dst[x + y*dst_stride] += v;
- else dst[x + y*dst_stride] -= v;
- }
- }
- for(y=0; y<b_h; y++){
- uint8_t *obmc3= obmc + obmc_stride*(obmc_stride>>1);
- uint8_t *obmc4= obmc3+ (obmc_stride>>1);
- for(x=0; x<b_w; x++){
- int v= obmc4[x + y*obmc_stride] * block[0][x + y*src_stride] * (256/OBMC_MAX);
- if(add) dst[x + y*dst_stride] += v;
- else dst[x + y*dst_stride] -= v;
- }
- }
-#else
if(sliced){
s->dwt.inner_add_yblock(obmc, obmc_stride, block, b_w, b_h, src_x,src_y, src_stride, sb, add, dst8);
}else{
@@ -1387,7 +1077,6 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer
}
}
}
-#endif /* 0 */
}
static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){
@@ -4008,6 +3697,7 @@ AVCodec ff_snow_encoder = {
#undef printf
#include "libavutil/lfg.h"
+#include "libavutil/mathematics.h"
int main(void){
int width=256;
@@ -4042,27 +3732,6 @@ int main(void){
for(i=0; i<width*height; i++)
if(FFABS(buffer[0][i] - buffer[1][i])>20) printf("fsck: %6d %12d %7d\n",i, buffer[0][i], buffer[1][i]);
-#if 0
- printf("testing AC coder\n");
- memset(s.header_state, 0, sizeof(s.header_state));
- ff_init_range_encoder(&s.c, buffer[0], 256*256);
- ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64);
-
- for(i=-256; i<256; i++){
- put_symbol(&s.c, s.header_state, i*i*i/3*FFABS(i), 1);
- }
- ff_rac_terminate(&s.c);
-
- memset(s.header_state, 0, sizeof(s.header_state));
- ff_init_range_decoder(&s.c, buffer[0], 256*256);
- ff_init_cabac_states(&s.c, ff_h264_lps_range, ff_h264_mps_state, ff_h264_lps_state, 64);
-
- for(i=-256; i<256; i++){
- int j;
- j= get_symbol(&s.c, s.header_state, 1);
- if(j!=i*i*i/3*FFABS(i)) printf("fsck: %d != %d\n", i, j);
- }
-#endif
{
int level, orientation, x, y;
int64_t errors[8][4];
@@ -4120,7 +3789,6 @@ int main(void){
buf+=stride>>1;
memset(buffer[0], 0, sizeof(int)*width*height);
-#if 1
for(y=0; y<height; y++){
for(x=0; x<width; x++){
int tab[4]={0,2,3,1};
@@ -4128,15 +3796,6 @@ int main(void){
}
}
ff_spatial_dwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-#else
- for(y=0; y<h; y++){
- for(x=0; x<w; x++){
- buf[x + y*stride ]=169;
- buf[x + y*stride-w]=64;
- }
- }
- ff_spatial_idwt(buffer[0], width, height, width, s.spatial_decomposition_type, s.spatial_decomposition_count);
-#endif
for(y=0; y<height; y++){
for(x=0; x<width; x++){
int64_t d= buffer[0][x + y*width];
diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c
index 30cd0f1..ff0c668 100644
--- a/libavcodec/svq3.c
+++ b/libavcodec/svq3.c
@@ -591,7 +591,7 @@ static int svq3_decode_mb(SVQ3Context *svq3, unsigned int mb_type)
}
}
- ff_h264_write_back_intra_pred_mode(h);
+ write_back_intra_pred_mode(h);
if (mb_type == 8) {
ff_h264_check_intra4x4_pred_mode(h);
diff --git a/libavcodec/tableprint.h b/libavcodec/tableprint.h
index d3e4dd9..e126a72 100644
--- a/libavcodec/tableprint.h
+++ b/libavcodec/tableprint.h
@@ -56,7 +56,7 @@ void write_##type##_2d_array(const void *arg, int len, int len2)\
}
/**
- * @defgroup printfuncs Predefined functions for printing tables
+ * @name Predefined functions for printing tables
*
* \{
*/
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index bc08e35..0c84965 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -27,6 +27,7 @@
#include "libavutil/avstring.h"
#include "libavutil/crc.h"
+#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "libavutil/imgutils.h"
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index e062a35..d6b48b4 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -40,7 +40,7 @@
/***********************************************************************/
/**
- * @defgroup vc1bitplane VC-1 Bitplane decoding
+ * @name VC-1 Bitplane decoding
* @see 8.7, p56
* @{
*/
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index 852c874..172eb6f 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -45,7 +45,6 @@
#define MB_INTRA_VLC_BITS 9
#define DC_VLC_BITS 9
#define AC_VLC_BITS 9
-static const uint16_t table_mb_intra[64][2];
static const uint16_t vlc_offs[] = {
@@ -137,7 +136,7 @@ static int vc1_init_common(VC1Context *v)
/***********************************************************************/
/**
- * @defgroup vc1bitplane VC-1 Bitplane decoding
+ * @name VC-1 Bitplane decoding
* @see 8.7, p56
* @{
*/
@@ -774,7 +773,7 @@ static void vc1_mc_4mv_chroma(VC1Context *v)
/***********************************************************************/
/**
- * @defgroup vc1block VC-1 Block-level functions
+ * @name VC-1 Block-level functions
* @see 7.1.4, p91 and 8.1.1.7, p(1)04
* @{
*/
@@ -1512,7 +1511,7 @@ static inline int vc1_pred_dc(MpegEncContext *s, int overlap, int pq, int n,
/** @} */ // Block group
/**
- * @defgroup vc1_std_mb VC1 Macroblock-level functions in Simple/Main Profiles
+ * @name VC1 Macroblock-level functions in Simple/Main Profiles
* @see 7.1.4, p91 and 8.1.1.7, p(1)04
* @{
*/
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 082d8e5..beb4de3 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -641,8 +641,6 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
* @param block destination for block coefficients
* @param probs probabilities to use when reading trees from the bitstream
* @param i initial coeff index, 0 unless a separate DC block is coded
- * @param zero_nhood the initial prediction context for number of surrounding
- * all-zero blocks (only left/top, so 0-2)
* @param qmul array holding the dc/ac dequant factor at position 0/1
* @return 0 if no coeffs were decoded
* otherwise, the index of the last coeff decoded plus one
@@ -701,6 +699,17 @@ skip_eob:
}
#endif
+/**
+ * @param c arithmetic bitstream reader context
+ * @param block destination for block coefficients
+ * @param probs probabilities to use when reading trees from the bitstream
+ * @param i initial coeff index, 0 unless a separate DC block is coded
+ * @param zero_nhood the initial prediction context for number of surrounding
+ * all-zero blocks (only left/top, so 0-2)
+ * @param qmul array holding the dc/ac dequant factor at position 0/1
+ * @return 0 if no coeffs were decoded
+ * otherwise, the index of the last coeff decoded plus one
+ */
static av_always_inline
int decode_block_coeffs(VP56RangeCoder *c, DCTELEM block[16],
uint8_t probs[16][3][NUM_DCT_TOKENS-1],
@@ -1034,12 +1043,11 @@ static const uint8_t subpel_idx[3][8] = {
};
/**
- * Generic MC function.
+ * luma MC function
*
* @param s VP8 decoding context
- * @param luma 1 for luma (Y) planes, 0 for chroma (Cb/Cr) planes
* @param dst target buffer for block data at block position
- * @param src reference picture buffer at origin (0, 0)
+ * @param ref reference picture buffer at origin (0, 0)
* @param mv motion vector (relative to block position) to get pixel data from
* @param x_off horizontal position of block from origin (0, 0)
* @param y_off vertical position of block from origin (0, 0)
@@ -1083,6 +1091,23 @@ void vp8_mc_luma(VP8Context *s, uint8_t *dst, AVFrame *ref, const VP56mv *mv,
}
}
+/**
+ * chroma MC function
+ *
+ * @param s VP8 decoding context
+ * @param dst1 target buffer for block data at block position (U plane)
+ * @param dst2 target buffer for block data at block position (V plane)
+ * @param ref reference picture buffer at origin (0, 0)
+ * @param mv motion vector (relative to block position) to get pixel data from
+ * @param x_off horizontal position of block from origin (0, 0)
+ * @param y_off vertical position of block from origin (0, 0)
+ * @param block_w width of block (16, 8 or 4)
+ * @param block_h height of block (always same as block_w)
+ * @param width width of src/dst plane data
+ * @param height height of src/dst plane data
+ * @param linesize size of a single line of plane data, including padding
+ * @param mc_func motion compensation function pointers (bilinear or sixtap MC)
+ */
static av_always_inline
void vp8_mc_chroma(VP8Context *s, uint8_t *dst1, uint8_t *dst2, AVFrame *ref,
const VP56mv *mv, int x_off, int y_off,
diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c
index 3604eac..002c529 100644
--- a/libavcodec/wmavoice.c
+++ b/libavcodec/wmavoice.c
@@ -128,9 +128,7 @@ static const struct frame_type_desc {
*/
typedef struct {
/**
- * @defgroup struct_global Global values
- * Global values, specified in the stream header / extradata or used
- * all over.
+ * @name Global values specified in the stream header / extradata or used all over.
* @{
*/
GetBitContext gb; ///< packet bitreader. During decoder init,
@@ -182,8 +180,9 @@ typedef struct {
/**
* @}
- * @defgroup struct_packet Packet values
- * Packet values, specified in the packet header or related to a packet.
+ *
+ * @name Packet values specified in the packet header or related to a packet.
+ *
* A packet is considered to be a single unit of data provided to this
* decoder by the demuxer.
* @{
@@ -213,7 +212,8 @@ typedef struct {
/**
* @}
- * @defgroup struct_frame Frame and superframe values
+ *
+ * @name Frame and superframe values
* Superframe and frame data - these can change from frame to frame,
* although some of them do in that case serve as a cache / history for
* the next frame or superframe.
@@ -256,7 +256,9 @@ typedef struct {
float synth_history[MAX_LSPS]; ///< see #excitation_history
/**
* @}
- * @defgroup post_filter Postfilter values
+ *
+ * @name Postfilter values
+ *
* Variables used for postfilter implementation, mostly history for
* smoothing and so on, and context variables for FFT/iFFT.
* @{
@@ -432,7 +434,7 @@ static av_cold int wmavoice_decode_init(AVCodecContext *ctx)
}
/**
- * @defgroup postfilter Postfilter functions
+ * @name Postfilter functions
* Postfilter functions (gain control, wiener denoise filter, DC filter,
* kalman smoothening, plus surrounding code to wrap it)
* @{
@@ -825,7 +827,7 @@ static void dequant_lsps(double *lsps, int num,
}
/**
- * @defgroup lsp_dequant LSP dequantization routines
+ * @name LSP dequantization routines
* LSP dequantization routines, for 10/16LSPs and independent/residual coding.
* @note we assume enough bits are available, caller should check.
* lsp10i() consumes 24 bits; lsp10r() consumes an additional 24 bits;
@@ -969,7 +971,7 @@ static void dequant_lsp16r(GetBitContext *gb,
/**
* @}
- * @defgroup aw Pitch-adaptive window coding functions
+ * @name Pitch-adaptive window coding functions
* The next few functions are for pitch-adaptive window coding.
* @{
*/
diff --git a/libavcodec/x86/Makefile b/libavcodec/x86/Makefile
index 7579cb1..09f65e8 100644
--- a/libavcodec/x86/Makefile
+++ b/libavcodec/x86/Makefile
@@ -47,6 +47,7 @@ MMX-OBJS-$(HAVE_YASM) += x86/dsputil_yasm.o \
x86/fmtconvert.o \
x86/h264_chromamc.o \
x86/h264_chromamc_10bit.o \
+ x86/h264_qpel_10bit.o \
$(YASM-OBJS-yes)
MMX-OBJS-$(CONFIG_FFT) += x86/fft.o
diff --git a/libavcodec/x86/ac3dsp.asm b/libavcodec/x86/ac3dsp.asm
index 99c5df3..8c958a1 100644
--- a/libavcodec/x86/ac3dsp.asm
+++ b/libavcodec/x86/ac3dsp.asm
@@ -32,6 +32,11 @@ cextern ac3_bap_bits
pw_bap_mul1: dw 21846, 21846, 0, 32768, 21846, 21846, 0, 32768
pw_bap_mul2: dw 5, 7, 0, 7, 5, 7, 0, 7
+; used in ff_ac3_extract_exponents()
+pd_1: times 4 dd 1
+pd_151: times 4 dd 151
+pb_shuf_4dwb: db 0, 4, 8, 12
+
SECTION .text
;-----------------------------------------------------------------------------
@@ -346,3 +351,100 @@ cglobal ac3_compute_mantissa_size_sse2, 1,2,4, mant_cnt, sum
movd eax, m0
add eax, sumd
RET
+
+;------------------------------------------------------------------------------
+; void ff_ac3_extract_exponents(uint8_t *exp, int32_t *coef, int nb_coefs)
+;------------------------------------------------------------------------------
+
+%macro PABSD_MMX 2 ; src/dst, tmp
+ pxor %2, %2
+ pcmpgtd %2, %1
+ pxor %1, %2
+ psubd %1, %2
+%endmacro
+
+%macro PABSD_SSSE3 1-2 ; src/dst, unused
+ pabsd %1, %1
+%endmacro
+
+%ifdef HAVE_AMD3DNOW
+INIT_MMX
+cglobal ac3_extract_exponents_3dnow, 3,3,0, exp, coef, len
+ add expq, lenq
+ lea coefq, [coefq+4*lenq]
+ neg lenq
+ movq m3, [pd_1]
+ movq m4, [pd_151]
+.loop:
+ movq m0, [coefq+4*lenq ]
+ movq m1, [coefq+4*lenq+8]
+ PABSD_MMX m0, m2
+ PABSD_MMX m1, m2
+ pslld m0, 1
+ por m0, m3
+ pi2fd m2, m0
+ psrld m2, 23
+ movq m0, m4
+ psubd m0, m2
+ pslld m1, 1
+ por m1, m3
+ pi2fd m2, m1
+ psrld m2, 23
+ movq m1, m4
+ psubd m1, m2
+ packssdw m0, m0
+ packuswb m0, m0
+ packssdw m1, m1
+ packuswb m1, m1
+ punpcklwd m0, m1
+ movd [expq+lenq], m0
+ add lenq, 4
+ jl .loop
+ REP_RET
+%endif
+
+%macro AC3_EXTRACT_EXPONENTS 1
+cglobal ac3_extract_exponents_%1, 3,3,5, exp, coef, len
+ add expq, lenq
+ lea coefq, [coefq+4*lenq]
+ neg lenq
+ mova m2, [pd_1]
+ mova m3, [pd_151]
+%ifidn %1, ssse3 ;
+ movd m4, [pb_shuf_4dwb]
+%endif
+.loop:
+ ; move 4 32-bit coefs to xmm0
+ mova m0, [coefq+4*lenq]
+ ; absolute value
+ PABSD m0, m1
+ ; convert to float and extract exponents
+ pslld m0, 1
+ por m0, m2
+ cvtdq2ps m1, m0
+ psrld m1, 23
+ mova m0, m3
+ psubd m0, m1
+ ; move the lowest byte in each of 4 dwords to the low dword
+%ifidn %1, ssse3
+ pshufb m0, m4
+%else
+ packssdw m0, m0
+ packuswb m0, m0
+%endif
+ movd [expq+lenq], m0
+
+ add lenq, 4
+ jl .loop
+ REP_RET
+%endmacro
+
+%ifdef HAVE_SSE
+INIT_XMM
+%define PABSD PABSD_MMX
+AC3_EXTRACT_EXPONENTS sse2
+%ifdef HAVE_SSSE3
+%define PABSD PABSD_SSSE3
+AC3_EXTRACT_EXPONENTS ssse3
+%endif
+%endif
diff --git a/libavcodec/x86/ac3dsp_mmx.c b/libavcodec/x86/ac3dsp_mmx.c
index e853b88..3127570 100644
--- a/libavcodec/x86/ac3dsp_mmx.c
+++ b/libavcodec/x86/ac3dsp_mmx.c
@@ -44,6 +44,10 @@ extern void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned i
extern int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]);
+extern void ff_ac3_extract_exponents_3dnow(uint8_t *exp, int32_t *coef, int nb_coefs);
+extern void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs);
+extern void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs);
+
av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
{
int mm_flags = av_get_cpu_flags();
@@ -56,6 +60,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx;
}
if (mm_flags & AV_CPU_FLAG_3DNOW && HAVE_AMD3DNOW) {
+ c->extract_exponents = ff_ac3_extract_exponents_3dnow;
if (!bit_exact) {
c->float_to_fixed24 = ff_float_to_fixed24_3dnow;
}
@@ -72,6 +77,7 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2;
c->float_to_fixed24 = ff_float_to_fixed24_sse2;
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2;
+ c->extract_exponents = ff_ac3_extract_exponents_sse2;
if (!(mm_flags & AV_CPU_FLAG_SSE2SLOW)) {
c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2;
c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2;
@@ -79,6 +85,9 @@ av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact)
}
if (mm_flags & AV_CPU_FLAG_SSSE3 && HAVE_SSSE3) {
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3;
+ if (!(mm_flags & AV_CPU_FLAG_ATOM)) {
+ c->extract_exponents = ff_ac3_extract_exponents_ssse3;
+ }
}
#endif
}
diff --git a/libavcodec/x86/dsputil_mmx.c b/libavcodec/x86/dsputil_mmx.c
index 78cad4c..6400486 100644
--- a/libavcodec/x86/dsputil_mmx.c
+++ b/libavcodec/x86/dsputil_mmx.c
@@ -42,7 +42,7 @@ DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL;
DECLARE_ALIGNED(16, const uint64_t, ff_pdw_80000000)[2] =
{0x8000000080000000ULL, 0x8000000080000000ULL};
-DECLARE_ALIGNED(8, const uint64_t, ff_pw_1 ) = 0x0001000100010001ULL;
+DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1 ) = {0x0001000100010001ULL, 0x0001000100010001ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_2 ) = {0x0002000200020002ULL, 0x0002000200020002ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3 ) = {0x0003000300030003ULL, 0x0003000300030003ULL};
DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4 ) = {0x0004000400040004ULL, 0x0004000400040004ULL};
@@ -2333,6 +2333,15 @@ int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, int w, i
float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
+void ff_vector_clip_int32_mmx (int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
+void ff_vector_clip_int32_sse2 (int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
+void ff_vector_clip_int32_sse2_int(int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
+void ff_vector_clip_int32_sse41 (int32_t *dst, const int32_t *src, int32_t min,
+ int32_t max, unsigned int len);
+
void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
{
int mm_flags = av_get_cpu_flags();
@@ -2473,6 +2482,8 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->put_rv40_chroma_pixels_tab[0]= ff_put_rv40_chroma_mc8_mmx;
c->put_rv40_chroma_pixels_tab[1]= ff_put_rv40_chroma_mc4_mmx;
+
+ c->vector_clip_int32 = ff_vector_clip_int32_mmx;
#endif
if (mm_flags & AV_CPU_FLAG_MMX2) {
@@ -2519,44 +2530,56 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_mmx2;
}
-#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU) \
- c->PFX ## _pixels_tab[IDX][ 0] = PFX ## SIZE ## _mc00_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 1] = PFX ## SIZE ## _mc10_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 2] = PFX ## SIZE ## _mc20_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 3] = PFX ## SIZE ## _mc30_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 4] = PFX ## SIZE ## _mc01_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 5] = PFX ## SIZE ## _mc11_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 6] = PFX ## SIZE ## _mc21_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 7] = PFX ## SIZE ## _mc31_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 8] = PFX ## SIZE ## _mc02_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][ 9] = PFX ## SIZE ## _mc12_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][10] = PFX ## SIZE ## _mc22_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][11] = PFX ## SIZE ## _mc32_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][12] = PFX ## SIZE ## _mc03_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][13] = PFX ## SIZE ## _mc13_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][14] = PFX ## SIZE ## _mc23_ ## CPU; \
- c->PFX ## _pixels_tab[IDX][15] = PFX ## SIZE ## _mc33_ ## CPU
-
- SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2);
- SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2);
- SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2);
+#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \
+ c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 7] = PREFIX ## PFX ## SIZE ## _mc31_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 8] = PREFIX ## PFX ## SIZE ## _mc02_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][ 9] = PREFIX ## PFX ## SIZE ## _mc12_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][10] = PREFIX ## PFX ## SIZE ## _mc22_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][11] = PREFIX ## PFX ## SIZE ## _mc32_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][12] = PREFIX ## PFX ## SIZE ## _mc03_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][13] = PREFIX ## PFX ## SIZE ## _mc13_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][14] = PREFIX ## PFX ## SIZE ## _mc23_ ## CPU; \
+ c->PFX ## _pixels_tab[IDX][15] = PREFIX ## PFX ## SIZE ## _mc33_ ## CPU
+
+ SET_QPEL_FUNCS(put_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(put_qpel, 1, 8, mmx2, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmx2, );
+ SET_QPEL_FUNCS(avg_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(avg_qpel, 1, 8, mmx2, );
if (!high_bit_depth) {
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2);
- SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2);
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2);
- SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2);
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, mmx2, );
+ SET_QPEL_FUNCS(put_h264_qpel, 2, 4, mmx2, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, mmx2, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, mmx2, );
+ }
+ else if (bit_depth == 10) {
+#if HAVE_YASM
+#if !ARCH_X86_64
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_mmxext, ff_);
+#endif
+ SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 10_mmxext, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 10_mmxext, ff_);
+#endif
}
- SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2);
- SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2);
- SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2);
+ SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, mmx2, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, mmx2, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, mmx2, );
#if HAVE_YASM
c->avg_rv40_chroma_pixels_tab[0]= ff_avg_rv40_chroma_mc8_mmx2;
@@ -2616,26 +2639,26 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
c->put_no_rnd_pixels_tab[1][2] = put_no_rnd_pixels8_y2_exact_3dnow;
}
- SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow);
- SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow);
- SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow);
+ SET_QPEL_FUNCS(put_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(put_qpel, 1, 8, 3dnow, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, 3dnow, );
+ SET_QPEL_FUNCS(avg_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(avg_qpel, 1, 8, 3dnow, );
if (!high_bit_depth) {
- SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow);
- SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow);
- SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow);
- SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow);
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 3dnow, );
+ SET_QPEL_FUNCS(put_h264_qpel, 2, 4, 3dnow, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 3dnow, );
+ SET_QPEL_FUNCS(avg_h264_qpel, 2, 4, 3dnow, );
}
- SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow);
- SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow);
- SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow);
+ SET_QPEL_FUNCS(put_2tap_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(put_2tap_qpel, 1, 8, 3dnow, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 0, 16, 3dnow, );
+ SET_QPEL_FUNCS(avg_2tap_qpel, 1, 8, 3dnow, );
#if HAVE_YASM
if (!high_bit_depth) {
@@ -2679,7 +2702,20 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
H264_QPEL_FUNCS(3, 3, sse2);
}
#if HAVE_YASM
+#define H264_QPEL_FUNCS_10(x, y, CPU)\
+ c->put_h264_qpel_pixels_tab[0][x+y*4] = ff_put_h264_qpel16_mc##x##y##_10_##CPU;\
+ c->put_h264_qpel_pixels_tab[1][x+y*4] = ff_put_h264_qpel8_mc##x##y##_10_##CPU;\
+ c->avg_h264_qpel_pixels_tab[0][x+y*4] = ff_avg_h264_qpel16_mc##x##y##_10_##CPU;\
+ c->avg_h264_qpel_pixels_tab[1][x+y*4] = ff_avg_h264_qpel8_mc##x##y##_10_##CPU;
if (bit_depth == 10) {
+ SET_QPEL_FUNCS(put_h264_qpel, 0, 16, 10_sse2, ff_);
+ SET_QPEL_FUNCS(put_h264_qpel, 1, 8, 10_sse2, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 0, 16, 10_sse2, ff_);
+ SET_QPEL_FUNCS(avg_h264_qpel, 1, 8, 10_sse2, ff_);
+ H264_QPEL_FUNCS_10(1, 0, sse2_cache64)
+ H264_QPEL_FUNCS_10(2, 0, sse2_cache64)
+ H264_QPEL_FUNCS_10(3, 0, sse2_cache64)
+
c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_10_sse2;
c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_10_sse2;
}
@@ -2702,6 +2738,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
H264_QPEL_FUNCS(3, 3, ssse3);
}
#if HAVE_YASM
+ else if (bit_depth == 10) {
+ H264_QPEL_FUNCS_10(1, 0, ssse3_cache64)
+ H264_QPEL_FUNCS_10(2, 0, ssse3_cache64)
+ H264_QPEL_FUNCS_10(3, 0, ssse3_cache64)
+ }
if (!high_bit_depth) {
c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_ssse3_rnd;
c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_ssse3_rnd;
@@ -2756,6 +2797,11 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
#if HAVE_YASM
c->scalarproduct_int16 = ff_scalarproduct_int16_sse2;
c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2;
+ if (mm_flags & AV_CPU_FLAG_ATOM) {
+ c->vector_clip_int32 = ff_vector_clip_int32_sse2_int;
+ } else {
+ c->vector_clip_int32 = ff_vector_clip_int32_sse2;
+ }
if (avctx->flags & CODEC_FLAG_BITEXACT) {
c->apply_window_int16 = ff_apply_window_int16_sse2_ba;
} else {
@@ -2781,9 +2827,22 @@ void dsputil_init_mmx(DSPContext* c, AVCodecContext *avctx)
}
#endif
}
+
+ if (mm_flags & AV_CPU_FLAG_SSE4 && HAVE_SSE) {
+#if HAVE_YASM
+ c->vector_clip_int32 = ff_vector_clip_int32_sse41;
+#endif
+ }
+
#if HAVE_AVX && HAVE_YASM
if (mm_flags & AV_CPU_FLAG_AVX) {
if (bit_depth == 10) {
+ //AVX implies !cache64.
+ //TODO: Port cache(32|64) detection from x264.
+ H264_QPEL_FUNCS_10(1, 0, sse2)
+ H264_QPEL_FUNCS_10(2, 0, sse2)
+ H264_QPEL_FUNCS_10(3, 0, sse2)
+
c->put_h264_chroma_pixels_tab[0]= ff_put_h264_chroma_mc8_10_avx;
c->avg_h264_chroma_pixels_tab[0]= ff_avg_h264_chroma_mc8_10_avx;
}
diff --git a/libavcodec/x86/dsputil_yasm.asm b/libavcodec/x86/dsputil_yasm.asm
index 695aba5..1f5a4f6 100644
--- a/libavcodec/x86/dsputil_yasm.asm
+++ b/libavcodec/x86/dsputil_yasm.asm
@@ -1048,3 +1048,118 @@ emu_edge sse
%ifdef ARCH_X86_32
emu_edge mmx
%endif
+
+;-----------------------------------------------------------------------------
+; void ff_vector_clip_int32(int32_t *dst, const int32_t *src, int32_t min,
+; int32_t max, unsigned int len)
+;-----------------------------------------------------------------------------
+
+%macro PMINSD_MMX 3 ; dst, src, tmp
+ mova %3, %2
+ pcmpgtd %3, %1
+ pxor %1, %2
+ pand %1, %3
+ pxor %1, %2
+%endmacro
+
+%macro PMAXSD_MMX 3 ; dst, src, tmp
+ mova %3, %1
+ pcmpgtd %3, %2
+ pand %1, %3
+ pandn %3, %2
+ por %1, %3
+%endmacro
+
+%macro CLIPD_MMX 3-4 ; src/dst, min, max, tmp
+ PMINSD_MMX %1, %3, %4
+ PMAXSD_MMX %1, %2, %4
+%endmacro
+
+%macro CLIPD_SSE2 3-4 ; src/dst, min (float), max (float), unused
+ cvtdq2ps %1, %1
+ minps %1, %3
+ maxps %1, %2
+ cvtps2dq %1, %1
+%endmacro
+
+%macro CLIPD_SSE41 3-4 ; src/dst, min, max, unused
+ pminsd %1, %3
+ pmaxsd %1, %2
+%endmacro
+
+%macro SPLATD_MMX 1
+ punpckldq %1, %1
+%endmacro
+
+%macro SPLATD_SSE2 1
+ pshufd %1, %1, 0
+%endmacro
+
+%macro VECTOR_CLIP_INT32 4
+cglobal vector_clip_int32_%1, 5,5,%2, dst, src, min, max, len
+%ifidn %1, sse2
+ cvtsi2ss m4, minm
+ cvtsi2ss m5, maxm
+%else
+ movd m4, minm
+ movd m5, maxm
+%endif
+ SPLATD m4
+ SPLATD m5
+.loop:
+%assign %%i 1
+%rep %3
+ mova m0, [srcq+mmsize*0*%%i]
+ mova m1, [srcq+mmsize*1*%%i]
+ mova m2, [srcq+mmsize*2*%%i]
+ mova m3, [srcq+mmsize*3*%%i]
+%if %4
+ mova m7, [srcq+mmsize*4*%%i]
+ mova m8, [srcq+mmsize*5*%%i]
+ mova m9, [srcq+mmsize*6*%%i]
+ mova m10, [srcq+mmsize*7*%%i]
+%endif
+ CLIPD m0, m4, m5, m6
+ CLIPD m1, m4, m5, m6
+ CLIPD m2, m4, m5, m6
+ CLIPD m3, m4, m5, m6
+%if %4
+ CLIPD m7, m4, m5, m6
+ CLIPD m8, m4, m5, m6
+ CLIPD m9, m4, m5, m6
+ CLIPD m10, m4, m5, m6
+%endif
+ mova [dstq+mmsize*0*%%i], m0
+ mova [dstq+mmsize*1*%%i], m1
+ mova [dstq+mmsize*2*%%i], m2
+ mova [dstq+mmsize*3*%%i], m3
+%if %4
+ mova [dstq+mmsize*4*%%i], m7
+ mova [dstq+mmsize*5*%%i], m8
+ mova [dstq+mmsize*6*%%i], m9
+ mova [dstq+mmsize*7*%%i], m10
+%endif
+%assign %%i %%i+1
+%endrep
+ add srcq, mmsize*4*(%3+%4)
+ add dstq, mmsize*4*(%3+%4)
+ sub lend, mmsize*(%3+%4)
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX
+%define SPLATD SPLATD_MMX
+%define CLIPD CLIPD_MMX
+VECTOR_CLIP_INT32 mmx, 0, 1, 0
+INIT_XMM
+%define SPLATD SPLATD_SSE2
+VECTOR_CLIP_INT32 sse2_int, 6, 1, 0
+%define CLIPD CLIPD_SSE2
+VECTOR_CLIP_INT32 sse2, 6, 2, 0
+%define CLIPD CLIPD_SSE41
+%ifdef m8
+VECTOR_CLIP_INT32 sse41, 11, 1, 1
+%else
+VECTOR_CLIP_INT32 sse41, 6, 1, 0
+%endif
diff --git a/libavcodec/x86/h264_intrapred_10bit.asm b/libavcodec/x86/h264_intrapred_10bit.asm
index 5cb593a..d57fc79 100644
--- a/libavcodec/x86/h264_intrapred_10bit.asm
+++ b/libavcodec/x86/h264_intrapred_10bit.asm
@@ -29,9 +29,13 @@ SECTION_RODATA
SECTION .text
+cextern pw_8
cextern pw_4
+cextern pw_2
cextern pw_1
+; dest, left, right, src
+; output: %1 = (t[n-1] + t[n]*2 + t[n+1] + 2) >> 2
%macro PRED4x4_LOWPASS 4
paddw %2, %3
psrlw %2, 1
@@ -335,3 +339,930 @@ cglobal pred8x8_horizontal_10_sse2, 2,3
dec r2
jg .loop
REP_RET
+
+;-----------------------------------------------------------------------------
+; void predict_8x8_dc(pixel *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MOV8 2-3
+; sort of a hack, but it works
+%if mmsize==8
+ movq [%1+0], %2
+ movq [%1+8], %3
+%else
+ movdqa [%1], %2
+%endif
+%endmacro
+
+%macro PRED8x8_DC 2
+cglobal pred8x8_dc_10_%1, 2,4
+%ifdef ARCH_X86_64
+%define t0 r10
+%else
+%define t0 r0m
+%endif
+ sub r0, r1
+ pxor m4, m4
+ movq m0, [r0+0]
+ movq m1, [r0+8]
+ HADDW m0, m2
+ mov t0, r0
+ HADDW m1, m2
+
+ movzx r2d, word [r0+r1*1-2]
+ movzx r3d, word [r0+r1*2-2]
+ lea r0, [r0+r1*2]
+ add r2d, r3d
+ movzx r3d, word [r0+r1*1-2]
+ add r2d, r3d
+ movzx r3d, word [r0+r1*2-2]
+ add r2d, r3d
+ lea r0, [r0+r1*2]
+ movd m2, r2d ; s2
+
+ movzx r2d, word [r0+r1*1-2]
+ movzx r3d, word [r0+r1*2-2]
+ lea r0, [r0+r1*2]
+ add r2d, r3d
+ movzx r3d, word [r0+r1*1-2]
+ add r2d, r3d
+ movzx r3d, word [r0+r1*2-2]
+ add r2d, r3d
+ movd m3, r2d ; s3
+
+ punpcklwd m0, m1
+ mov r0, t0
+ punpcklwd m2, m3
+ punpckldq m0, m2 ; s0, s1, s2, s3
+ %2 m3, m0, 11110110b ; s2, s1, s3, s3
+ lea r2, [r1+r1*2]
+ %2 m0, m0, 01110100b ; s0, s1, s3, s1
+ paddw m0, m3
+ lea r3, [r0+r1*4]
+ psrlw m0, 2
+ pavgw m0, m4 ; s0+s2, s1, s3, s1+s3
+%ifidn %1, sse2
+ punpcklwd m0, m0
+ pshufd m3, m0, 11111010b
+ punpckldq m0, m0
+ SWAP 0,1
+%else
+ pshufw m1, m0, 0x00
+ pshufw m2, m0, 0x55
+ pshufw m3, m0, 0xaa
+ pshufw m4, m0, 0xff
+%endif
+ MOV8 r0+r1*1, m1, m2
+ MOV8 r0+r1*2, m1, m2
+ MOV8 r0+r2*1, m1, m2
+ MOV8 r0+r1*4, m1, m2
+ MOV8 r3+r1*1, m3, m4
+ MOV8 r3+r1*2, m3, m4
+ MOV8 r3+r2*1, m3, m4
+ MOV8 r3+r1*4, m3, m4
+ RET
+%endmacro
+
+INIT_MMX
+PRED8x8_DC mmxext, pshufw
+INIT_XMM
+PRED8x8_DC sse2 , pshuflw
+
+;-----------------------------------------------------------------------------
+; void pred8x8_top_dc(pixel *src, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8_TOP_DC 2
+cglobal pred8x8_top_dc_10_%1, 2,4
+ sub r0, r1
+ movq m0, [r0+0]
+ movq m1, [r0+8]
+ HADDW m0, m2
+ HADDW m1, m3
+ lea r2, [r1+r1*2]
+ paddw m0, [pw_2]
+ paddw m1, [pw_2]
+ lea r3, [r0+r1*4]
+ psrlw m0, 2
+ psrlw m1, 2
+ %2 m0, m0, 0
+ %2 m1, m1, 0
+%ifidn %1, sse2
+ punpcklqdq m0, m1
+%endif
+ MOV8 r0+r1*1, m0, m1
+ MOV8 r0+r1*2, m0, m1
+ MOV8 r0+r2*1, m0, m1
+ MOV8 r0+r1*4, m0, m1
+ MOV8 r3+r1*1, m0, m1
+ MOV8 r3+r1*2, m0, m1
+ MOV8 r3+r2*1, m0, m1
+ MOV8 r3+r1*4, m0, m1
+ RET
+%endmacro
+
+INIT_MMX
+PRED8x8_TOP_DC mmxext, pshufw
+INIT_XMM
+PRED8x8_TOP_DC sse2 , pshuflw
+
+
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_top_dc(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_TOP_DC 1
+cglobal pred8x8l_top_dc_10_%1, 4,4,6
+ sub r0, r3
+ pxor m7, m7
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+ jmp .body
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2 ; top_right
+ jnz .body
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+.body
+ lea r1, [r3+r3*2]
+ lea r2, [r0+r3*4]
+ PRED4x4_LOWPASS m0, m2, m1, m3
+ HADDW m0, m1
+ paddw m0, [pw_4]
+ psrlw m0, 3
+ SPLATW m0, m0, 0
+ mova [r0+r3*1], m0
+ mova [r0+r3*2], m0
+ mova [r0+r1*1], m0
+ mova [r0+r3*4], m0
+ mova [r2+r3*1], m0
+ mova [r2+r3*2], m0
+ mova [r2+r1*1], m0
+ mova [r2+r3*4], m0
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_TOP_DC sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_TOP_DC ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_dc(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+;TODO: see if scalar is faster
+%macro PRED8x8L_DC 1
+cglobal pred8x8l_dc_10_%1, 4,5,8
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ mova m0, [r0+r3*1-16]
+ punpckhwd m0, [r0+r3*0-16]
+ mova m1, [r4+r3*1-16]
+ punpckhwd m1, [r0+r3*2-16]
+ mov r4, r0
+ punpckhdq m1, m0
+ lea r0, [r0+r3*4]
+ mova m2, [r0+r3*1-16]
+ punpckhwd m2, [r0+r3*0-16]
+ lea r0, [r0+r3*2]
+ mova m3, [r0+r3*1-16]
+ punpckhwd m3, [r0+r3*0-16]
+ punpckhdq m3, m2
+ punpckhqdq m3, m1
+ lea r0, [r0+r3*2]
+ mova m0, [r0+r3*0-16]
+ mova m1, [r4]
+ mov r0, r4
+ mova m4, m3
+ mova m2, m3
+ PALIGNR m4, m0, 14, m0
+ PALIGNR m1, m2, 2, m2
+ test r1, r1
+ jnz .do_left
+.fix_lt_1:
+ mova m5, m3
+ pxor m5, m4
+ psrldq m5, 14
+ pslldq m5, 12
+ pxor m1, m5
+ jmp .do_left
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2
+ jnz .body
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+ jmp .body
+.do_left:
+ mova m0, m4
+ PRED4x4_LOWPASS m2, m1, m4, m3
+ mova m4, m0
+ mova m7, m2
+ PRED4x4_LOWPASS m1, m3, m0, m4
+ pslldq m1, 14
+ PALIGNR m7, m1, 14, m3
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.body
+ lea r1, [r3+r3*2]
+ PRED4x4_LOWPASS m6, m2, m1, m3
+ HADDW m7, m0
+ HADDW m6, m0
+ lea r2, [r0+r3*4]
+ paddw m7, [pw_8]
+ paddw m7, m6
+ psrlw m7, 4
+ SPLATW m7, m7
+ mova [r0+r3*1], m7
+ mova [r0+r3*2], m7
+ mova [r0+r1*1], m7
+ mova [r0+r3*4], m7
+ mova [r2+r3*1], m7
+ mova [r2+r3*2], m7
+ mova [r2+r1*1], m7
+ mova [r2+r3*4], m7
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DC sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DC ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_vertical(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_VERTICAL 1
+cglobal pred8x8l_vertical_10_%1, 4,4,6
+ sub r0, r3
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+ jmp .body
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2 ; top_right
+ jnz .body
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+.body
+ lea r1, [r3+r3*2]
+ lea r2, [r0+r3*4]
+ PRED4x4_LOWPASS m0, m2, m1, m3
+ mova [r0+r3*1], m0
+ mova [r0+r3*2], m0
+ mova [r0+r1*1], m0
+ mova [r0+r3*4], m0
+ mova [r2+r3*1], m0
+ mova [r2+r3*2], m0
+ mova [r2+r1*1], m0
+ mova [r2+r3*4], m0
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_VERTICAL sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_VERTICAL ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_horizontal(uint8_t *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_HORIZONTAL 1
+cglobal pred8x8l_horizontal_10_%1, 4,4,8
+ sub r0, r3
+ lea r2, [r0+r3*2]
+ mova m0, [r0+r3*1-16]
+ test r1, r1
+ lea r1, [r0+r3]
+ cmovnz r1, r0
+ punpckhwd m0, [r1+r3*0-16]
+ mova m1, [r2+r3*1-16]
+ punpckhwd m1, [r0+r3*2-16]
+ mov r2, r0
+ punpckhdq m1, m0
+ lea r0, [r0+r3*4]
+ mova m2, [r0+r3*1-16]
+ punpckhwd m2, [r0+r3*0-16]
+ lea r0, [r0+r3*2]
+ mova m3, [r0+r3*1-16]
+ punpckhwd m3, [r0+r3*0-16]
+ punpckhdq m3, m2
+ punpckhqdq m3, m1
+ lea r0, [r0+r3*2]
+ mova m0, [r0+r3*0-16]
+ mova m1, [r1+r3*0-16]
+ mov r0, r2
+ mova m4, m3
+ mova m2, m3
+ PALIGNR m4, m0, 14, m0
+ PALIGNR m1, m2, 2, m2
+ mova m0, m4
+ PRED4x4_LOWPASS m2, m1, m4, m3
+ mova m4, m0
+ mova m7, m2
+ PRED4x4_LOWPASS m1, m3, m0, m4
+ pslldq m1, 14
+ PALIGNR m7, m1, 14, m3
+ lea r1, [r3+r3*2]
+ punpckhwd m3, m7, m7
+ punpcklwd m7, m7
+ pshufd m0, m3, 0xff
+ pshufd m1, m3, 0xaa
+ lea r2, [r0+r3*4]
+ pshufd m2, m3, 0x55
+ pshufd m3, m3, 0x00
+ pshufd m4, m7, 0xff
+ pshufd m5, m7, 0xaa
+ pshufd m6, m7, 0x55
+ pshufd m7, m7, 0x00
+ mova [r0+r3*1], m0
+ mova [r0+r3*2], m1
+ mova [r0+r1*1], m2
+ mova [r0+r3*4], m3
+ mova [r2+r3*1], m4
+ mova [r2+r3*2], m5
+ mova [r2+r1*1], m6
+ mova [r2+r3*4], m7
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_HORIZONTAL sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_HORIZONTAL ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_down_left(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_DOWN_LEFT 1
+cglobal pred8x8l_down_left_10_%1, 4,4,8
+ sub r0, r3
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+ jmp .do_top
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+ jmp .do_top
+.fix_tr_2:
+ punpckhwd m3, m3
+ pshufd m1, m3, 0xFF
+ jmp .do_topright
+.do_top:
+ PRED4x4_LOWPASS m4, m2, m1, m3
+ mova m7, m4
+ test r2, r2
+ jz .fix_tr_2
+ mova m0, [r0+16]
+ mova m5, m0
+ mova m2, m0
+ mova m4, m0
+ psrldq m5, 14
+ PALIGNR m2, m3, 14, m3
+ PALIGNR m5, m4, 2, m4
+ PRED4x4_LOWPASS m1, m2, m5, m0
+.do_topright:
+ lea r1, [r3+r3*2]
+ mova m6, m1
+ psrldq m1, 14
+ mova m4, m1
+ lea r2, [r0+r3*4]
+ mova m2, m6
+ PALIGNR m2, m7, 2, m0
+ mova m3, m6
+ PALIGNR m3, m7, 14, m0
+ PALIGNR m4, m6, 2, m0
+ mova m5, m7
+ mova m1, m7
+ mova m7, m6
+ pslldq m1, 2
+ PRED4x4_LOWPASS m0, m1, m2, m5
+ PRED4x4_LOWPASS m1, m3, m4, m7
+ mova [r2+r3*4], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r2+r1*1], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r2+r3*2], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r2+r3*1], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r0+r3*4], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r0+r1*1], m1
+ mova m2, m0
+ pslldq m1, 2
+ psrldq m2, 14
+ pslldq m0, 2
+ por m1, m2
+ mova [r0+r3*2], m1
+ pslldq m1, 2
+ psrldq m0, 14
+ por m1, m0
+ mova [r0+r3*1], m1
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DOWN_LEFT sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DOWN_LEFT ssse3
+
+;-----------------------------------------------------------------------------
+;void pred8x8l_down_right_mxext(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_DOWN_RIGHT 1
+cglobal pred8x8l_down_right_10_%1, 4,5,8
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ mova m0, [r0+r3*1-16]
+ punpckhwd m0, [r0+r3*0-16]
+ mova m1, [r4+r3*1-16]
+ punpckhwd m1, [r0+r3*2-16]
+ mov r4, r0
+ punpckhdq m1, m0
+ lea r0, [r0+r3*4]
+ mova m2, [r0+r3*1-16]
+ punpckhwd m2, [r0+r3*0-16]
+ lea r0, [r0+r3*2]
+ mova m3, [r0+r3*1-16]
+ punpckhwd m3, [r0+r3*0-16]
+ punpckhdq m3, m2
+ punpckhqdq m3, m1
+ lea r0, [r0+r3*2]
+ mova m0, [r0+r3*0-16]
+ mova m1, [r4]
+ mov r0, r4
+ mova m4, m3
+ mova m2, m3
+ PALIGNR m4, m0, 14, m0
+ PALIGNR m1, m2, 2, m2
+ test r1, r1 ; top_left
+ jz .fix_lt_1
+.do_left:
+ mova m0, m4
+ PRED4x4_LOWPASS m2, m1, m4, m3
+ mova m4, m0
+ mova m7, m2
+ mova m6, m2
+ PRED4x4_LOWPASS m1, m3, m0, m4
+ pslldq m1, 14
+ PALIGNR m7, m1, 14, m3
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1 ; top_left
+ jz .fix_lt_2
+ test r2, r2 ; top_right
+ jz .fix_tr_1
+.do_top:
+ PRED4x4_LOWPASS m4, m2, m1, m3
+ mova m5, m4
+ jmp .body
+.fix_lt_1:
+ mova m5, m3
+ pxor m5, m4
+ psrldq m5, 14
+ pslldq m5, 12
+ pxor m1, m5
+ jmp .do_left
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2 ; top_right
+ jnz .do_top
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+ jmp .do_top
+.body
+ lea r1, [r3+r3*2]
+ mova m1, m7
+ mova m7, m5
+ mova m5, m6
+ mova m2, m7
+ lea r2, [r0+r3*4]
+ PALIGNR m2, m6, 2, m0
+ mova m3, m7
+ PALIGNR m3, m6, 14, m0
+ mova m4, m7
+ psrldq m4, 2
+ PRED4x4_LOWPASS m0, m1, m2, m5
+ PRED4x4_LOWPASS m1, m3, m4, m7
+ mova [r2+r3*4], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r2+r1*1], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r2+r3*2], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r2+r3*1], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r0+r3*4], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r0+r1*1], m0
+ mova m2, m1
+ psrldq m0, 2
+ pslldq m2, 14
+ psrldq m1, 2
+ por m0, m2
+ mova [r0+r3*2], m0
+ psrldq m0, 2
+ pslldq m1, 14
+ por m0, m1
+ mova [r0+r3*1], m0
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_DOWN_RIGHT sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_DOWN_RIGHT ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_vertical_right(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_VERTICAL_RIGHT 1
+cglobal pred8x8l_vertical_right_10_%1, 4,5,8
+ sub r0, r3
+ lea r4, [r0+r3*2]
+ mova m0, [r0+r3*1-16]
+ punpckhwd m0, [r0+r3*0-16]
+ mova m1, [r4+r3*1-16]
+ punpckhwd m1, [r0+r3*2-16]
+ mov r4, r0
+ punpckhdq m1, m0
+ lea r0, [r0+r3*4]
+ mova m2, [r0+r3*1-16]
+ punpckhwd m2, [r0+r3*0-16]
+ lea r0, [r0+r3*2]
+ mova m3, [r0+r3*1-16]
+ punpckhwd m3, [r0+r3*0-16]
+ punpckhdq m3, m2
+ punpckhqdq m3, m1
+ lea r0, [r0+r3*2]
+ mova m0, [r0+r3*0-16]
+ mova m1, [r4]
+ mov r0, r4
+ mova m4, m3
+ mova m2, m3
+ PALIGNR m4, m0, 14, m0
+ PALIGNR m1, m2, 2, m2
+ test r1, r1
+ jz .fix_lt_1
+ jmp .do_left
+.fix_lt_1:
+ mova m5, m3
+ pxor m5, m4
+ psrldq m5, 14
+ pslldq m5, 12
+ pxor m1, m5
+ jmp .do_left
+.fix_lt_2:
+ mova m5, m3
+ pxor m5, m2
+ pslldq m5, 14
+ psrldq m5, 14
+ pxor m2, m5
+ test r2, r2
+ jnz .do_top
+.fix_tr_1:
+ mova m5, m3
+ pxor m5, m1
+ psrldq m5, 14
+ pslldq m5, 14
+ pxor m1, m5
+ jmp .do_top
+.do_left:
+ mova m0, m4
+ PRED4x4_LOWPASS m2, m1, m4, m3
+ mova m7, m2
+ mova m0, [r0-16]
+ mova m3, [r0]
+ mova m1, [r0+16]
+ mova m2, m3
+ mova m4, m3
+ PALIGNR m2, m0, 14, m0
+ PALIGNR m1, m4, 2, m4
+ test r1, r1
+ jz .fix_lt_2
+ test r2, r2
+ jz .fix_tr_1
+.do_top
+ PRED4x4_LOWPASS m6, m2, m1, m3
+ lea r1, [r3+r3*2]
+ mova m2, m6
+ mova m3, m6
+ PALIGNR m3, m7, 14, m0
+ PALIGNR m6, m7, 12, m1
+ mova m4, m3
+ pavgw m3, m2
+ lea r2, [r0+r3*4]
+ PRED4x4_LOWPASS m0, m6, m2, m4
+ mova [r0+r3*1], m3
+ mova [r0+r3*2], m0
+ mova m5, m0
+ mova m6, m3
+ mova m1, m7
+ mova m2, m1
+ pslldq m2, 2
+ mova m3, m1
+ pslldq m3, 4
+ PRED4x4_LOWPASS m0, m1, m3, m2
+ PALIGNR m6, m0, 14, m2
+ mova [r0+r1*1], m6
+ pslldq m0, 2
+ PALIGNR m5, m0, 14, m1
+ mova [r0+r3*4], m5
+ pslldq m0, 2
+ PALIGNR m6, m0, 14, m2
+ mova [r2+r3*1], m6
+ pslldq m0, 2
+ PALIGNR m5, m0, 14, m1
+ mova [r2+r3*2], m5
+ pslldq m0, 2
+ PALIGNR m6, m0, 14, m2
+ mova [r2+r1*1], m6
+ pslldq m0, 2
+ PALIGNR m5, m0, 14, m1
+ mova [r2+r3*4], m5
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_VERTICAL_RIGHT sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_VERTICAL_RIGHT ssse3
+
+;-----------------------------------------------------------------------------
+; void pred8x8l_horizontal_up(pixel *src, int has_topleft, int has_topright, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED8x8L_HORIZONTAL_UP 1
+cglobal pred8x8l_horizontal_up_10_%1, 4,4,8
+ sub r0, r3
+ lea r2, [r0+r3*2]
+ mova m0, [r0+r3*1-16]
+ test r1, r1
+ lea r1, [r0+r3]
+ cmovnz r1, r0
+ punpckhwd m0, [r1+r3*0-16]
+ mova m1, [r2+r3*1-16]
+ punpckhwd m1, [r0+r3*2-16]
+ mov r2, r0
+ punpckhdq m1, m0
+ lea r0, [r0+r3*4]
+ mova m2, [r0+r3*1-16]
+ punpckhwd m2, [r0+r3*0-16]
+ lea r0, [r0+r3*2]
+ mova m3, [r0+r3*1-16]
+ punpckhwd m3, [r0+r3*0-16]
+ punpckhdq m3, m2
+ punpckhqdq m3, m1
+ lea r0, [r0+r3*2]
+ mova m0, [r0+r3*0-16]
+ mova m1, [r1+r3*0-16]
+ mov r0, r2
+ mova m4, m3
+ mova m2, m3
+ PALIGNR m4, m0, 14, m0
+ PALIGNR m1, m2, 2, m2
+ mova m0, m4
+ PRED4x4_LOWPASS m2, m1, m4, m3
+ mova m4, m0
+ mova m7, m2
+ PRED4x4_LOWPASS m1, m3, m0, m4
+ pslldq m1, 14
+ PALIGNR m7, m1, 14, m3
+ lea r1, [r3+r3*2]
+ pshufd m0, m7, 00011011b ; l6 l7 l4 l5 l2 l3 l0 l1
+ pslldq m7, 14 ; l7 .. .. .. .. .. .. ..
+ mova m2, m0
+ pslld m0, 16
+ psrld m2, 16
+ por m2, m0 ; l7 l6 l5 l4 l3 l2 l1 l0
+ mova m3, m2
+ mova m4, m2
+ mova m5, m2
+ psrldq m2, 2
+ psrldq m3, 4
+ lea r2, [r0+r3*4]
+ por m2, m7 ; l7 l7 l6 l5 l4 l3 l2 l1
+ punpckhwd m7, m7
+ por m3, m7 ; l7 l7 l7 l6 l5 l4 l3 l2
+ pavgw m4, m2
+ PRED4x4_LOWPASS m1, m3, m5, m2
+ mova m5, m4
+ punpcklwd m4, m1 ; p4 p3 p2 p1
+ punpckhwd m5, m1 ; p8 p7 p6 p5
+ mova m6, m5
+ mova m7, m5
+ mova m0, m5
+ PALIGNR m5, m4, 4, m1
+ pshufd m1, m6, 11111001b
+ PALIGNR m6, m4, 8, m2
+ pshufd m2, m7, 11111110b
+ PALIGNR m7, m4, 12, m3
+ pshufd m3, m0, 11111111b
+ mova [r0+r3*1], m4
+ mova [r0+r3*2], m5
+ mova [r0+r1*1], m6
+ mova [r0+r3*4], m7
+ mova [r2+r3*1], m0
+ mova [r2+r3*2], m1
+ mova [r2+r1*1], m2
+ mova [r2+r3*4], m3
+ RET
+%endmacro
+
+INIT_XMM
+%define PALIGNR PALIGNR_MMX
+PRED8x8L_HORIZONTAL_UP sse2
+%define PALIGNR PALIGNR_SSSE3
+PRED8x8L_HORIZONTAL_UP ssse3
+
+
+
+;-----------------------------------------------------------------------------
+; void pred16x16_vertical(pixel *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MOV16 3-5
+ mova [%1+ 0], %2
+ mova [%1+mmsize], %3
+%if mmsize==8
+ mova [%1+ 16], %4
+ mova [%1+ 24], %5
+%endif
+%endmacro
+
+%macro PRED16x16_VERTICAL 1
+cglobal pred16x16_vertical_10_%1, 2,3
+ sub r0, r1
+ mov r2, 8
+ mova m0, [r0+ 0]
+ mova m1, [r0+mmsize]
+%if mmsize==8
+ mova m2, [r0+16]
+ mova m3, [r0+24]
+%endif
+.loop:
+ MOV16 r0+r1*1, m0, m1, m2, m3
+ MOV16 r0+r1*2, m0, m1, m2, m3
+ lea r0, [r0+r1*2]
+ dec r2
+ jg .loop
+ REP_RET
+%endmacro
+
+INIT_MMX
+PRED16x16_VERTICAL mmxext
+INIT_XMM
+PRED16x16_VERTICAL sse2
+
+;-----------------------------------------------------------------------------
+; void pred16x16_horizontal(pixel *src, int stride)
+;-----------------------------------------------------------------------------
+%macro PRED16x16_HORIZONTAL 1
+cglobal pred16x16_horizontal_10_%1, 2,3
+ mov r2, 8
+.vloop:
+ movd m0, [r0+r1*0-4]
+ movd m1, [r0+r1*1-4]
+ SPLATW m0, m0, 1
+ SPLATW m1, m1, 1
+ MOV16 r0+r1*0, m0, m0, m0, m0
+ MOV16 r0+r1*1, m1, m1, m1, m1
+ lea r0, [r0+r1*2]
+ dec r2
+ jge .vloop
+ REP_RET
+%endmacro
+
+INIT_MMX
+PRED16x16_HORIZONTAL mmxext
+INIT_XMM
+PRED16x16_HORIZONTAL sse2
diff --git a/libavcodec/x86/h264_intrapred_init.c b/libavcodec/x86/h264_intrapred_init.c
index d71f71e..2ccc584 100644
--- a/libavcodec/x86/h264_intrapred_init.c
+++ b/libavcodec/x86/h264_intrapred_init.c
@@ -43,9 +43,41 @@ PRED4x4(horizontal_down, 10, avx)
#define PRED8x8(TYPE, DEPTH, OPT) \
void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
+PRED8x8(dc, 10, mmxext)
+PRED8x8(dc, 10, sse2)
+PRED8x8(top_dc, 10, mmxext)
+PRED8x8(top_dc, 10, sse2)
PRED8x8(vertical, 10, sse2)
PRED8x8(horizontal, 10, sse2)
+#define PRED8x8L(TYPE, DEPTH, OPT)\
+void ff_pred8x8l_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int has_topleft, int has_topright, int stride);
+
+PRED8x8L(dc, 10, sse2)
+PRED8x8L(dc, 10, ssse3)
+PRED8x8L(top_dc, 10, sse2)
+PRED8x8L(top_dc, 10, ssse3)
+PRED8x8L(vertical, 10, sse2)
+PRED8x8L(vertical, 10, ssse3)
+PRED8x8L(horizontal, 10, sse2)
+PRED8x8L(horizontal, 10, ssse3)
+PRED8x8L(down_left, 10, sse2)
+PRED8x8L(down_left, 10, ssse3)
+PRED8x8L(down_right, 10, sse2)
+PRED8x8L(down_right, 10, ssse3)
+PRED8x8L(vertical_right, 10, sse2)
+PRED8x8L(vertical_right, 10, ssse3)
+PRED8x8L(horizontal_up, 10, sse2)
+PRED8x8L(horizontal_up, 10, ssse3)
+
+#define PRED16x16(TYPE, DEPTH, OPT)\
+void ff_pred16x16_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
+
+PRED16x16(vertical, 10, mmxext)
+PRED16x16(vertical, 10, sse2)
+PRED16x16(horizontal, 10, mmxext)
+PRED16x16(horizontal, 10, sse2)
+
void ff_pred16x16_vertical_mmx (uint8_t *src, int stride);
void ff_pred16x16_vertical_sse (uint8_t *src, int stride);
void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride);
@@ -253,6 +285,12 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
if (mm_flags & AV_CPU_FLAG_MMX2) {
h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext;
+
+ h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_mmxext;
+ h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_mmxext;
+
+ h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_mmxext;
+ h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_mmxext;
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
@@ -261,13 +299,33 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2;
+ h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_10_sse2;
+ h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_10_sse2;
h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2;
h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2;
+
+ h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_sse2;
+ h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_sse2;
+ h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_sse2;
+ h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_sse2;
+ h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_sse2;
+ h->pred8x8l[DIAG_DOWN_RIGHT_PRED] = ff_pred8x8l_down_right_10_sse2;
+ h->pred8x8l[VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_10_sse2;
+ h->pred8x8l[HOR_UP_PRED ] = ff_pred8x8l_horizontal_up_10_sse2;
+
+ h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_10_sse2;
+ h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_10_sse2;
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3;
+
+ h->pred8x8l[VERT_PRED ] = ff_pred8x8l_vertical_10_ssse3;
+ h->pred8x8l[HOR_PRED ] = ff_pred8x8l_horizontal_10_ssse3;
+ h->pred8x8l[DC_PRED ] = ff_pred8x8l_dc_10_ssse3;
+ h->pred8x8l[TOP_DC_PRED ] = ff_pred8x8l_top_dc_10_ssse3;
+ h->pred8x8l[DIAG_DOWN_LEFT_PRED ] = ff_pred8x8l_down_left_10_ssse3;
}
#if HAVE_AVX
if (mm_flags & AV_CPU_FLAG_AVX) {
diff --git a/libavcodec/x86/h264_qpel_10bit.asm b/libavcodec/x86/h264_qpel_10bit.asm
new file mode 100644
index 0000000..15dd72c
--- /dev/null
+++ b/libavcodec/x86/h264_qpel_10bit.asm
@@ -0,0 +1,891 @@
+;*****************************************************************************
+;* MMX/SSE2/AVX-optimized 10-bit H.264 qpel code
+;*****************************************************************************
+;* Copyright (C) 2011 x264 project
+;*
+;* Authors: Daniel Kang <daniel.d.kang@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 "x86inc.asm"
+%include "x86util.asm"
+
+SECTION_RODATA 32
+
+cextern pw_16
+cextern pw_1
+cextern pb_0
+
+pw_pixel_max: times 8 dw ((1 << 10)-1)
+
+pad10: times 8 dw 10*1023
+pad20: times 8 dw 20*1023
+pad30: times 8 dw 30*1023
+depad: times 4 dd 32*20*1023 + 512
+depad2: times 8 dw 20*1023 + 16*1022 + 16
+unpad: times 8 dw 16*1022/32 ; needs to be mod 16
+
+tap1: times 4 dw 1, -5
+tap2: times 4 dw 20, 20
+tap3: times 4 dw -5, 1
+pd_0f: times 4 dd 0xffff
+
+SECTION .text
+
+
+%macro AVG_MOV 2
+ pavgw %2, %1
+ mova %1, %2
+%endmacro
+
+%macro ADDW 3
+%if mmsize == 8
+ paddw %1, %2
+%else
+ movu %3, %2
+ paddw %1, %3
+%endif
+%endmacro
+
+%macro FILT_H 4
+ paddw %1, %4
+ psubw %1, %2 ; a-b
+ psraw %1, 2 ; (a-b)/4
+ psubw %1, %2 ; (a-b)/4-b
+ paddw %1, %3 ; (a-b)/4-b+c
+ psraw %1, 2 ; ((a-b)/4-b+c)/4
+ paddw %1, %3 ; ((a-b)/4-b+c)/4+c = (a-5*b+20*c)/16
+%endmacro
+
+%macro PRELOAD_V 0
+ lea r3, [r2*3]
+ sub r1, r3
+ movu m0, [r1+r2]
+ movu m1, [r1+r2*2]
+ add r1, r3
+ movu m2, [r1]
+ movu m3, [r1+r2]
+ movu m4, [r1+r2*2]
+ add r1, r3
+%endmacro
+
+%macro FILT_V 8
+ movu %6, [r1]
+ paddw %1, %6
+ mova %7, %2
+ paddw %7, %5
+ mova %8, %3
+ paddw %8, %4
+ FILT_H %1, %7, %8, [pw_16]
+ psraw %1, 1
+ CLIPW %1, [pb_0], [pw_pixel_max]
+%endmacro
+
+%macro MC 1
+%define OP_MOV mova
+INIT_MMX
+%1 mmxext, put, 4
+INIT_XMM
+%1 sse2 , put, 8
+
+%define OP_MOV AVG_MOV
+INIT_MMX
+%1 mmxext, avg, 4
+INIT_XMM
+%1 sse2 , avg, 8
+%endmacro
+
+%macro MCAxA 8
+%ifdef ARCH_X86_64
+%ifnidn %1,mmxext
+MCAxA_OP %1,%2,%3,%4,%5,%6,%7,%8
+%endif
+%else
+MCAxA_OP %1,%2,%3,%4,%5,%6,%7,%8
+%endif
+%endmacro
+
+%macro MCAxA_OP 8
+cglobal %2_h264_qpel%5_%3_10_%1, %6,%7,%8
+%ifdef ARCH_X86_32
+ call stub_%2_h264_qpel%4_%3_10_%1
+ mov r0, r0m
+ mov r1, r1m
+ add r0, %4*2
+ add r1, %4*2
+ call stub_%2_h264_qpel%4_%3_10_%1
+ mov r0, r0m
+ mov r1, r1m
+ lea r0, [r0+r2*%4]
+ lea r1, [r1+r2*%4]
+ call stub_%2_h264_qpel%4_%3_10_%1
+ mov r0, r0m
+ mov r1, r1m
+ lea r0, [r0+r2*%4+%4*2]
+ lea r1, [r1+r2*%4+%4*2]
+ call stub_%2_h264_qpel%4_%3_10_%1
+ RET
+%else ; ARCH_X86_64
+ mov r10, r0
+ mov r11, r1
+ call stub_%2_h264_qpel%4_%3_10_%1
+ lea r0, [r10+%4*2]
+ lea r1, [r11+%4*2]
+ call stub_%2_h264_qpel%4_%3_10_%1
+ lea r0, [r10+r2*%4]
+ lea r1, [r11+r2*%4]
+ call stub_%2_h264_qpel%4_%3_10_%1
+ lea r0, [r10+r2*%4+%4*2]
+ lea r1, [r11+r2*%4+%4*2]
+%ifndef UNIX64 ; fall through to function
+ call stub_%2_h264_qpel%4_%3_10_%1
+ RET
+%endif
+%endif
+%endmacro
+
+;cpu, put/avg, mc, 4/8, ...
+%macro cglobal_mc 7
+%assign i %4*2
+MCAxA %1, %2, %3, %4, i, %5,%6,%7
+
+cglobal %2_h264_qpel%4_%3_10_%1, %5,%6,%7
+%ifndef UNIX64 ; no prologue or epilogue for UNIX64
+ call stub_%2_h264_qpel%4_%3_10_%1
+ RET
+%endif
+
+stub_%2_h264_qpel%4_%3_10_%1:
+%endmacro
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc00(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro COPY4 0
+ movu m0, [r1 ]
+ OP_MOV [r0 ], m0
+ movu m0, [r1+r2 ]
+ OP_MOV [r0+r2 ], m0
+ movu m0, [r1+r2*2]
+ OP_MOV [r0+r2*2], m0
+ movu m0, [r1+r3 ]
+ OP_MOV [r0+r3 ], m0
+%endmacro
+
+%macro MC00 1
+INIT_MMX
+cglobal_mc mmxext, %1, mc00, 4, 3,4,0
+ lea r3, [r2*3]
+ COPY4
+ ret
+
+INIT_XMM
+cglobal %1_h264_qpel8_mc00_10_sse2, 3,4
+ lea r3, [r2*3]
+ COPY4
+ lea r0, [r0+r2*4]
+ lea r1, [r1+r2*4]
+ COPY4
+ RET
+
+cglobal %1_h264_qpel16_mc00_10_sse2, 3,4
+ mov r3d, 8
+.loop:
+ movu m0, [r1 ]
+ movu m1, [r1 +16]
+ OP_MOV [r0 ], m0
+ OP_MOV [r0 +16], m1
+ movu m0, [r1+r2 ]
+ movu m1, [r1+r2+16]
+ OP_MOV [r0+r2 ], m0
+ OP_MOV [r0+r2+16], m1
+ lea r0, [r0+r2*2]
+ lea r1, [r1+r2*2]
+ dec r3d
+ jg .loop
+ REP_RET
+%endmacro
+
+%define OP_MOV mova
+MC00 put
+
+%define OP_MOV AVG_MOV
+MC00 avg
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc20(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC_CACHE 1
+%define OP_MOV mova
+%define PALIGNR PALIGNR_MMX
+INIT_MMX
+%1 mmxext , put, 4
+INIT_XMM
+%1 sse2_cache64 , put, 8
+%define PALIGNR PALIGNR_SSSE3
+%1 ssse3_cache64, put, 8
+%1 sse2 , put, 8, 0
+
+%define OP_MOV AVG_MOV
+%define PALIGNR PALIGNR_MMX
+INIT_MMX
+%1 mmxext , avg, 4
+INIT_XMM
+%1 sse2_cache64 , avg, 8
+%define PALIGNR PALIGNR_SSSE3
+%1 ssse3_cache64, avg, 8
+%1 sse2 , avg, 8, 0
+%endmacro
+
+%macro MC20 3-4
+cglobal_mc %1, %2, mc20, %3, 3,4,9
+ mov r3d, %3
+ mova m1, [pw_pixel_max]
+%if num_mmregs > 8
+ mova m8, [pw_16]
+ %define p16 m8
+%else
+ %define p16 [pw_16]
+%endif
+.nextrow
+%if %0 == 4
+ movu m2, [r1-4]
+ movu m3, [r1-2]
+ movu m4, [r1+0]
+ ADDW m2, [r1+6], m5
+ ADDW m3, [r1+4], m5
+ ADDW m4, [r1+2], m5
+%else ; movu is slow on these processors
+%if mmsize==16
+ movu m2, [r1-4]
+ movu m0, [r1+6]
+ mova m6, m0
+ psrldq m0, 6
+
+ paddw m6, m2
+ PALIGNR m3, m0, m2, 2, m5
+ PALIGNR m7, m0, m2, 8, m5
+ paddw m3, m7
+ PALIGNR m4, m0, m2, 4, m5
+ PALIGNR m7, m0, m2, 6, m5
+ paddw m4, m7
+ SWAP 2, 6
+%else
+ movu m2, [r1-4]
+ movu m6, [r1+4]
+ PALIGNR m3, m6, m2, 2, m5
+ paddw m3, m6
+ PALIGNR m4, m6, m2, 4, m5
+ PALIGNR m7, m6, m2, 6, m5
+ paddw m4, m7
+ paddw m2, [r1+6]
+%endif
+%endif
+
+ FILT_H m2, m3, m4, p16
+ psraw m2, 1
+ pxor m0, m0
+ CLIPW m2, m0, m1
+ OP_MOV [r0], m2
+ add r0, r2
+ add r1, r2
+ dec r3d
+ jg .nextrow
+ rep ret
+%endmacro
+
+MC_CACHE MC20
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc30(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC30 3-4
+cglobal_mc %1, %2, mc30, %3, 3,5,9
+ lea r4, [r1+2]
+ jmp stub_%2_h264_qpel%3_mc10_10_%1.body
+%endmacro
+
+MC_CACHE MC30
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc10(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC10 3-4
+cglobal_mc %1, %2, mc10, %3, 3,5,9
+ mov r4, r1
+.body
+ mov r3d, %3
+ mova m1, [pw_pixel_max]
+%if num_mmregs > 8
+ mova m8, [pw_16]
+ %define p16 m8
+%else
+ %define p16 [pw_16]
+%endif
+.nextrow
+%if %0 == 4
+ movu m2, [r1-4]
+ movu m3, [r1-2]
+ movu m4, [r1+0]
+ ADDW m2, [r1+6], m5
+ ADDW m3, [r1+4], m5
+ ADDW m4, [r1+2], m5
+%else ; movu is slow on these processors
+%if mmsize==16
+ movu m2, [r1-4]
+ movu m0, [r1+6]
+ mova m6, m0
+ psrldq m0, 6
+
+ paddw m6, m2
+ PALIGNR m3, m0, m2, 2, m5
+ PALIGNR m7, m0, m2, 8, m5
+ paddw m3, m7
+ PALIGNR m4, m0, m2, 4, m5
+ PALIGNR m7, m0, m2, 6, m5
+ paddw m4, m7
+ SWAP 2, 6
+%else
+ movu m2, [r1-4]
+ movu m6, [r1+4]
+ PALIGNR m3, m6, m2, 2, m5
+ paddw m3, m6
+ PALIGNR m4, m6, m2, 4, m5
+ PALIGNR m7, m6, m2, 6, m5
+ paddw m4, m7
+ paddw m2, [r1+6]
+%endif
+%endif
+
+ FILT_H m2, m3, m4, p16
+ psraw m2, 1
+ pxor m0, m0
+ CLIPW m2, m0, m1
+ movu m3, [r4]
+ pavgw m2, m3
+ OP_MOV [r0], m2
+ add r0, r2
+ add r1, r2
+ add r4, r2
+ dec r3d
+ jg .nextrow
+ rep ret
+%endmacro
+
+MC_CACHE MC10
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc02(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro V_FILT 11
+v_filt%9_%10_10_%11:
+ add r4, r2
+.no_addr4:
+ FILT_V m0, m1, m2, m3, m4, m5, m6, m7
+ add r1, r2
+ add r0, r2
+ ret
+%endmacro
+
+INIT_MMX
+RESET_MM_PERMUTATION
+%assign i 0
+%rep 4
+V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 4, i, mmxext
+SWAP 0,1,2,3,4,5
+%assign i i+1
+%endrep
+
+INIT_XMM
+RESET_MM_PERMUTATION
+%assign i 0
+%rep 6
+V_FILT m0, m1, m2, m3, m4, m5, m6, m7, 8, i, sse2
+SWAP 0,1,2,3,4,5
+%assign i i+1
+%endrep
+
+%macro MC02 3
+cglobal_mc %1, %2, mc02, %3, 3,4,8
+ PRELOAD_V
+
+ sub r0, r2
+%assign j 0
+%rep %3
+ %assign i (j % 6)
+ call v_filt%3_ %+ i %+ _10_%1.no_addr4
+ OP_MOV [r0], m0
+ SWAP 0,1,2,3,4,5
+ %assign j j+1
+%endrep
+ ret
+%endmacro
+
+MC MC02
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc01(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC01 3
+cglobal_mc %1, %2, mc01, %3, 3,5,8
+ mov r4, r1
+.body
+ PRELOAD_V
+
+ sub r4, r2
+ sub r0, r2
+%assign j 0
+%rep %3
+ %assign i (j % 6)
+ call v_filt%3_ %+ i %+ _10_%1
+ movu m7, [r4]
+ pavgw m0, m7
+ OP_MOV [r0], m0
+ SWAP 0,1,2,3,4,5
+ %assign j j+1
+%endrep
+ ret
+%endmacro
+
+MC MC01
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc03(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC03 3
+cglobal_mc %1, %2, mc03, %3, 3,5,8
+ lea r4, [r1+r2]
+ jmp stub_%2_h264_qpel%3_mc01_10_%1.body
+%endmacro
+
+MC MC03
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc11(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro H_FILT_AVG 3-4
+h_filt%2_%3_10_%1:
+;FILT_H with fewer registers and averaged with the FILT_V result
+;m6,m7 are tmp registers, m0 is the FILT_V result, the rest are to be used next in the next iteration
+;unfortunately I need three registers, so m5 will have to be re-read from memory
+ movu m5, [r4-4]
+ ADDW m5, [r4+6], m7
+ movu m6, [r4-2]
+ ADDW m6, [r4+4], m7
+ paddw m5, [pw_16]
+ psubw m5, m6 ; a-b
+ psraw m5, 2 ; (a-b)/4
+ psubw m5, m6 ; (a-b)/4-b
+ movu m6, [r4+0]
+ ADDW m6, [r4+2], m7
+ paddw m5, m6 ; (a-b)/4-b+c
+ psraw m5, 2 ; ((a-b)/4-b+c)/4
+ paddw m5, m6 ; ((a-b)/4-b+c)/4+c = (a-5*b+20*c)/16
+ psraw m5, 1
+ CLIPW m5, [pb_0], [pw_pixel_max]
+;avg FILT_V, FILT_H
+ pavgw m0, m5
+%if %0!=4
+ movu m5, [r1+r5]
+%endif
+ ret
+%endmacro
+
+INIT_MMX
+RESET_MM_PERMUTATION
+%assign i 0
+%rep 3
+H_FILT_AVG mmxext, 4, i
+SWAP 0,1,2,3,4,5
+%assign i i+1
+%endrep
+H_FILT_AVG mmxext, 4, i, 0
+
+INIT_XMM
+RESET_MM_PERMUTATION
+%assign i 0
+%rep 6
+%if i==1
+H_FILT_AVG sse2, 8, i, 0
+%else
+H_FILT_AVG sse2, 8, i
+%endif
+SWAP 0,1,2,3,4,5
+%assign i i+1
+%endrep
+
+%macro MC11 3
+; this REALLY needs x86_64
+cglobal_mc %1, %2, mc11, %3, 3,6,8
+ mov r4, r1
+.body
+ PRELOAD_V
+
+ sub r0, r2
+ sub r4, r2
+ mov r5, r2
+ neg r5
+%assign j 0
+%rep %3
+ %assign i (j % 6)
+ call v_filt%3_ %+ i %+ _10_%1
+ call h_filt%3_ %+ i %+ _10_%1
+%if %3==8 && i==1
+ movu m5, [r1+r5]
+%endif
+ OP_MOV [r0], m0
+ SWAP 0,1,2,3,4,5
+ %assign j j+1
+%endrep
+ ret
+%endmacro
+
+MC MC11
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc31(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC31 3
+cglobal_mc %1, %2, mc31, %3, 3,6,8
+ mov r4, r1
+ add r1, 2
+ jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+%endmacro
+
+MC MC31
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc13(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC13 3
+cglobal_mc %1, %2, mc13, %3, 3,7,12
+ lea r4, [r1+r2]
+ jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+%endmacro
+
+MC MC13
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc33(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC33 3
+cglobal_mc %1, %2, mc33, %3, 3,6,8
+ lea r4, [r1+r2]
+ add r1, 2
+ jmp stub_%2_h264_qpel%3_mc11_10_%1.body
+%endmacro
+
+MC MC33
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc22(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro FILT_H2 3
+ psubw %1, %2 ; a-b
+ psubw %2, %3 ; b-c
+ psllw %2, 2
+ psubw %1, %2 ; a-5*b+4*c
+ psllw %3, 4
+ paddw %1, %3 ; a-5*b+20*c
+%endmacro
+
+%macro FILT_VNRD 8
+ movu %6, [r1]
+ paddw %1, %6
+ mova %7, %2
+ paddw %7, %5
+ mova %8, %3
+ paddw %8, %4
+ FILT_H2 %1, %7, %8
+%endmacro
+
+%macro HV 2
+%ifidn %1,sse2
+%define PAD 12
+%define COUNT 2
+%else
+%define PAD 0
+%define COUNT 3
+%endif
+put_hv%2_10_%1:
+ neg r2 ; This actually saves instructions
+ lea r1, [r1+r2*2-mmsize+PAD]
+ lea r4, [rsp+PAD+gprsize]
+ mov r3d, COUNT
+.v_loop:
+ movu m0, [r1]
+ sub r1, r2
+ movu m1, [r1]
+ sub r1, r2
+ movu m2, [r1]
+ sub r1, r2
+ movu m3, [r1]
+ sub r1, r2
+ movu m4, [r1]
+ sub r1, r2
+%assign i 0
+%rep %2-1
+ FILT_VNRD m0, m1, m2, m3, m4, m5, m6, m7
+ psubw m0, [pad20]
+ movu [r4+i*mmsize*3], m0
+ sub r1, r2
+ SWAP 0,1,2,3,4,5
+%assign i i+1
+%endrep
+ FILT_VNRD m0, m1, m2, m3, m4, m5, m6, m7
+ psubw m0, [pad20]
+ movu [r4+i*mmsize*3], m0
+ add r4, mmsize
+ lea r1, [r1+r2*8+mmsize]
+%if %2==8
+ lea r1, [r1+r2*4]
+%endif
+ dec r3d
+ jg .v_loop
+ neg r2
+ ret
+%endmacro
+
+INIT_MMX
+HV mmxext, 4
+INIT_XMM
+HV sse2 , 8
+
+%macro H_LOOP 2
+%if num_mmregs > 8
+ %define s1 m8
+ %define s2 m9
+ %define s3 m10
+ %define d1 m11
+%else
+ %define s1 [tap1]
+ %define s2 [tap2]
+ %define s3 [tap3]
+ %define d1 [depad]
+%endif
+h%2_loop_op_%1:
+ movu m1, [r1+mmsize-4]
+ movu m2, [r1+mmsize-2]
+ mova m3, [r1+mmsize+0]
+ movu m4, [r1+mmsize+2]
+ movu m5, [r1+mmsize+4]
+ movu m6, [r1+mmsize+6]
+%if num_mmregs > 8
+ pmaddwd m1, s1
+ pmaddwd m2, s1
+ pmaddwd m3, s2
+ pmaddwd m4, s2
+ pmaddwd m5, s3
+ pmaddwd m6, s3
+ paddd m1, d1
+ paddd m2, d1
+%else
+ mova m0, s1
+ pmaddwd m1, m0
+ pmaddwd m2, m0
+ mova m0, s2
+ pmaddwd m3, m0
+ pmaddwd m4, m0
+ mova m0, s3
+ pmaddwd m5, m0
+ pmaddwd m6, m0
+ mova m0, d1
+ paddd m1, m0
+ paddd m2, m0
+%endif
+ paddd m3, m5
+ paddd m4, m6
+ paddd m1, m3
+ paddd m2, m4
+ psrad m1, 10
+ psrad m2, 10
+ pslld m2, 16
+ pand m1, [pd_0f]
+ por m1, m2
+%if num_mmregs <= 8
+ pxor m0, m0
+%endif
+ CLIPW m1, m0, m7
+ add r1, mmsize*3
+ ret
+%endmacro
+
+INIT_MMX
+H_LOOP mmxext, 4
+INIT_XMM
+H_LOOP sse2 , 8
+
+%macro MC22 3
+cglobal_mc %1, %2, mc22, %3, 3,7,12
+%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
+ mov r6, rsp ; backup stack pointer
+ and rsp, ~(mmsize-1) ; align stack
+ sub rsp, PAD
+
+ call put_hv%3_10_%1
+
+ mov r3d, %3
+ mova m7, [pw_pixel_max]
+%if num_mmregs > 8
+ pxor m0, m0
+ mova m8, [tap1]
+ mova m9, [tap2]
+ mova m10, [tap3]
+ mova m11, [depad]
+%endif
+ mov r1, rsp
+.h_loop:
+ call h%3_loop_op_%1
+
+ OP_MOV [r0], m1
+ add r0, r2
+ dec r3d
+ jg .h_loop
+
+ mov rsp, r6 ; restore stack pointer
+ ret
+%endmacro
+
+MC MC22
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc12(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC12 3
+cglobal_mc %1, %2, mc12, %3, 3,7,12
+%define PAD mmsize*8*4*2 ; SIZE*16*4*sizeof(pixel)
+ mov r6, rsp ; backup stack pointer
+ and rsp, ~(mmsize-1) ; align stack
+ sub rsp, PAD
+
+ call put_hv%3_10_%1
+
+ xor r4d, r4d
+.body
+ mov r3d, %3
+ pxor m0, m0
+ mova m7, [pw_pixel_max]
+%if num_mmregs > 8
+ mova m8, [tap1]
+ mova m9, [tap2]
+ mova m10, [tap3]
+ mova m11, [depad]
+%endif
+ mov r1, rsp
+.h_loop:
+ call h%3_loop_op_%1
+
+ movu m3, [r1+r4-2*mmsize] ; movu needed for mc32, etc
+ paddw m3, [depad2]
+ psrlw m3, 5
+ psubw m3, [unpad]
+ CLIPW m3, m0, m7
+ pavgw m1, m3
+
+ OP_MOV [r0], m1
+ add r0, r2
+ dec r3d
+ jg .h_loop
+
+ mov rsp, r6 ; restore stack pointer
+ ret
+%endmacro
+
+MC MC12
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc32(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC32 3
+cglobal_mc %1, %2, mc32, %3, 3,7,12
+%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
+ mov r6, rsp ; backup stack pointer
+ and rsp, ~(mmsize-1) ; align stack
+ sub rsp, PAD
+
+ call put_hv%3_10_%1
+
+ mov r4d, 2 ; sizeof(pixel)
+ jmp stub_%2_h264_qpel%3_mc12_10_%1.body
+%endmacro
+
+MC MC32
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc21(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro H_NRD 2
+put_h%2_10_%1:
+ add rsp, gprsize
+ mov r3d, %2
+ xor r4d, r4d
+ mova m6, [pad20]
+.nextrow
+ movu m2, [r5-4]
+ movu m3, [r5-2]
+ movu m4, [r5+0]
+ ADDW m2, [r5+6], m5
+ ADDW m3, [r5+4], m5
+ ADDW m4, [r5+2], m5
+
+ FILT_H2 m2, m3, m4
+ psubw m2, m6
+ mova [rsp+r4], m2
+ add r4d, mmsize*3
+ add r5, r2
+ dec r3d
+ jg .nextrow
+ sub rsp, gprsize
+ ret
+%endmacro
+
+INIT_MMX
+H_NRD mmxext, 4
+INIT_XMM
+H_NRD sse2 , 8
+
+%macro MC21 3
+cglobal_mc %1, %2, mc21, %3, 3,7,12
+ mov r5, r1
+.body
+%define PAD mmsize*8*3*2 ; SIZE*16*4*sizeof(pixel)
+ mov r6, rsp ; backup stack pointer
+ and rsp, ~(mmsize-1) ; align stack
+
+ sub rsp, PAD
+ call put_h%3_10_%1
+
+ sub rsp, PAD
+ call put_hv%3_10_%1
+
+ mov r4d, PAD-mmsize ; H buffer
+ jmp stub_%2_h264_qpel%3_mc12_10_%1.body
+%endmacro
+
+MC MC21
+
+;-----------------------------------------------------------------------------
+; void h264_qpel_mc23(uint8_t *dst, uint8_t *src, int stride)
+;-----------------------------------------------------------------------------
+%macro MC23 3
+cglobal_mc %1, %2, mc23, %3, 3,7,12
+ lea r5, [r1+r2]
+ jmp stub_%2_h264_qpel%3_mc21_10_%1.body
+%endmacro
+
+MC MC23
diff --git a/libavcodec/x86/h264_qpel_mmx.c b/libavcodec/x86/h264_qpel_mmx.c
index f5af44e..807d854 100644
--- a/libavcodec/x86/h264_qpel_mmx.c
+++ b/libavcodec/x86/h264_qpel_mmx.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2004-2005 Michael Niedermayer, Loren Merritt
+ * Copyright (c) 2011 Daniel Kang
*
* This file is part of FFmpeg.
*
@@ -1199,3 +1200,100 @@ H264_MC_816(H264_MC_HV, sse2)
H264_MC_816(H264_MC_H, ssse3)
H264_MC_816(H264_MC_HV, ssse3)
#endif
+
+
+
+//10bit
+#define LUMA_MC_OP(OP, NUM, DEPTH, TYPE, OPT) \
+void ff_ ## OP ## _h264_qpel ## NUM ## _ ## TYPE ## _ ## DEPTH ## _ ## OPT \
+ (uint8_t *dst, uint8_t *src, int stride);
+
+#define LUMA_MC_ALL(DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 4, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 4, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
+
+#define LUMA_MC_816(DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 8, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(put, 16, DEPTH, TYPE, OPT) \
+ LUMA_MC_OP(avg, 16, DEPTH, TYPE, OPT)
+
+LUMA_MC_ALL(10, mc00, mmxext)
+LUMA_MC_ALL(10, mc10, mmxext)
+LUMA_MC_ALL(10, mc20, mmxext)
+LUMA_MC_ALL(10, mc30, mmxext)
+LUMA_MC_ALL(10, mc01, mmxext)
+LUMA_MC_ALL(10, mc11, mmxext)
+LUMA_MC_ALL(10, mc21, mmxext)
+LUMA_MC_ALL(10, mc31, mmxext)
+LUMA_MC_ALL(10, mc02, mmxext)
+LUMA_MC_ALL(10, mc12, mmxext)
+LUMA_MC_ALL(10, mc22, mmxext)
+LUMA_MC_ALL(10, mc32, mmxext)
+LUMA_MC_ALL(10, mc03, mmxext)
+LUMA_MC_ALL(10, mc13, mmxext)
+LUMA_MC_ALL(10, mc23, mmxext)
+LUMA_MC_ALL(10, mc33, mmxext)
+
+LUMA_MC_816(10, mc00, sse2)
+LUMA_MC_816(10, mc10, sse2)
+LUMA_MC_816(10, mc10, sse2_cache64)
+LUMA_MC_816(10, mc10, ssse3_cache64)
+LUMA_MC_816(10, mc20, sse2)
+LUMA_MC_816(10, mc20, sse2_cache64)
+LUMA_MC_816(10, mc20, ssse3_cache64)
+LUMA_MC_816(10, mc30, sse2)
+LUMA_MC_816(10, mc30, sse2_cache64)
+LUMA_MC_816(10, mc30, ssse3_cache64)
+LUMA_MC_816(10, mc01, sse2)
+LUMA_MC_816(10, mc11, sse2)
+LUMA_MC_816(10, mc21, sse2)
+LUMA_MC_816(10, mc31, sse2)
+LUMA_MC_816(10, mc02, sse2)
+LUMA_MC_816(10, mc12, sse2)
+LUMA_MC_816(10, mc22, sse2)
+LUMA_MC_816(10, mc32, sse2)
+LUMA_MC_816(10, mc03, sse2)
+LUMA_MC_816(10, mc13, sse2)
+LUMA_MC_816(10, mc23, sse2)
+LUMA_MC_816(10, mc33, sse2)
+
+#define QPEL16_OPMC(OP, MC, MMX)\
+void ff_ ## OP ## _h264_qpel16_ ## MC ## _10_ ## MMX(uint8_t *dst, uint8_t *src, int stride){\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
+ src += 8*stride;\
+ dst += 8*stride;\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst , src , stride);\
+ ff_ ## OP ## _h264_qpel8_ ## MC ## _10_ ## MMX(dst+16, src+16, stride);\
+}
+
+#define QPEL16_OP(MC, MMX)\
+QPEL16_OPMC(put, MC, MMX)\
+QPEL16_OPMC(avg, MC, MMX)
+
+#define QPEL16(MMX)\
+QPEL16_OP(mc00, MMX)\
+QPEL16_OP(mc01, MMX)\
+QPEL16_OP(mc02, MMX)\
+QPEL16_OP(mc03, MMX)\
+QPEL16_OP(mc10, MMX)\
+QPEL16_OP(mc11, MMX)\
+QPEL16_OP(mc12, MMX)\
+QPEL16_OP(mc13, MMX)\
+QPEL16_OP(mc20, MMX)\
+QPEL16_OP(mc21, MMX)\
+QPEL16_OP(mc22, MMX)\
+QPEL16_OP(mc23, MMX)\
+QPEL16_OP(mc30, MMX)\
+QPEL16_OP(mc31, MMX)\
+QPEL16_OP(mc32, MMX)\
+QPEL16_OP(mc33, MMX)
+
+#if ARCH_X86_32 && HAVE_YASM // ARCH_X86_64 implies sse2+
+QPEL16(mmxext)
+#endif
diff --git a/libavcodec/x86/x86util.asm b/libavcodec/x86/x86util.asm
index b8ca348..09c2d54 100644
--- a/libavcodec/x86/x86util.asm
+++ b/libavcodec/x86/x86util.asm
@@ -528,6 +528,14 @@
%endif
%endmacro
+%macro SPLATD 2-3 0
+%if mmsize == 16
+ pshufd %1, %2, (%3)*0x55
+%else
+ pshufw %1, %2, (%3)*0x11 + ((%3)+1)*0x44
+%endif
+%endmacro
+
%macro CLIPW 3 ;(dst, min, max)
pmaxsw %1, %2
pminsw %1, %3
diff --git a/libavcodec/xsubdec.c b/libavcodec/xsubdec.c
index 9289a25..eaf2953 100644
--- a/libavcodec/xsubdec.c
+++ b/libavcodec/xsubdec.c
@@ -18,6 +18,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/mathematics.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "get_bits.h"
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
index 8c5be3c..0943ab0 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -260,6 +260,7 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
}
snd_pcm_hw_params_get_buffer_size_max(hw_params, &buffer_size);
+ buffer_size = FFMIN(buffer_size, ALSA_BUFFER_SIZE_MAX);
/* TODO: maybe use ctx->max_picture_buffer somehow */
res = snd_pcm_hw_params_set_buffer_size_near(h, hw_params, &buffer_size);
if (res < 0) {
@@ -269,6 +270,8 @@ av_cold int ff_alsa_open(AVFormatContext *ctx, snd_pcm_stream_t mode,
}
snd_pcm_hw_params_get_period_size_min(hw_params, &period_size, NULL);
+ if (!period_size)
+ period_size = buffer_size / 4;
res = snd_pcm_hw_params_set_period_size_near(h, hw_params, &period_size, NULL);
if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "cannot set ALSA period size (%s)\n",
@@ -316,6 +319,7 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
AlsaData *s = s1->priv_data;
av_freep(&s->reorder_buf);
+ ff_timefilter_destroy(s->timefilter);
snd_pcm_close(s->h);
return 0;
}
diff --git a/libavdevice/alsa-audio-dec.c b/libavdevice/alsa-audio-dec.c
index 2424c02..94162d2 100644
--- a/libavdevice/alsa-audio-dec.c
+++ b/libavdevice/alsa-audio-dec.c
@@ -47,6 +47,7 @@
#include <alsa/asoundlib.h>
#include "libavutil/opt.h"
+#include "libavutil/mathematics.h"
#include "avdevice.h"
#include "alsa-audio.h"
@@ -59,6 +60,7 @@ static av_cold int audio_read_header(AVFormatContext *s1,
int ret;
enum CodecID codec_id;
snd_pcm_sw_params_t *sw_params;
+ double o;
#if FF_API_FORMAT_PARAMETERS
if (ap->sample_rate > 0)
@@ -82,35 +84,17 @@ static av_cold int audio_read_header(AVFormatContext *s1,
return AVERROR(EIO);
}
- if (snd_pcm_type(s->h) != SND_PCM_TYPE_HW)
- av_log(s1, AV_LOG_WARNING,
- "capture with some ALSA plugins, especially dsnoop, "
- "may hang.\n");
-
- ret = snd_pcm_sw_params_malloc(&sw_params);
- if (ret < 0) {
- av_log(s1, AV_LOG_ERROR, "cannot allocate software parameters structure (%s)\n",
- snd_strerror(ret));
- goto fail;
- }
-
- snd_pcm_sw_params_current(s->h, sw_params);
- snd_pcm_sw_params_set_tstamp_mode(s->h, sw_params, SND_PCM_TSTAMP_ENABLE);
-
- ret = snd_pcm_sw_params(s->h, sw_params);
- snd_pcm_sw_params_free(sw_params);
- if (ret < 0) {
- av_log(s1, AV_LOG_ERROR, "cannot install ALSA software parameters (%s)\n",
- snd_strerror(ret));
- goto fail;
- }
-
/* take real parameters */
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = codec_id;
st->codec->sample_rate = s->sample_rate;
st->codec->channels = s->channels;
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
+ o = 2 * M_PI * s->period_size / s->sample_rate * 1.5; // bandwidth: 1.5Hz
+ s->timefilter = ff_timefilter_new(1000000.0 / s->sample_rate,
+ sqrt(2 * o), o * o);
+ if (!s->timefilter)
+ goto fail;
return 0;
@@ -124,14 +108,14 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
AlsaData *s = s1->priv_data;
AVStream *st = s1->streams[0];
int res;
- snd_htimestamp_t timestamp;
- snd_pcm_uframes_t ts_delay;
+ int64_t dts;
+ snd_pcm_sframes_t delay = 0;
- if (av_new_packet(pkt, s->period_size) < 0) {
+ if (av_new_packet(pkt, s->period_size * s->frame_size) < 0) {
return AVERROR(EIO);
}
- while ((res = snd_pcm_readi(s->h, pkt->data, pkt->size / s->frame_size)) < 0) {
+ while ((res = snd_pcm_readi(s->h, pkt->data, s->period_size)) < 0) {
if (res == -EAGAIN) {
av_free_packet(pkt);
@@ -144,14 +128,13 @@ static int audio_read_packet(AVFormatContext *s1, AVPacket *pkt)
return AVERROR(EIO);
}
+ ff_timefilter_reset(s->timefilter);
}
- snd_pcm_htimestamp(s->h, &ts_delay, &timestamp);
- ts_delay += res;
- pkt->pts = timestamp.tv_sec * 1000000LL
- + (timestamp.tv_nsec * st->codec->sample_rate
- - ts_delay * 1000000000LL + st->codec->sample_rate * 500LL)
- / (st->codec->sample_rate * 1000LL);
+ dts = av_gettime();
+ snd_pcm_delay(s->h, &delay);
+ dts -= av_rescale(delay + res, 1000000, s->sample_rate);
+ pkt->pts = ff_timefilter_update(s->timefilter, dts, res);
pkt->size = res * s->frame_size;
diff --git a/libavdevice/alsa-audio-enc.c b/libavdevice/alsa-audio-enc.c
index a53c176..0da22bb 100644
--- a/libavdevice/alsa-audio-enc.c
+++ b/libavdevice/alsa-audio-enc.c
@@ -61,6 +61,7 @@ static av_cold int audio_write_header(AVFormatContext *s1)
st->codec->sample_rate, sample_rate);
goto fail;
}
+ av_set_pts_info(st, 64, 1, sample_rate);
return res;
@@ -101,6 +102,17 @@ static int audio_write_packet(AVFormatContext *s1, AVPacket *pkt)
return 0;
}
+static void
+audio_get_output_timestamp(AVFormatContext *s1, int stream,
+ int64_t *dts, int64_t *wall)
+{
+ AlsaData *s = s1->priv_data;
+ snd_pcm_sframes_t delay = 0;
+ *wall = av_gettime();
+ snd_pcm_delay(s->h, &delay);
+ *dts = s1->streams[0]->cur_dts - delay;
+}
+
AVOutputFormat ff_alsa_muxer = {
"alsa",
NULL_IF_CONFIG_SMALL("ALSA audio output"),
@@ -112,5 +124,6 @@ AVOutputFormat ff_alsa_muxer = {
audio_write_header,
audio_write_packet,
ff_alsa_close,
+ .get_output_timestamp = audio_get_output_timestamp,
.flags = AVFMT_NOFILE,
};
diff --git a/libavdevice/alsa-audio.h b/libavdevice/alsa-audio.h
index 0f467e3..ab60e73 100644
--- a/libavdevice/alsa-audio.h
+++ b/libavdevice/alsa-audio.h
@@ -33,6 +33,7 @@
#include <alsa/asoundlib.h>
#include "config.h"
#include "libavutil/log.h"
+#include "libavformat/timefilter.h"
#include "avdevice.h"
/* XXX: we make the assumption that the soundcard accepts this format */
@@ -42,13 +43,16 @@
typedef void (*ff_reorder_func)(const void *, void *, int);
+#define ALSA_BUFFER_SIZE_MAX 32768
+
typedef struct {
AVClass *class;
snd_pcm_t *h;
- int frame_size; ///< preferred size for reads and writes
- int period_size; ///< bytes per sample * channels
+ int frame_size; ///< bytes per sample * channels
+ int period_size; ///< preferred size for reads and writes, in frames
int sample_rate; ///< sample rate set by user
int channels; ///< number of channels set by user
+ TimeFilter *timefilter;
void (*reorder_func)(const void *, void *, int);
void *reorder_buf;
int reorder_buf_size; ///< in frames
diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c
index 2017087..dffb06c 100644
--- a/libavdevice/libdc1394.c
+++ b/libavdevice/libdc1394.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "libavutil/log.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avdevice.h"
diff --git a/libavdevice/openal-dec.c b/libavdevice/openal-dec.c
index f01dff7..c1bc351 100644
--- a/libavdevice/openal-dec.c
+++ b/libavdevice/openal-dec.c
@@ -3,23 +3,17 @@
*
* This file is part of FFmpeg.
*
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
*/
/**
diff --git a/libavdevice/oss_audio.c b/libavdevice/oss_audio.c
index 2fde491..a1f0cbd 100644
--- a/libavdevice/oss_audio.c
+++ b/libavdevice/oss_audio.c
@@ -80,13 +80,6 @@ static int audio_open(AVFormatContext *s1, int is_output, const char *audio_devi
fcntl(audio_fd, F_SETFL, O_NONBLOCK);
s->frame_size = AUDIO_BLOCK_SIZE;
-#if 0
- tmp = (NB_FRAGMENTS << 16) | FRAGMENT_BITS;
- err = ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &tmp);
- if (err < 0) {
- perror("SNDCTL_DSP_SETFRAGMENT");
- }
-#endif
/* select format : favour native format */
err = ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &tmp);
diff --git a/libavdevice/x11grab.c b/libavdevice/x11grab.c
index 09c121e..e204872 100644
--- a/libavdevice/x11grab.c
+++ b/libavdevice/x11grab.c
@@ -70,7 +70,7 @@ struct x11_grab
XImage *image; /**< X11 image holding the grab */
int use_shm; /**< !0 when using XShm extension */
XShmSegmentInfo shminfo; /**< When using XShm, keeps track of XShm infos */
- int nomouse;
+ int draw_mouse; /**< Set by a private option. */
char *framerate; /**< Set by a private option. */
};
@@ -104,7 +104,7 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
offset = strchr(dpyname, '+');
if (offset) {
sscanf(offset, "%d,%d", &x_off, &y_off);
- x11grab->nomouse= strstr(offset, "nomouse");
+ x11grab->draw_mouse = !strstr(offset, "nomouse");
*offset= 0;
}
@@ -218,21 +218,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
break;
case 32:
-#if 0
- GetColorInfo (image, &c_info);
- if ( c_info.alpha_mask == 0xff000000 && image->green_mask == 0x0000ff00) {
- /* byte order is relevant here, not endianness
- * endianness is handled by avcodec, but atm no such thing
- * as having ABGR, instead of ARGB in a word. Since we
- * need this for Solaris/SPARC, but need to do the conversion
- * for every frame we do it outside of this loop, cf. below
- * this matches both ARGB32 and ABGR32 */
- input_pixfmt = PIX_FMT_ARGB32;
- } else {
- av_log(s1, AV_LOG_ERROR,"image depth %i not supported ... aborting\n", image->bits_per_pixel);
- return AVERROR(EIO);
- }
-#endif
input_pixfmt = PIX_FMT_RGB32;
break;
default:
@@ -426,7 +411,7 @@ x11grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
}
}
- if(!s->nomouse){
+ if (s->draw_mouse) {
paint_mouse_pointer(image, s);
}
@@ -467,6 +452,7 @@ x11grab_read_close(AVFormatContext *s1)
static const AVOption options[] = {
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = "vga"}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "ntsc"}, 0, 0, DEC },
+ { "draw_mouse", "Draw the mouse pointer.", OFFSET(draw_mouse), FF_OPT_TYPE_INT, { 1 }, 0, 1, DEC },
{ NULL },
};
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 5d25c72..362bbfe 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -23,11 +23,14 @@
#define AVFILTER_AVFILTER_H
#include "libavutil/avutil.h"
+#include "libavutil/log.h"
#include "libavutil/samplefmt.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 24
-#define LIBAVFILTER_VERSION_MICRO 0
+#define LIBAVFILTER_VERSION_MICRO 4
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
@@ -159,6 +162,7 @@ static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilt
switch (src->type) {
case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break;
case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break;
+ default: break;
}
}
diff --git a/libavfilter/avfiltergraph.h b/libavfilter/avfiltergraph.h
index a975926..f4c88bc 100644
--- a/libavfilter/avfiltergraph.h
+++ b/libavfilter/avfiltergraph.h
@@ -124,12 +124,12 @@ void avfilter_inout_free(AVFilterInOut **inout);
*
* @param graph the filter graph where to link the parsed graph context
* @param filters string to be parsed
- * @param inputs linked list to the inputs of the graph, may be NULL.
- * It is updated to contain the list of open inputs after the parsing,
- * should be freed with avfilter_inout_free().
- * @param outputs linked list to the outputs of the graph, may be NULL.
- * It is updated to contain the list of open outputs after the parsing,
- * should be freed with avfilter_inout_free().
+ * @param inputs pointer to a linked list to the inputs of the graph, may be NULL.
+ * If non-NULL, *inputs is updated to contain the list of open inputs
+ * after the parsing, should be freed with avfilter_inout_free().
+ * @param outputs pointer to a linked list to the outputs of the graph, may be NULL.
+ * If non-NULL, *outputs is updated to contain the list of open outputs
+ * after the parsing, should be freed with avfilter_inout_free().
* @return zero on success, a negative AVERROR code on error
*/
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
diff --git a/libavfilter/formats.c b/libavfilter/formats.c
index eccb523..b6e30e7 100644
--- a/libavfilter/formats.c
+++ b/libavfilter/formats.c
@@ -22,6 +22,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/audioconvert.h"
#include "avfilter.h"
+#include "internal.h"
/**
* Add all refs from a to ret and destroy a.
@@ -73,6 +74,17 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
return ret;
}
+int ff_fmt_is_in(int fmt, const int *fmts)
+{
+ const int *p;
+
+ for (p = fmts; *p != -1; p++) {
+ if (fmt == *p)
+ return 1;
+ }
+ return 0;
+}
+
#define MAKE_FORMAT_LIST() \
AVFilterFormats *formats; \
int count = 0; \
diff --git a/libavfilter/graphparser.c b/libavfilter/graphparser.c
index 5178eea..9db7a4d 100644
--- a/libavfilter/graphparser.c
+++ b/libavfilter/graphparser.c
@@ -83,8 +83,8 @@ static char *parse_link_name(const char **buf, void *log_ctx)
* Create an instance of a filter, initialize and insert it in the
* filtergraph in *ctx.
*
+ * @param filt_ctx put here a filter context in case of successful creation and configuration, NULL otherwise.
* @param ctx the filtergraph context
- * @param put here a filter context in case of successful creation and configuration, NULL otherwise.
* @param index an index which is supposed to be unique for each filter instance added to the filtergraph
* @param filt_name the name of the filter to create
* @param args the arguments provided to the filter during its initialization
@@ -333,38 +333,40 @@ static int parse_outputs(const char **buf, AVFilterInOut **curr_inputs,
}
int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
- AVFilterInOut **open_inputs, AVFilterInOut **open_outputs,
+ AVFilterInOut **open_inputs_ptr, AVFilterInOut **open_outputs_ptr,
void *log_ctx)
{
- int index = 0, ret;
+ int index = 0, ret = 0;
char chr = 0;
AVFilterInOut *curr_inputs = NULL;
+ AVFilterInOut *open_inputs = open_inputs_ptr ? *open_inputs_ptr : NULL;
+ AVFilterInOut *open_outputs = open_outputs_ptr ? *open_outputs_ptr : NULL;
do {
AVFilterContext *filter;
const char *filterchain = filters;
filters += strspn(filters, WHITESPACES);
- if ((ret = parse_inputs(&filters, &curr_inputs, open_outputs, log_ctx)) < 0)
- goto fail;
+ if ((ret = parse_inputs(&filters, &curr_inputs, &open_outputs, log_ctx)) < 0)
+ goto end;
if ((ret = parse_filter(&filter, &filters, graph, index, log_ctx)) < 0)
- goto fail;
+ goto end;
if (filter->input_count == 1 && !curr_inputs && !index) {
- /* First input can be omitted if it is "[in]" */
+ /* First input pad, assume it is "[in]" if not specified */
const char *tmp = "[in]";
- if ((ret = parse_inputs(&tmp, &curr_inputs, open_outputs, log_ctx)) < 0)
- goto fail;
+ if ((ret = parse_inputs(&tmp, &curr_inputs, &open_outputs, log_ctx)) < 0)
+ goto end;
}
- if ((ret = link_filter_inouts(filter, &curr_inputs, open_inputs, log_ctx)) < 0)
- goto fail;
+ if ((ret = link_filter_inouts(filter, &curr_inputs, &open_inputs, log_ctx)) < 0)
+ goto end;
- if ((ret = parse_outputs(&filters, &curr_inputs, open_inputs, open_outputs,
+ if ((ret = parse_outputs(&filters, &curr_inputs, &open_inputs, &open_outputs,
log_ctx)) < 0)
- goto fail;
+ goto end;
filters += strspn(filters, WHITESPACES);
chr = *filters++;
@@ -374,7 +376,7 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
"Invalid filterchain containing an unlabelled output pad: \"%s\"\n",
filterchain);
ret = AVERROR(EINVAL);
- goto fail;
+ goto end;
}
index++;
} while (chr == ',' || chr == ';');
@@ -384,25 +386,29 @@ int avfilter_graph_parse(AVFilterGraph *graph, const char *filters,
"Unable to parse graph description substring: \"%s\"\n",
filters - 1);
ret = AVERROR(EINVAL);
- goto fail;
+ goto end;
}
- if (open_inputs && *open_inputs && !strcmp((*open_inputs)->name, "out") && curr_inputs) {
- /* Last output can be omitted if it is "[out]" */
+ if (curr_inputs) {
+ /* Last output pad, assume it is "[out]" if not specified */
const char *tmp = "[out]";
- if ((ret = parse_outputs(&tmp, &curr_inputs, open_inputs, open_outputs,
+ if ((ret = parse_outputs(&tmp, &curr_inputs, &open_inputs, &open_outputs,
log_ctx)) < 0)
- goto fail;
+ goto end;
}
- return 0;
-
- fail:
- for (; graph->filter_count > 0; graph->filter_count--)
- avfilter_free(graph->filters[graph->filter_count - 1]);
- av_freep(&graph->filters);
- avfilter_inout_free(open_inputs);
- avfilter_inout_free(open_outputs);
+end:
+ /* clear open_in/outputs only if not passed as parameters */
+ if (open_inputs_ptr) *open_inputs_ptr = open_inputs;
+ else avfilter_inout_free(&open_inputs);
+ if (open_outputs_ptr) *open_outputs_ptr = open_outputs;
+ else avfilter_inout_free(&open_outputs);
avfilter_inout_free(&curr_inputs);
+
+ if (ret < 0) {
+ for (; graph->filter_count > 0; graph->filter_count--)
+ avfilter_free(graph->filters[graph->filter_count - 1]);
+ av_freep(&graph->filters);
+ }
return ret;
}
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index be1e9b0..7537565 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -58,4 +58,7 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graphctx, AVClass *log_ctx);
/** default handler for freeing audio/video buffer when there are no references left */
void ff_avfilter_default_free_buffer(AVFilterBuffer *buf);
+/** Tell is a format is contained in the provided list terminated by -1. */
+int ff_fmt_is_in(int fmt, const int *fmts);
+
#endif /* AVFILTER_INTERNAL_H */
diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
index 3b4a57c..5234adb 100644
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@ -23,6 +23,7 @@
* aspect ratio modification video filters
*/
+#include "libavutil/mathematics.h"
#include "avfilter.h"
typedef struct {
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 531b8de..b9c60cb 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -30,6 +30,7 @@
#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mathematics.h"
static const char *var_names[] = {
"E",
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index f495f68..7d8372b 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -424,15 +424,10 @@ static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, u
{
int r, c, alpha;
unsigned int luma_pos, chroma_pos1, chroma_pos2;
- uint8_t src_val, dst_pixel[4];
+ uint8_t src_val;
for (r = 0; r < bitmap->rows && r+y < height; r++) {
for (c = 0; c < bitmap->width && c+x < width; c++) {
- /* get pixel in the picref (destination) */
- dst_pixel[0] = picref->data[0][ c+x + (y+r) * picref->linesize[0]];
- dst_pixel[1] = picref->data[1][((c+x) >> hsub) + ((y+r) >> vsub) * picref->linesize[1]];
- dst_pixel[2] = picref->data[2][((c+x) >> hsub) + ((y+r) >> vsub) * picref->linesize[2]];
-
/* get intensity value in the glyph bitmap (source) */
src_val = GET_BITMAP_VAL(r, c);
if (!src_val)
@@ -460,18 +455,10 @@ static inline int draw_glyph_rgb(AVFilterBufferRef *picref, FT_Bitmap *bitmap,
{
int r, c, alpha;
uint8_t *p;
- uint8_t src_val, dst_pixel[4];
+ uint8_t src_val;
for (r = 0; r < bitmap->rows && r+y < height; r++) {
for (c = 0; c < bitmap->width && c+x < width; c++) {
- /* get pixel in the picref (destination) */
- dst_pixel[0] = picref->data[0][(c+x + rgba_map[0]) * pixel_step +
- (y+r) * picref->linesize[0]];
- dst_pixel[1] = picref->data[0][(c+x + rgba_map[1]) * pixel_step +
- (y+r) * picref->linesize[0]];
- dst_pixel[2] = picref->data[0][(c+x + rgba_map[2]) * pixel_step +
- (y+r) * picref->linesize[0]];
-
/* get intensity value in the glyph bitmap (source) */
src_val = GET_BITMAP_VAL(r, c);
if (!src_val)
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index ab19570..f5b7abb 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -28,6 +28,7 @@
#include <frei0r.h>
#include "libavutil/avstring.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c
index fdab694..a1f93ff 100644
--- a/libavfilter/vf_lut.c
+++ b/libavfilter/vf_lut.c
@@ -28,6 +28,7 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
+#include "internal.h"
static const char *var_names[] = {
"E",
@@ -165,16 +166,6 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
-static int pix_fmt_is_in(enum PixelFormat pix_fmt, enum PixelFormat *pix_fmts)
-{
- enum PixelFormat *p;
- for (p = pix_fmts; *p != PIX_FMT_NONE; p++) {
- if (pix_fmt == *p)
- return 1;
- }
- return 0;
-}
-
/**
* Clip value val in the minval - maxval range.
*/
@@ -238,6 +229,7 @@ static int config_props(AVFilterLink *inlink)
min[Y] = min[U] = min[V] = 16;
max[Y] = 235;
max[U] = max[V] = 240;
+ min[A] = 0; max[A] = 255;
break;
default:
min[0] = min[1] = min[2] = min[3] = 0;
@@ -245,8 +237,8 @@ static int config_props(AVFilterLink *inlink)
}
lut->is_yuv = lut->is_rgb = 0;
- if (pix_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
- else if (pix_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
+ if (ff_fmt_is_in(inlink->format, yuv_pix_fmts)) lut->is_yuv = 1;
+ else if (ff_fmt_is_in(inlink->format, rgb_pix_fmts)) lut->is_rgb = 1;
if (lut->is_rgb) {
switch (inlink->format) {
@@ -328,7 +320,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
}
} else {
/* planar */
- for (plane = 0; inpic->data[plane]; plane++) {
+ for (plane = 0; plane < 4 && inpic->data[plane]; plane++) {
int vsub = plane == 1 || plane == 2 ? lut->vsub : 0;
int hsub = plane == 1 || plane == 2 ? lut->hsub : 0;
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c
index 0eb24b9..d473c1b 100644
--- a/libavfilter/vf_overlay.c
+++ b/libavfilter/vf_overlay.c
@@ -30,6 +30,7 @@
#include "libavutil/avstring.h"
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mathematics.h"
#include "internal.h"
static const char *var_names[] = {
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 0ca5bd0..e01a750 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -32,6 +32,7 @@
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/parseutils.h"
+#include "libavutil/mathematics.h"
#include "drawutils.h"
static const char *var_names[] = {
@@ -44,7 +45,8 @@ static const char *var_names[] = {
"out_h", "oh",
"x",
"y",
- "a",
+ "a", "dar",
+ "sar",
"hsub",
"vsub",
NULL
@@ -60,7 +62,8 @@ enum var_name {
VAR_OUT_H, VAR_OH,
VAR_X,
VAR_Y,
- VAR_A,
+ VAR_A, VAR_DAR,
+ VAR_SAR,
VAR_HSUB,
VAR_VSUB,
VARS_NB
@@ -155,9 +158,11 @@ static int config_input(AVFilterLink *inlink)
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
- var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_DAR] = var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
+ (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
var_values[VAR_HSUB] = 1<<pad->hsub;
- var_values[VAR_VSUB] = 2<<pad->vsub;
+ var_values[VAR_VSUB] = 1<<pad->vsub;
/* evaluate width and height */
av_expr_parse_and_eval(&res, (expr = pad->w_expr),
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index e172a2e..3be5d99 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -26,6 +26,7 @@
#include "avfilter.h"
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/mathematics.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avassert.h"
#include "libswscale/swscale.h"
@@ -38,7 +39,8 @@ static const char *var_names[] = {
"in_h", "ih",
"out_w", "ow",
"out_h", "oh",
- "a",
+ "a", "dar",
+ "sar",
"hsub",
"vsub",
NULL
@@ -52,7 +54,8 @@ enum var_name {
VAR_IN_H, VAR_IH,
VAR_OUT_W, VAR_OW,
VAR_OUT_H, VAR_OH,
- VAR_A,
+ VAR_A, VAR_DAR,
+ VAR_SAR,
VAR_HSUB,
VAR_VSUB,
VARS_NB
@@ -157,7 +160,9 @@ static int config_props(AVFilterLink *outlink)
var_values[VAR_IN_H] = var_values[VAR_IH] = inlink->h;
var_values[VAR_OUT_W] = var_values[VAR_OW] = NAN;
var_values[VAR_OUT_H] = var_values[VAR_OH] = NAN;
- var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_DAR] = var_values[VAR_A] = (float) inlink->w / inlink->h;
+ var_values[VAR_SAR] = inlink->sample_aspect_ratio.num ?
+ (float) inlink->sample_aspect_ratio.num / inlink->sample_aspect_ratio.den : 1;
var_values[VAR_HSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_w;
var_values[VAR_VSUB] = 1<<av_pix_fmt_descriptors[inlink->format].log2_chroma_h;
diff --git a/libavfilter/vf_setpts.c b/libavfilter/vf_setpts.c
index 31fa1ef..ace2595 100644
--- a/libavfilter/vf_setpts.c
+++ b/libavfilter/vf_setpts.c
@@ -27,6 +27,7 @@
/* #define DEBUG */
#include "libavutil/eval.h"
+#include "libavutil/mathematics.h"
#include "avfilter.h"
static const char *var_names[] = {
diff --git a/libavfilter/vf_settb.c b/libavfilter/vf_settb.c
index 3e48ac4..d0ac35c 100644
--- a/libavfilter/vf_settb.c
+++ b/libavfilter/vf_settb.c
@@ -25,6 +25,7 @@
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/mathematics.h"
#include "libavutil/rational.h"
#include "avfilter.h"
#include "internal.h"
diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c
index 296328b..56e4489 100644
--- a/libavfilter/vf_yadif.c
+++ b/libavfilter/vf_yadif.c
@@ -44,6 +44,12 @@ typedef struct {
int frame_pending;
+ /**
+ * 0: deinterlace all frames
+ * 1: only deinterlace frames marked as interlaced
+ */
+ int auto_enable;
+
AVFilterBufferRef *cur;
AVFilterBufferRef *next;
AVFilterBufferRef *prev;
@@ -240,6 +246,14 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
if (!yadif->cur)
return;
+ if (yadif->auto_enable && !yadif->cur->video->interlaced) {
+ yadif->out = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
+ avfilter_unref_buffer(yadif->prev);
+ yadif->prev = NULL;
+ avfilter_start_frame(ctx->outputs[0], yadif->out);
+ return;
+ }
+
if (!yadif->prev)
yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ);
@@ -259,6 +273,12 @@ static void end_frame(AVFilterLink *link)
if (!yadif->out)
return;
+ if (yadif->auto_enable && !yadif->cur->video->interlaced) {
+ avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1);
+ avfilter_end_frame(ctx->outputs[0]);
+ return;
+ }
+
return_frame(ctx, 0);
}
@@ -299,6 +319,9 @@ static int poll_frame(AVFilterLink *link)
}
assert(yadif->next || !val);
+ if (yadif->auto_enable && yadif->next && !yadif->next->video->interlaced)
+ return val;
+
return val * ((yadif->mode&1)+1);
}
@@ -344,9 +367,10 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
yadif->mode = 0;
yadif->parity = -1;
+ yadif->auto_enable = 0;
yadif->csp = NULL;
- if (args) sscanf(args, "%d:%d", &yadif->mode, &yadif->parity);
+ if (args) sscanf(args, "%d:%d:%d", &yadif->mode, &yadif->parity, &yadif->auto_enable);
yadif->filter_line = filter_line_c;
if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3)
@@ -356,7 +380,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
else if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX)
yadif->filter_line = ff_yadif_filter_line_mmx;
- av_log(ctx, AV_LOG_INFO, "mode:%d parity:%d\n", yadif->mode, yadif->parity);
+ av_log(ctx, AV_LOG_INFO, "mode:%d parity:%d auto_enable:%d\n", yadif->mode, yadif->parity, yadif->auto_enable);
return 0;
}
diff --git a/libavfilter/vsrc_color.c b/libavfilter/vsrc_color.c
index 00bfb66..b854ff2 100644
--- a/libavfilter/vsrc_color.c
+++ b/libavfilter/vsrc_color.c
@@ -27,6 +27,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/colorspace.h"
#include "libavutil/imgutils.h"
+#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "drawutils.h"
diff --git a/libavfilter/vsrc_nullsrc.c b/libavfilter/vsrc_nullsrc.c
index 487aa50..c513be8 100644
--- a/libavfilter/vsrc_nullsrc.c
+++ b/libavfilter/vsrc_nullsrc.c
@@ -23,6 +23,7 @@
#include "libavutil/avstring.h"
#include "libavutil/eval.h"
+#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"
diff --git a/libavfilter/x86/gradfun.c b/libavfilter/x86/gradfun.c
index 05d4a6f..e892117 100644
--- a/libavfilter/x86/gradfun.c
+++ b/libavfilter/x86/gradfun.c
@@ -1,19 +1,21 @@
/*
+ * Copyright (C) 2009 Loren Merritt <lorenm@u.washignton.edu>
+ *
* This file is part of FFmpeg.
*
- * FFmpeg is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * 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 General Public License along
- * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/cpu.h"
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 0b79c76..92bf072 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -28,6 +28,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#define RIFF_TAG MKTAG('R', 'I', 'F', 'F')
diff --git a/libavformat/Makefile b/libavformat/Makefile
index 3d9017b..6d7a342 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -338,6 +338,7 @@ OBJS-$(CONFIG_TCP_PROTOCOL) += tcp.o
OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o
# libavdevice dependencies
+OBJS-$(CONFIG_ALSA_INDEV) += timefilter.o
OBJS-$(CONFIG_JACK_INDEV) += timefilter.o
TESTPROGS = timefilter
diff --git a/libavformat/a64.c b/libavformat/a64.c
index 3481ee7..476db1c 100644
--- a/libavformat/a64.c
+++ b/libavformat/a64.c
@@ -55,7 +55,6 @@ static int a64_write_header(struct AVFormatContext *s)
break;
default:
return AVERROR(EINVAL);
- break;
}
avio_write(s->pb, header, 2);
c->prev_pkt.size = 0;
diff --git a/libavformat/adtsenc.c b/libavformat/adtsenc.c
index a03e128..43e719b 100644
--- a/libavformat/adtsenc.c
+++ b/libavformat/adtsenc.c
@@ -59,6 +59,10 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf
av_log(s, AV_LOG_ERROR, "Scalable configurations are not allowed in ADTS\n");
return -1;
}
+ if (get_bits(&gb, 1)) {
+ av_log(s, AV_LOG_ERROR, "Extension flag is not allowed in ADTS\n");
+ return -1;
+ }
if (!adts->channel_conf) {
init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE);
diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c
index 34ab0cc..0e6a061 100644
--- a/libavformat/aiffenc.c
+++ b/libavformat/aiffenc.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "aiff.h"
#include "avio_internal.h"
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index ddf97e9..f545487 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -27,6 +27,7 @@
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "avformat.h"
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index db00964..6935a97 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -25,6 +25,7 @@
#include "libavutil/common.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavcodec/mpegaudio.h"
#include "avformat.h"
#include "avio_internal.h"
@@ -84,13 +85,11 @@ static const ff_asf_guid index_guid = {
0x90, 0x08, 0x00, 0x33, 0xb1, 0xe5, 0xcf, 0x11, 0x89, 0xf4, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb
};
+#ifdef DEBUG
static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */
0xce, 0x75, 0xf8, 0x7b, 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2
};
-/**********************************/
-/* decoding */
-#ifdef DEBUG
#define PRINT_IF_GUID(g,cmp) \
if (!ff_guidcmp(g, &cmp)) \
av_dlog(NULL, "(GUID: %s) ", #cmp)
@@ -1094,8 +1093,6 @@ static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
assert(asf->packet_size_left < FRAME_HEADER_SIZE || asf->packet_segments < 1);
asf->packet_time_start = 0;
}
-
- return 0;
}
// Added to support seeking after packets have been read
diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index 3dc28f2..e2cebf8 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "internal.h"
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c
index 3c235c0..844112f 100644
--- a/libavformat/audiointerleave.c
+++ b/libavformat/audiointerleave.c
@@ -21,6 +21,7 @@
*/
#include "libavutil/fifo.h"
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "audiointerleave.h"
#include "internal.h"
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 1734649..3d57fa9 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -41,6 +41,7 @@ const char *avformat_license(void);
#include <stdio.h> /* FILE */
#include "libavcodec/avcodec.h"
#include "libavutil/dict.h"
+#include "libavutil/log.h"
#include "avio.h"
#include "libavformat/version.h"
@@ -48,63 +49,70 @@ const char *avformat_license(void);
struct AVFormatContext;
-/*
- * Public Metadata API.
+/**
+ * @defgroup metadata_api Public Metadata API
+ * @{
* The metadata API allows libavformat to export metadata tags to a client
* application using a sequence of key/value pairs. Like all strings in FFmpeg,
* metadata must be stored as UTF-8 encoded Unicode. Note that metadata
* exported by demuxers isn't checked to be valid UTF-8 in most cases.
* Important concepts to keep in mind:
- * 1. Keys are unique; there can never be 2 tags with the same key. This is
+ * - Keys are unique; there can never be 2 tags with the same key. This is
* also meant semantically, i.e., a demuxer should not knowingly produce
* several keys that are literally different but semantically identical.
* E.g., key=Author5, key=Author6. In this example, all authors must be
* placed in the same tag.
- * 2. Metadata is flat, not hierarchical; there are no subtags. If you
+ * - Metadata is flat, not hierarchical; there are no subtags. If you
* want to store, e.g., the email address of the child of producer Alice
* and actor Bob, that could have key=alice_and_bobs_childs_email_address.
- * 3. Several modifiers can be applied to the tag name. This is done by
+ * - Several modifiers can be applied to the tag name. This is done by
* appending a dash character ('-') and the modifier name in the order
* they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng.
- * a) language -- a tag whose value is localized for a particular language
+ * - language -- a tag whose value is localized for a particular language
* is appended with the ISO 639-2/B 3-letter language code.
* For example: Author-ger=Michael, Author-eng=Mike
* The original/default language is in the unqualified "Author" tag.
* A demuxer should set a default if it sets any translated tag.
- * b) sorting -- a modified version of a tag that should be used for
+ * - sorting -- a modified version of a tag that should be used for
* sorting will have '-sort' appended. E.g. artist="The Beatles",
* artist-sort="Beatles, The".
*
- * 4. Demuxers attempt to export metadata in a generic format, however tags
+ * - Demuxers attempt to export metadata in a generic format, however tags
* with no generic equivalents are left as they are stored in the container.
* Follows a list of generic tag names:
*
- * album -- name of the set this work belongs to
- * album_artist -- main creator of the set/album, if different from artist.
- * e.g. "Various Artists" for compilation albums.
- * artist -- main creator of the work
- * comment -- any additional description of the file.
- * composer -- who composed the work, if different from artist.
- * copyright -- name of copyright holder.
- * creation_time-- date when the file was created, preferably in ISO 8601.
- * date -- date when the work was created, preferably in ISO 8601.
- * disc -- number of a subset, e.g. disc in a multi-disc collection.
- * encoder -- name/settings of the software/hardware that produced the file.
- * encoded_by -- person/group who created the file.
- * filename -- original name of the file.
- * genre -- <self-evident>.
- * language -- main language in which the work is performed, preferably
- * in ISO 639-2 format. Multiple languages can be specified by
- * separating them with commas.
- * performer -- artist who performed the work, if different from artist.
- * E.g for "Also sprach Zarathustra", artist would be "Richard
- * Strauss" and performer "London Philharmonic Orchestra".
- * publisher -- name of the label/publisher.
- * service_name -- name of the service in broadcasting (channel name).
- * service_provider -- name of the service provider in broadcasting.
- * title -- name of the work.
- * track -- number of this work in the set, can be in form current/total.
- * variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
+ @verbatim
+ album -- name of the set this work belongs to
+ album_artist -- main creator of the set/album, if different from artist.
+ e.g. "Various Artists" for compilation albums.
+ artist -- main creator of the work
+ comment -- any additional description of the file.
+ composer -- who composed the work, if different from artist.
+ copyright -- name of copyright holder.
+ creation_time-- date when the file was created, preferably in ISO 8601.
+ date -- date when the work was created, preferably in ISO 8601.
+ disc -- number of a subset, e.g. disc in a multi-disc collection.
+ encoder -- name/settings of the software/hardware that produced the file.
+ encoded_by -- person/group who created the file.
+ filename -- original name of the file.
+ genre -- <self-evident>.
+ language -- main language in which the work is performed, preferably
+ in ISO 639-2 format. Multiple languages can be specified by
+ separating them with commas.
+ performer -- artist who performed the work, if different from artist.
+ E.g for "Also sprach Zarathustra", artist would be "Richard
+ Strauss" and performer "London Philharmonic Orchestra".
+ publisher -- name of the label/publisher.
+ service_name -- name of the service in broadcasting (channel name).
+ service_provider -- name of the service provider in broadcasting.
+ title -- name of the work.
+ track -- number of this work in the set, can be in form current/total.
+ variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of
+ @endverbatim
+ *
+ * Look in the examples section for an application example how to use the Metadata API.
+ *
+ * @}
*/
#if FF_API_OLD_METADATA2
@@ -316,6 +324,9 @@ typedef struct AVOutputFormat {
const AVClass *priv_class; ///< AVClass for the private context
+ void (*get_output_timestamp)(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall);
+
/* private fields */
struct AVOutputFormat *next;
} AVOutputFormat;
@@ -517,12 +528,14 @@ typedef struct AVStream {
int stream_copy; /**< If set, just copy stream. */
enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed.
+#if FF_API_AVSTREAM_QUALITY
//FIXME move stuff to a flags field?
/**
* Quality, as it has been removed from AVCodecContext and put in AVVideoFrame.
* MN: dunno if that is the right place for it
*/
- float quality;
+ attribute_deprecated float quality;
+#endif
/**
* Decoding: pts of the first frame of the stream, in stream time base.
@@ -734,12 +747,16 @@ typedef struct AVFormatContext {
int preload;
int max_delay;
+#if FF_API_LOOP_OUTPUT
#define AVFMT_NOOUTPUTLOOP -1
#define AVFMT_INFINITEOUTPUTLOOP 0
/**
* number of times to loop output in formats that support it
+ *
+ * @deprecated use the 'loop' private option in the gif muxer.
*/
- int loop_output;
+ attribute_deprecated int loop_output;
+#endif
int flags;
#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames.
@@ -757,7 +774,12 @@ typedef struct AVFormatContext {
#define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted)
#define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Dont merge side data but keep it seperate.
- int loop_input;
+#if FF_API_LOOP_INPUT
+ /**
+ * @deprecated, use the 'loop' img2 demuxer private option.
+ */
+ attribute_deprecated int loop_input;
+#endif
/**
* decoding: size of data to probe; encoding: unused.
@@ -1518,6 +1540,24 @@ int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out,
*/
int av_write_trailer(AVFormatContext *s);
+/**
+ * Get timing information for the data currently output.
+ * The exact meaning of "currently output" depends on the format.
+ * It is mostly relevant for devices that have an internal buffer and/or
+ * work in real time.
+ * @param s media file handle
+ * @param stream stream in the media file
+ * @param dts[out] DTS of the last packet output for the stream, in stream
+ * time_base units
+ * @param wall[out] absolute time when that packet whas output,
+ * in microsecond
+ * @return 0 if OK, AVERROR(ENOSYS) if the format does not support it
+ * Note: some formats or devices may not allow to measure dts and wall
+ * atomically.
+ */
+int av_get_output_timestamp(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall);
+
#if FF_API_DUMP_FORMAT
/**
* @deprecated Deprecated in favor of av_dump_format().
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 80620da..b28d39b 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -21,6 +21,7 @@
#include <strings.h>
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/bswap.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
@@ -861,13 +862,141 @@ static int get_stream_idx(int *d){
}
}
-static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
+static int avi_sync(AVFormatContext *s, int exit_early)
{
AVIContext *avi = s->priv_data;
AVIOContext *pb = s->pb;
int n, d[8];
unsigned int size;
int64_t i, sync;
+
+start_sync:
+ memset(d, -1, sizeof(int)*8);
+ for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
+ int j;
+
+ for(j=0; j<7; j++)
+ d[j]= d[j+1];
+ d[7]= avio_r8(pb);
+
+ size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
+
+ n= get_stream_idx(d+2);
+//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
+ if(i + (uint64_t)size > avi->fsize || d[0]<0)
+ continue;
+
+ //parse ix##
+ if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams)
+ //parse JUNK
+ ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
+ ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
+ avio_skip(pb, size);
+//av_log(s, AV_LOG_DEBUG, "SKIP\n");
+ goto start_sync;
+ }
+
+ //parse stray LIST
+ if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
+ avio_skip(pb, 4);
+ goto start_sync;
+ }
+
+ n= get_stream_idx(d);
+
+ if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams)
+ continue;
+
+ //detect ##ix chunk and skip
+ if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
+ avio_skip(pb, size);
+ goto start_sync;
+ }
+
+ //parse ##dc/##wb
+ if(n < s->nb_streams){
+ AVStream *st;
+ AVIStream *ast;
+ st = s->streams[n];
+ ast = st->priv_data;
+
+ if(s->nb_streams>=2){
+ AVStream *st1 = s->streams[1];
+ AVIStream *ast1= st1->priv_data;
+ //workaround for broken small-file-bug402.avi
+ if( d[2] == 'w' && d[3] == 'b'
+ && n==0
+ && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO
+ && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO
+ && ast->prefix == 'd'*256+'c'
+ && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count)
+ ){
+ n=1;
+ st = st1;
+ ast = ast1;
+ av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n");
+ }
+ }
+
+
+ if( (st->discard >= AVDISCARD_DEFAULT && size==0)
+ /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
+ || st->discard >= AVDISCARD_ALL){
+ if (!exit_early) {
+ ast->frame_offset += get_duration(ast, size);
+ }
+ avio_skip(pb, size);
+ goto start_sync;
+ }
+
+ if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
+ int k = avio_r8(pb);
+ int last = (k + avio_r8(pb) - 1) & 0xFF;
+
+ avio_rl16(pb); //flags
+
+ for (; k <= last; k++)
+ ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
+ ast->has_pal= 1;
+ goto start_sync;
+ } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
+ d[2]*256+d[3] == ast->prefix /*||
+ (d[2] == 'd' && d[3] == 'c') ||
+ (d[2] == 'w' && d[3] == 'b')*/) {
+
+ if (exit_early)
+ return 0;
+//av_log(s, AV_LOG_DEBUG, "OK\n");
+ if(d[2]*256+d[3] == ast->prefix)
+ ast->prefix_count++;
+ else{
+ ast->prefix= d[2]*256+d[3];
+ ast->prefix_count= 0;
+ }
+
+ avi->stream_index= n;
+ ast->packet_size= size + 8;
+ ast->remaining= size;
+
+ if(size || !ast->sample_size){
+ uint64_t pos= avio_tell(pb) - 8;
+ if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
+ av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
+ }
+ }
+ return 0;
+ }
+ }
+ }
+
+ return AVERROR_EOF;
+}
+
+static int avi_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ AVIContext *avi = s->priv_data;
+ AVIOContext *pb = s->pb;
+ int err;
void* dstr;
if (CONFIG_DV_DEMUXER && avi->dv_demux) {
@@ -1041,121 +1170,9 @@ resync:
return size;
}
- memset(d, -1, sizeof(int)*8);
- for(i=sync=avio_tell(pb); !url_feof(pb); i++) {
- int j;
-
- for(j=0; j<7; j++)
- d[j]= d[j+1];
- d[7]= avio_r8(pb);
-
- size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
-
- n= get_stream_idx(d+2);
-//av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n);
- if(i + (uint64_t)size > avi->fsize || d[0]<0)
- continue;
-
- //parse ix##
- if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams)
- //parse JUNK
- ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
- ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
- avio_skip(pb, size);
-//av_log(s, AV_LOG_DEBUG, "SKIP\n");
- goto resync;
- }
-
- //parse stray LIST
- if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
- avio_skip(pb, 4);
- goto resync;
- }
-
- n= get_stream_idx(d);
-
- if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams)
- continue;
-
- //detect ##ix chunk and skip
- if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
- avio_skip(pb, size);
- goto resync;
- }
-
- //parse ##dc/##wb
- if(n < s->nb_streams){
- AVStream *st;
- AVIStream *ast;
- st = s->streams[n];
- ast = st->priv_data;
-
- if(s->nb_streams>=2){
- AVStream *st1 = s->streams[1];
- AVIStream *ast1= st1->priv_data;
- //workaround for broken small-file-bug402.avi
- if( d[2] == 'w' && d[3] == 'b'
- && n==0
- && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO
- && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO
- && ast->prefix == 'd'*256+'c'
- && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count)
- ){
- n=1;
- st = st1;
- ast = ast1;
- av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n");
- }
- }
-
-
- if( (st->discard >= AVDISCARD_DEFAULT && size==0)
- /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
- || st->discard >= AVDISCARD_ALL){
- ast->frame_offset += get_duration(ast, size);
- avio_skip(pb, size);
- goto resync;
- }
-
- if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
- int k = avio_r8(pb);
- int last = (k + avio_r8(pb) - 1) & 0xFF;
-
- avio_rl16(pb); //flags
-
- for (; k <= last; k++)
- ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
- ast->has_pal= 1;
- goto resync;
- } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
- d[2]*256+d[3] == ast->prefix /*||
- (d[2] == 'd' && d[3] == 'c') ||
- (d[2] == 'w' && d[3] == 'b')*/) {
-
-//av_log(s, AV_LOG_DEBUG, "OK\n");
- if(d[2]*256+d[3] == ast->prefix)
- ast->prefix_count++;
- else{
- ast->prefix= d[2]*256+d[3];
- ast->prefix_count= 0;
- }
-
- avi->stream_index= n;
- ast->packet_size= size + 8;
- ast->remaining= size;
-
- if(size || !ast->sample_size){
- uint64_t pos= avio_tell(pb) - 8;
- if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){
- av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME);
- }
- }
- goto resync;
- }
- }
- }
-
- return AVERROR_EOF;
+ if ((err = avi_sync(s, 0)) < 0)
+ return err;
+ goto resync;
}
/* XXX: We make the implicit supposition that the positions are sorted
@@ -1167,13 +1184,22 @@ static int avi_read_idx1(AVFormatContext *s, int size)
int nb_index_entries, i;
AVStream *st;
AVIStream *ast;
- unsigned int index, tag, flags, pos, len;
+ unsigned int index, tag, flags, pos, len, first_packet = 1;
unsigned last_pos= -1;
+ int64_t idx1_pos, first_packet_pos = 0, data_offset = 0;
nb_index_entries = size / 16;
if (nb_index_entries <= 0)
return -1;
+ idx1_pos = avio_tell(pb);
+ avio_seek(pb, avi->movi_list+4, SEEK_SET);
+ if (avi_sync(s, 1) == 0) {
+ first_packet_pos = avio_tell(pb) - 8;
+ }
+ avi->stream_index = -1;
+ avio_seek(pb, idx1_pos, SEEK_SET);
+
/* Read the entries and sort them in each stream component. */
for(i = 0; i < nb_index_entries; i++) {
tag = avio_rl32(pb);
@@ -1182,9 +1208,6 @@ static int avi_read_idx1(AVFormatContext *s, int size)
len = avio_rl32(pb);
av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
i, tag, flags, pos, len);
- if(i==0 && pos > avi->movi_list)
- avi->movi_list= 0; //FIXME better check
- pos += avi->movi_list;
index = ((tag & 0xff) - '0') * 10;
index += ((tag >> 8) & 0xff) - '0';
@@ -1193,9 +1216,14 @@ static int avi_read_idx1(AVFormatContext *s, int size)
st = s->streams[index];
ast = st->priv_data;
-#if defined(DEBUG_SEEK)
- av_log(s, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
-#endif
+ if(first_packet && first_packet_pos && len) {
+ data_offset = first_packet_pos - pos;
+ first_packet = 0;
+ }
+ pos += data_offset;
+
+ av_dlog(s, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
+
if(url_feof(pb))
return -1;
@@ -1262,20 +1290,16 @@ static int avi_load_index(AVFormatContext *s)
(tag >> 16) & 0xff,
(tag >> 24) & 0xff,
size);
- switch(tag) {
- case MKTAG('i', 'd', 'x', '1'):
- if (avi_read_idx1(s, size) < 0)
- goto skip;
+
+ if (tag == MKTAG('i', 'd', 'x', '1') &&
+ avi_read_idx1(s, size) >= 0) {
ret = 0;
- goto the_end;
- break;
- default:
- skip:
- size += (size & 1);
- if (avio_skip(pb, size) < 0)
- goto the_end; // something is wrong here
break;
}
+
+ size += (size & 1);
+ if (avio_skip(pb, size) < 0)
+ break; // something is wrong here
}
the_end:
avio_seek(pb, pos, SEEK_SET);
diff --git a/libavformat/avio.h b/libavformat/avio.h
index ed78ffa..8210cbd 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -145,7 +145,7 @@ typedef struct URLPollEntry {
attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
/**
- * @defgroup open_modes URL open modes
+ * @name URL open modes
* The flags argument to url_open and cosins must be one of the following
* constants, optionally ORed with other flags.
* @{
@@ -176,7 +176,7 @@ extern URLInterruptCB *url_interrupt_cb;
/**
* @defgroup old_url_funcs Old url_* functions
- * @deprecated use the buffered API based on AVIOContext instead
+ * The following functions are deprecated. Use the buffered API based on #AVIOContext instead.
* @{
*/
attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol *up,
@@ -236,7 +236,7 @@ attribute_deprecated AVIOContext *av_alloc_put_byte(
/**
* @defgroup old_avio_funcs Old put_/get_*() functions
- * @deprecated use the avio_ -prefixed functions instead.
+ * The following functions are deprecated. Use the "avio_"-prefixed functions instead.
* @{
*/
attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
@@ -273,7 +273,7 @@ attribute_deprecated int64_t av_url_read_fseek (AVIOContext *h, int stream_in
/**
* @defgroup old_url_f_funcs Old url_f* functions
- * @deprecated use the avio_ -prefixed functions instead.
+ * The following functions are deprecated, use the "avio_"-prefixed functions instead.
* @{
*/
attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags);
@@ -471,7 +471,7 @@ void avio_flush(AVIOContext *s);
int avio_read(AVIOContext *s, unsigned char *buf, int size);
/**
- * @defgroup avio_read Functions for reading from AVIOContext.
+ * @name Functions for reading from AVIOContext
* @{
*
* @note return 0 if EOF, so you cannot use it if EOF handling is
@@ -515,7 +515,7 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
/**
- * @defgroup open_modes URL open modes
+ * @name URL open modes
* The flags argument to avio_open must be one of the following
* constants, optionally ORed with other flags.
* @{
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 399d627..544097a 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -220,8 +220,6 @@ static int vid_read_packet(AVFormatContext *s,
av_log(s, AV_LOG_ERROR, "unknown block (character = %c, decimal = %d, hex = %x)!!!\n",
block_type, block_type, block_type); return -1;
}
-
- return 0;
}
AVInputFormat ff_bethsoftvid_demuxer = {
diff --git a/libavformat/bink.c b/libavformat/bink.c
index eed52cd..34c1a99 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -134,15 +134,18 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!ast)
return AVERROR(ENOMEM);
ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
+ ast->codec->codec_tag = 0;
ast->codec->sample_rate = avio_rl16(pb);
av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
flags = avio_rl16(pb);
ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
- ast->codec->extradata = av_mallocz(1 + FF_INPUT_BUFFER_PADDING_SIZE);
- ast->codec->extradata_size = 1;
- ast->codec->extradata[0] = vst->codec->codec_tag == MKTAG('B','I','K','b');
+ ast->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
+ if (!ast->codec->extradata)
+ return AVERROR(ENOMEM);
+ ast->codec->extradata_size = 4;
+ AV_WL32(ast->codec->extradata, vst->codec->codec_tag);
}
for (i = 0; i < bink->num_audio_tracks; i++)
diff --git a/libavformat/caf.c b/libavformat/caf.c
index 907562a..d49cc0b 100644
--- a/libavformat/caf.c
+++ b/libavformat/caf.c
@@ -41,6 +41,7 @@ const AVCodecTag ff_codec_caf_tags[] = {
{ CODEC_ID_ADPCM_IMA_QT, MKBETAG('i','m','a','4') },
{ CODEC_ID_AMR_NB, MKBETAG('s','a','m','r') },
{ CODEC_ID_GSM, MKBETAG('a','g','s','m') },
+ { CODEC_ID_GSM_MS, MKBETAG('m','s', 0, '1') },
{ CODEC_ID_MACE3, MKBETAG('M','A','C','3') },
{ CODEC_ID_MACE6, MKBETAG('M','A','C','6') },
{ CODEC_ID_MP3, MKBETAG('.','m','p','3') },
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index b24ff1d..7071031 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -29,6 +29,7 @@
#include "riff.h"
#include "isom.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "libavutil/dict.h"
#include "caf.h"
diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c
index 13636f3..7cb4777 100644
--- a/libavformat/cafenc.c
+++ b/libavformat/cafenc.c
@@ -24,6 +24,7 @@
#include "riff.h"
#include "isom.h"
#include "avio_internal.h"
+#include "libavutil/intfloat_readwrite.h"
typedef struct {
int64_t data;
@@ -71,6 +72,8 @@ static uint32_t samples_per_packet(enum CodecID codec_id) {
case CODEC_ID_GSM:
case CODEC_ID_QCELP:
return 160;
+ case CODEC_ID_GSM_MS:
+ return 320;
case CODEC_ID_MP1:
return 384;
case CODEC_ID_MP2:
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 750c950..4cfe8fb 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -32,6 +32,7 @@
#include "avformat.h"
#include "libavcodec/dvdata.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "dv.h"
struct DVDemuxContext {
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 0b80835..0cbe7a5 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -35,6 +35,7 @@
#include "libavcodec/dvdata.h"
#include "dv.h"
#include "libavutil/fifo.h"
+#include "libavutil/mathematics.h"
struct DVMuxContext {
const DVprofile* sys; /* current DV profile, e.g.: 525/60, 625/50 */
diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c
index e776d0c..d4821da 100644
--- a/libavformat/ffmdec.c
+++ b/libavformat/ffmdec.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "ffm.h"
#if CONFIG_FFSERVER
@@ -300,7 +301,6 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
codec->codec_id = avio_rb32(pb);
codec->codec_type = avio_r8(pb); /* codec_type */
codec->bit_rate = avio_rb32(pb);
- st->quality = avio_rb32(pb);
codec->flags = avio_rb32(pb);
codec->flags2 = avio_rb32(pb);
codec->debug = avio_rb32(pb);
diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c
index 8071045..595ba88 100644
--- a/libavformat/ffmenc.c
+++ b/libavformat/ffmenc.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "ffm.h"
@@ -113,7 +114,6 @@ static int ffm_write_header(AVFormatContext *s)
avio_wb32(pb, codec->codec_id);
avio_w8(pb, codec->codec_type);
avio_wb32(pb, codec->bit_rate);
- avio_wb32(pb, st->quality);
avio_wb32(pb, codec->flags);
avio_wb32(pb, codec->flags2);
avio_wb32(pb, codec->debug);
diff --git a/libavformat/ffmetadec.c b/libavformat/ffmetadec.c
index 0063e6e..4da9dfd 100644
--- a/libavformat/ffmetadec.c
+++ b/libavformat/ffmetadec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "ffmeta.h"
#include "internal.h"
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 4fb562f..7f4b87f 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -26,6 +26,8 @@
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
+#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
#include "libavcodec/mpeg4audio.h"
#include "avformat.h"
diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c
index cea0d02..1a71341 100644
--- a/libavformat/flvenc.c
+++ b/libavformat/flvenc.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "flv.h"
#include "internal.h"
diff --git a/libavformat/gif.c b/libavformat/gif.c
index 0960705..81a1b6f 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -40,6 +40,8 @@
*/
#include "avformat.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
/* The GIF format uses reversed order for bitstreams... */
/* at least they don't use PDP_ENDIAN :) */
@@ -245,8 +247,10 @@ static int gif_image_write_image(AVIOContext *pb,
}
typedef struct {
+ AVClass *class; /** Class for private options. */
int64_t time, file_time;
uint8_t buffer[100]; /* data chunks */
+ int loop;
} GIFContext;
static int gif_write_header(AVFormatContext *s)
@@ -254,7 +258,7 @@ static int gif_write_header(AVFormatContext *s)
GIFContext *gif = s->priv_data;
AVIOContext *pb = s->pb;
AVCodecContext *enc, *video_enc;
- int i, width, height, loop_count /*, rate*/;
+ int i, width, height /*, rate*/;
/* XXX: do we reject audio streams or just ignore them ?
if(s->nb_streams > 1)
@@ -276,7 +280,6 @@ static int gif_write_header(AVFormatContext *s)
} else {
width = video_enc->width;
height = video_enc->height;
- loop_count = s->loop_output;
// rate = video_enc->time_base.den;
}
@@ -285,7 +288,12 @@ static int gif_write_header(AVFormatContext *s)
return AVERROR(EIO);
}
- gif_image_write_header(pb, width, height, loop_count, NULL);
+#if FF_API_LOOP_OUTPUT
+ if (s->loop_output)
+ gif->loop = s->loop_output;
+#endif
+
+ gif_image_write_header(pb, width, height, gif->loop, NULL);
avio_flush(s->pb);
return 0;
@@ -340,6 +348,20 @@ static int gif_write_trailer(AVFormatContext *s)
return 0;
}
+#define OFFSET(x) offsetof(GIFContext, x)
+#define ENC AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "loop", "Number of times to loop the output.", OFFSET(loop), FF_OPT_TYPE_INT, {0}, 0, 65535, ENC },
+ { NULL },
+};
+
+static const AVClass gif_muxer_class = {
+ .class_name = "GIF muxer",
+ .item_name = av_default_item_name,
+ .version = LIBAVUTIL_VERSION_INT,
+ .option = options,
+};
+
AVOutputFormat ff_gif_muxer = {
"gif",
NULL_IF_CONFIG_SMALL("GIF Animation"),
@@ -351,4 +373,5 @@ AVOutputFormat ff_gif_muxer = {
gif_write_header,
gif_write_packet,
gif_write_trailer,
+ .priv_class = &gif_muxer_class,
};
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 7002a1d..1d83cc3 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -264,7 +264,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
int map_len;
int len;
AVRational main_timebase = {0, 0};
- struct gxf_stream_info si;
+ struct gxf_stream_info *si = s->priv_data;
int i;
if (!parse_packet_header(pb, &pkt_type, &map_len) || pkt_type != PKT_MAP) {
av_log(s, AV_LOG_ERROR, "map packet not found\n");
@@ -282,7 +282,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
return 0;
}
map_len -= len;
- gxf_material_tags(pb, &len, &si);
+ gxf_material_tags(pb, &len, si);
avio_skip(pb, len);
map_len -= 2;
len = avio_rb16(pb); // length of track description
@@ -300,7 +300,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
track_id = avio_r8(pb);
track_len = avio_rb16(pb);
len -= track_len;
- gxf_track_tags(pb, &track_len, &si);
+ gxf_track_tags(pb, &track_len, si);
avio_skip(pb, track_len);
if (!(track_type & 0x80)) {
av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
@@ -316,12 +316,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
if (idx < 0) continue;
st = s->streams[idx];
if (!main_timebase.num || !main_timebase.den) {
- main_timebase.num = si.frames_per_second.den;
- main_timebase.den = si.frames_per_second.num * 2;
+ main_timebase.num = si->frames_per_second.den;
+ main_timebase.den = si->frames_per_second.num * 2;
}
- st->start_time = si.first_field;
- if (si.first_field != AV_NOPTS_VALUE && si.last_field != AV_NOPTS_VALUE)
- st->duration = si.last_field - si.first_field;
+ st->start_time = si->first_field;
+ if (si->first_field != AV_NOPTS_VALUE && si->last_field != AV_NOPTS_VALUE)
+ st->duration = si->last_field - si->first_field;
}
if (len < 0)
av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
@@ -422,7 +422,9 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb;
GXFPktType pkt_type;
int pkt_len;
- while (!url_feof(pb)) {
+ struct gxf_stream_info *si = s->priv_data;
+
+ while (!pb->eof_reached) {
AVStream *st;
int track_type, track_id, ret;
int field_nr, field_info, skip = 0;
@@ -473,6 +475,11 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
avio_skip(pb, skip);
pkt->stream_index = stream_index;
pkt->dts = field_nr;
+
+ //set duration manually for DV or else lavf misdetects the frame rate
+ if (st->codec->codec_id == CODEC_ID_DVVIDEO)
+ pkt->duration = si->fields_per_frame;
+
return ret;
}
return AVERROR(EIO);
@@ -518,7 +525,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index,
AVInputFormat ff_gxf_demuxer = {
"gxf",
NULL_IF_CONFIG_SMALL("GXF format"),
- 0,
+ sizeof(struct gxf_stream_info),
gxf_probe,
gxf_header,
gxf_packet,
diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c
index 3f7d785..da25ddc 100644
--- a/libavformat/gxfenc.c
+++ b/libavformat/gxfenc.c
@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "gxf.h"
#include "riff.h"
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index cbf3b3e..3d138d9 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -209,7 +209,6 @@ static int roq_read_packet(AVFormatContext *s,
default:
av_log(s, AV_LOG_ERROR, " unknown RoQ chunk (%04X)\n", chunk_type);
return AVERROR_INVALIDDATA;
- break;
}
}
diff --git a/libavformat/img2.c b/libavformat/img2.c
index b6082c6..0531a1a 100644
--- a/libavformat/img2.c
+++ b/libavformat/img2.c
@@ -43,6 +43,7 @@ typedef struct {
char *pixel_format; /**< Set by a private option. */
char *video_size; /**< Set by a private option. */
char *framerate; /**< Set by a private option. */
+ int loop;
} VideoData;
typedef struct {
@@ -54,6 +55,7 @@ static const IdStrMap img_tags[] = {
{ CODEC_ID_MJPEG , "jpeg"},
{ CODEC_ID_MJPEG , "jpg"},
{ CODEC_ID_LJPEG , "ljpg"},
+ { CODEC_ID_JPEGLS , "jls"},
{ CODEC_ID_PNG , "png"},
{ CODEC_ID_PNG , "mng"},
{ CODEC_ID_PPM , "ppm"},
@@ -246,6 +248,11 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
framerate = (AVRational){ap->time_base.den, ap->time_base.num};
#endif
+#if FF_API_LOOP_INPUT
+ if (s1->loop_input)
+ s->loop = s1->loop_input;
+#endif
+
av_strlcpy(s->path, s1->filename, sizeof(s->path));
s->img_number = 0;
s->img_count = 0;
@@ -305,7 +312,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
if (!s->is_pipe) {
/* loop over input */
- if (s1->loop_input && s->img_number > s->img_last) {
+ if (s->loop && s->img_number > s->img_last) {
s->img_number = s->img_first;
}
if (s->img_number > s->img_last)
@@ -466,6 +473,7 @@ static const AVOption options[] = {
{ "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "video_size", "", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
+ { "loop", "", OFFSET(loop), FF_OPT_TYPE_INT, {.dbl = 0}, 0, 1, DEC },
{ NULL },
};
@@ -505,7 +513,7 @@ AVInputFormat ff_image2pipe_demuxer = {
AVOutputFormat ff_image2_muxer = {
.name = "image2",
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),
- .extensions = "bmp,dpx,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
+ .extensions = "bmp,dpx,jls,jpeg,jpg,ljpg,pam,pbm,pcx,pgm,pgmyuv,png,"
"ppm,sgi,tga,tif,tiff,jp2",
.priv_data_size = sizeof(VideoData),
.video_codec = CODEC_ID_MJPEG,
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 5636f78..7c8eaf2 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -155,14 +155,14 @@ void ff_put_v(AVIOContext *bc, uint64_t val);
/**
* Read a whole line of text from AVIOContext. Stop reading after reaching
- * either a \n, a \0 or EOF. The returned string is always \0 terminated,
+ * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated,
* and may be truncated if the buffer is too small.
*
* @param s the read-only AVIOContext
* @param buf buffer to store the read line
* @param maxlen size of the buffer
* @return the length of the string written in the buffer, not including the
- * final \0
+ * final \\0
*/
int ff_get_line(AVIOContext *s, char *buf, int maxlen);
diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c
index acc4503..01b6c3d 100644
--- a/libavformat/librtmp.c
+++ b/libavformat/librtmp.c
@@ -24,6 +24,7 @@
* RTMP protocol based on http://rtmpdump.mplayerhq.hu/ librtmp
*/
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "url.h"
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 61fcec2..f3d7a2d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1960,6 +1960,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET);
+ matroska->current_id = 0;
while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) {
matroska_clear_queue(matroska);
if (matroska_parse_cluster(matroska) < 0)
@@ -1988,6 +1989,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
}
avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET);
+ matroska->current_id = 0;
matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY);
matroska->skip_to_timecode = st->index_entries[index].timestamp;
matroska->done = 0;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e9c977a..4bfd197 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -28,6 +28,8 @@
#include "avlanguage.h"
#include "libavutil/samplefmt.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
@@ -937,7 +939,7 @@ static int mkv_write_ass_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p
size -= start - data;
sscanf(data, "Dialogue: %d,", &layer);
i = snprintf(buffer, sizeof(buffer), "%"PRId64",%d,",
- s->streams[pkt->stream_index]->nb_frames++, layer);
+ s->streams[pkt->stream_index]->nb_frames, layer);
size = FFMIN(i+size, sizeof(buffer));
memcpy(buffer+i, start, size-i);
diff --git a/libavformat/mm.c b/libavformat/mm.c
index c6264f1..d097139 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -184,8 +184,6 @@ static int read_packet(AVFormatContext *s,
avio_skip(pb, length);
}
}
-
- return 0;
}
AVInputFormat ff_mm_demuxer = {
diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c
index a66e1d9..029baed 100644
--- a/libavformat/mmsh.c
+++ b/libavformat/mmsh.c
@@ -208,7 +208,6 @@ static int get_http_header_data(MMSHContext *mmsh)
}
}
}
- return 0;
}
static int mmsh_open(URLContext *h, const char *uri, int flags)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 773760c..651c685 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -26,6 +26,8 @@
//#define MOV_EXPORT_ALL_METADATA
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/avstring.h"
#include "libavutil/dict.h"
#include "avformat.h"
@@ -2327,7 +2329,6 @@ static int mov_probe(AVProbeData *p)
return score;
}
}
- return score;
}
// must be done after parsing all trak because there's no order requirement
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ebfcacb..21a82b5 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -32,6 +32,8 @@
#include "libavcodec/put_bits.h"
#include "internal.h"
#include "libavutil/avstring.h"
+#include "libavutil/intfloat_readwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"
#include "rtpenc.h"
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 64f6ea8..c2cb54c 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -22,6 +22,7 @@
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "id3v2.h"
#include "id3v1.h"
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 50342bb..46b65a5 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -21,10 +21,14 @@
#include <strings.h>
#include "avformat.h"
+#include "avio_internal.h"
#include "id3v1.h"
#include "id3v2.h"
#include "rawenc.h"
#include "libavutil/avstring.h"
+#include "libavcodec/mpegaudio.h"
+#include "libavcodec/mpegaudiodata.h"
+#include "libavcodec/mpegaudiodecheader.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavcodec/mpegaudio.h"
@@ -132,15 +136,39 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
return len + ID3v2_HEADER_SIZE;
}
+#define VBR_NUM_BAGS 400
+#define VBR_TOC_SIZE 100
+typedef struct MP3Context {
+ const AVClass *class;
+ int id3v2_version;
+ int64_t frames_offset;
+ int32_t frames;
+ int32_t size;
+ uint32_t want;
+ uint32_t seen;
+ uint32_t pos;
+ uint64_t bag[VBR_NUM_BAGS];
+} MP3Context;
+
static int mp2_write_trailer(struct AVFormatContext *s)
{
uint8_t buf[ID3v1_TAG_SIZE];
+ MP3Context *mp3 = s->priv_data;
/* write the id3v1 tag */
if (id3v1_create_tag(s, buf) > 0) {
avio_write(s->pb, buf, ID3v1_TAG_SIZE);
- avio_flush(s->pb);
}
+
+ /* write number of frames */
+ if (mp3 && mp3->frames_offset) {
+ avio_seek(s->pb, mp3->frames_offset, SEEK_SET);
+ avio_wb32(s->pb, s->streams[0]->nb_frames);
+ avio_seek(s->pb, 0, SEEK_END);
+ }
+
+ avio_flush(s->pb);
+
return 0;
}
@@ -160,19 +188,6 @@ AVOutputFormat ff_mp2_muxer = {
#endif
#if CONFIG_MP3_MUXER
-#define VBR_NUM_BAGS 400
-#define VBR_TOC_SIZE 100
-typedef struct MP3Context {
- const AVClass *class;
- int id3v2_version;
- int64_t frames_offset;
- int32_t frames;
- int32_t size;
- uint32_t want;
- uint32_t seen;
- uint32_t pos;
- uint64_t bag[VBR_NUM_BAGS];
-} MP3Context;
static const AVOption options[] = {
{ "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.",
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 9c808d0..1872114 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/fifo.h"
+#include "libavutil/mathematics.h"
#include "libavcodec/put_bits.h"
#include "avformat.h"
#include "mpeg.h"
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index ad3cd82..be55822 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -25,6 +25,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 7e96472..a7e13e8 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -22,6 +22,7 @@
#include "libavutil/bswap.h"
#include "libavutil/crc.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavcodec/mpegvideo.h"
#include "avformat.h"
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8548c79..d7555f6 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -46,6 +46,7 @@
//#define DEBUG
#include "libavutil/aes.h"
+#include "libavutil/mathematics.h"
#include "libavcodec/bytestream.h"
#include "avformat.h"
#include "mxf.h"
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index c6532a3..d44e767 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -1539,7 +1539,7 @@ static const uint8_t system_metadata_package_set_key[] = { 0x06,0x0E,0x2B,0x34,0
static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps)
{
return (0 << 31) | // color frame flag
- (0 << 30) | // drop frame flag
+ (drop << 30) | // drop frame flag
( ((frame % fps) / 10) << 28) | // tens of frames
( ((frame % fps) % 10) << 24) | // units of frames
(0 << 23) | // field phase (NTSC), b0 (PAL)
@@ -1549,7 +1549,7 @@ static uint32_t ff_framenum_to_12m_time_code(unsigned frame, int drop, int fps)
((((frame / (fps * 60)) % 60) / 10) << 12) | // tens of minutes
((((frame / (fps * 60)) % 60) % 10) << 8) | // units of minutes
(0 << 7) | // b1
- (0 << 6) | // b2 (NSC), field phase (PAL)
+ (0 << 6) | // b2 (NTSC), field phase (PAL)
((((frame / (fps * 3600) % 24)) / 10) << 4) | // tens of hours
( (frame / (fps * 3600) % 24)) % 10; // units of hours
}
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 4898187..829393f 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -18,6 +18,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "riff.h"
#include "libavutil/dict.h"
diff --git a/libavformat/nut.c b/libavformat/nut.c
index c31f53a..2a5e6fe 100644
--- a/libavformat/nut.c
+++ b/libavformat/nut.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "libavutil/tree.h"
#include "nut.h"
#include "internal.h"
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 7aecf73..9939b29 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -24,6 +24,7 @@
#include "libavutil/avstring.h"
#include "libavutil/bswap.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "libavutil/tree.h"
#include "avio_internal.h"
#include "nut.h"
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 6ec9bcd..9fa8b9e 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/tree.h"
#include "libavutil/dict.h"
#include "libavcodec/mpegaudiodata.h"
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index a75f1d6..86a3322 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "riff.h"
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index 9722d62..597ea3b 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -201,7 +201,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
uint8_t sync[4];
int sp = 0;
- ret = avio_read (bc, sync, 4);
+ ret = avio_read(bc, sync, 4);
if (ret < 4)
return ret < 0 ? ret : AVERROR_EOF;
@@ -259,7 +259,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
if(os->psize > 0)
ogg_new_buf(ogg, idx);
- ret = avio_read (bc, os->segments, nsegs);
+ ret = avio_read(bc, os->segments, nsegs);
if (ret < nsegs)
return ret < 0 ? ret : AVERROR_EOF;
@@ -292,7 +292,7 @@ static int ogg_read_page(AVFormatContext *s, int *str)
os->buf = nb;
}
- ret = avio_read (bc, os->buf + os->bufpos, size);
+ ret = avio_read(bc, os->buf + os->bufpos, size);
if (ret < size)
return ret < 0 ? ret : AVERROR_EOF;
@@ -321,7 +321,7 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
idx = ogg->curidx;
while (idx < 0){
- ret = ogg_read_page (s, &idx);
+ ret = ogg_read_page(s, &idx);
if (ret < 0)
return ret;
}
@@ -437,7 +437,7 @@ static int ogg_get_headers(AVFormatContext *s)
int ret;
do{
- ret = ogg_packet (s, NULL, NULL, NULL, NULL);
+ ret = ogg_packet(s, NULL, NULL, NULL, NULL);
if (ret < 0)
return ret;
}while (!ogg->headers);
@@ -501,10 +501,9 @@ static int ogg_read_header(AVFormatContext *s, AVFormatParameters *ap)
int ret, i;
ogg->curidx = -1;
//linear headers seek from start
- ret = ogg_get_headers (s);
- if (ret < 0){
+ ret = ogg_get_headers(s);
+ if (ret < 0)
return ret;
- }
for (i = 0; i < ogg->nstreams; i++)
if (ogg->streams[i].header < 0)
@@ -558,7 +557,7 @@ static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
//Get an ogg packet
retry:
do{
- ret = ogg_packet (s, &idx, &pstart, &psize, &fpos);
+ ret = ogg_packet(s, &idx, &pstart, &psize, &fpos);
if (ret < 0)
return ret;
}while (idx < 0 || !s->streams[idx]);
@@ -574,7 +573,7 @@ retry:
os->keyframe_seek = 0;
//Alloc a pkt
- ret = av_new_packet (pkt, psize);
+ ret = av_new_packet(pkt, psize);
if (ret < 0)
return ret;
pkt->stream_index = idx;
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 5d1f320..f93eb72 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -21,6 +21,7 @@
#include "libavutil/crc.h"
#include "libavutil/opt.h"
+#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavcodec/xiph.h"
#include "libavcodec/bytestream.h"
diff --git a/libavformat/oma.c b/libavformat/oma.c
index aac96d1..633f099 100644
--- a/libavformat/oma.c
+++ b/libavformat/oma.c
@@ -149,7 +149,6 @@ static int oma_read_header(AVFormatContext *s,
default:
av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n",buf[32]);
return -1;
- break;
}
st->codec->block_align = framesize;
diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index def183c..d66be59 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "pcm.h"
diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index 744ae94..34ba3c8 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -234,7 +234,6 @@ static int str_read_packet(AVFormatContext *s,
pkt->stream_index =
str->channels[channel].audio_stream_index;
return 0;
- break;
default:
av_log(s, AV_LOG_WARNING, "Unknown sector type %02X\n", sector[0x12]);
/* drop the sector and move on */
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index af74a9e..83d823d 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -23,6 +23,7 @@
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
#include "avformat.h"
typedef struct {
diff --git a/libavformat/riff.c b/libavformat/riff.c
index acac938..2e00ae8 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "libavcodec/avcodec.h"
#include "avformat.h"
#include "avio_internal.h"
@@ -172,6 +173,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') },
{ CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') },
{ CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '6') },
+ { CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '2', '4') },
{ CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') },
{ CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') },
{ CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') },
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index e414067..3a4f552 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -34,6 +34,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "avformat.h"
#define EXTRADATA1_SIZE (6 + 256 * 3) ///< video base, clr, palette
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 4b6d549..7e2ccdc 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -21,6 +21,7 @@
#include "libavcodec/bytestream.h"
#include "libavutil/avstring.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
#include "rtmppkt.h"
diff --git a/libavformat/rtmppkt.h b/libavformat/rtmppkt.h
index 4c28cd3..8acbfc1 100644
--- a/libavformat/rtmppkt.h
+++ b/libavformat/rtmppkt.h
@@ -138,7 +138,7 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *p,
void ff_rtmp_packet_dump(void *ctx, RTMPPacket *p);
/**
- * @defgroup amffuncs functions used to work with AMF format (which is also used in .flv)
+ * @name Functions used to work with the AMF format (which is also used in .flv)
* @see amf_* funcs in libavformat/flvdec.c
* @{
*/
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index b8714c9..e3fce2e 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -26,6 +26,7 @@
#include "libavcodec/bytestream.h"
#include "libavutil/avstring.h"
+#include "libavutil/intfloat_readwrite.h"
#include "libavutil/lfg.h"
#include "libavutil/sha.h"
#include "avformat.h"
@@ -761,7 +762,6 @@ static int get_packet(URLContext *s, int for_header)
}
ff_rtmp_packet_destroy(&rpkt);
}
- return 0;
}
static int rtmp_close(URLContext *h)
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 9fc30d7..995f3bf 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/mathematics.h"
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index 60629b0..2c56eb2 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -22,6 +22,7 @@
#include "avformat.h"
#include "mpegts.h"
#include "internal.h"
+#include "libavutil/mathematics.h"
#include "libavutil/random_seed.h"
#include "libavutil/opt.h"
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index e8a0cd8..7dd18fa 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -22,6 +22,7 @@
#include "libavutil/base64.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/dict.h"
@@ -428,11 +429,6 @@ static void sdp_parse_line(AVFormatContext *s, SDPParseState *s1,
}
}
-/**
- * Parse the sdp description and allocate the rtp streams and the
- * pollfd array used for udp ones.
- */
-
int ff_sdp_parse(AVFormatContext *s, const char *content)
{
RTSPState *rt = s->priv_data;
@@ -1050,9 +1046,6 @@ retry:
return 0;
}
-/**
- * @return 0 on success, <0 on error, 1 if protocol is unavailable.
- */
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
int lower_transport, const char *real_challenge)
{
@@ -1078,7 +1071,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
for (j = RTSP_RTP_PORT_MIN, i = 0; i < rt->nb_rtsp_streams; ++i) {
char transport[2048];
- /**
+ /*
* WMS serves all UDP data over a single connection, the RTX, which
* isn't necessarily the first in the SDP but has to be the first
* to be set up, else the second/third SETUP will fail with a 461.
@@ -1151,7 +1144,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
/* RTP/TCP */
else if (lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
- /** For WMS streams, the application streams are only used for
+ /* For WMS streams, the application streams are only used for
* UDP. When trying to set it up for TCP streams, the server
* will return an error. Therefore, we skip those streams. */
if (rt->server_type == RTSP_SERVER_WMS &&
@@ -1482,14 +1475,14 @@ redirect:
cmd[0] = 0;
if (rt->server_type == RTSP_SERVER_REAL)
av_strlcat(cmd,
- /**
+ /*
* The following entries are required for proper
* streaming from a Realmedia server. They are
* interdependent in some way although we currently
* don't quite understand how. Values were copied
* from mplayer SVN r23589.
- * @param CompanyID is a 16-byte ID in base64
- * @param ClientChallenge is a 16-byte ID in hex
+ * ClientChallenge is a 16-byte ID in hex
+ * CompanyID is a 16-byte ID in base64
*/
"ClientChallenge: 9e26d33f2984236010ef6253fb1887f7\r\n"
"PlayerStarttime: [28/03/2003:22:50:23 00:00]\r\n"
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index 6b06092..f5cf823 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -505,8 +505,9 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply);
int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr);
/**
- * Parse a SDP description of streams by populating an RTSPState struct
- * within the AVFormatContext.
+ * Parse an SDP description of streams by populating an RTSPState struct
+ * within the AVFormatContext; also allocate the RTP streams and the
+ * pollfd array used for UDP streams.
*/
int ff_sdp_parse(AVFormatContext *s, const char *content);
@@ -525,6 +526,7 @@ int ff_rtsp_fetch_packet(AVFormatContext *s, AVPacket *pkt);
/**
* Do the SETUP requests for each stream for the chosen
* lower transport mode.
+ * @return 0 on success, <0 on error, 1 if protocol is unavailable
*/
int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
int lower_transport, const char *real_challenge);
diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index cf95915..b931e49 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -21,6 +21,7 @@
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
+#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "avformat.h"
diff --git a/libavformat/seek.c b/libavformat/seek.c
index dd6109b..65211bf 100644
--- a/libavformat/seek.c
+++ b/libavformat/seek.c
@@ -21,6 +21,7 @@
*/
#include "seek.h"
+#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "internal.h"
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index ae194d4..2251a89 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -111,7 +111,9 @@ static int film_read_header(AVFormatContext *s,
film->audio_samplerate = AV_RB16(&scratch[24]);
film->audio_channels = scratch[21];
film->audio_bits = scratch[22];
- if (film->audio_bits == 8)
+ if (scratch[23] == 2)
+ film->audio_type = CODEC_ID_ADPCM_ADX;
+ else if (film->audio_bits == 8)
film->audio_type = CODEC_ID_PCM_S8;
else if (film->audio_bits == 16)
film->audio_type = CODEC_ID_PCM_S16BE;
@@ -149,12 +151,19 @@ static int film_read_header(AVFormatContext *s,
st->codec->codec_id = film->audio_type;
st->codec->codec_tag = 1;
st->codec->channels = film->audio_channels;
- st->codec->bits_per_coded_sample = film->audio_bits;
st->codec->sample_rate = film->audio_samplerate;
+
+ if (film->audio_type == CODEC_ID_ADPCM_ADX) {
+ st->codec->bits_per_coded_sample = 18 * 8 / 32;
+ st->codec->block_align = st->codec->channels * 18;
+ } else {
+ st->codec->bits_per_coded_sample = film->audio_bits;
+ st->codec->block_align = st->codec->channels *
+ st->codec->bits_per_coded_sample / 8;
+ }
+
st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
st->codec->bits_per_coded_sample;
- st->codec->block_align = st->codec->channels *
- st->codec->bits_per_coded_sample / 8;
}
/* load the sample table */
@@ -187,8 +196,12 @@ static int film_read_header(AVFormatContext *s,
film->sample_table[i].pts *= film->base_clock;
film->sample_table[i].pts /= film->audio_samplerate;
- audio_frame_counter += (film->sample_table[i].sample_size /
- (film->audio_channels * film->audio_bits / 8));
+ if (film->audio_type == CODEC_ID_ADPCM_ADX)
+ audio_frame_counter += (film->sample_table[i].sample_size * 32 /
+ (18 * film->audio_channels));
+ else
+ audio_frame_counter += (film->sample_table[i].sample_size /
+ (film->audio_channels * film->audio_bits / 8));
} else {
film->sample_table[i].stream = film->video_stream_index;
film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
@@ -227,7 +240,8 @@ static int film_read_packet(AVFormatContext *s,
return AVERROR(ENOMEM);
avio_read(pb, pkt->data, sample->sample_size);
} else if ((sample->stream == film->audio_stream_index) &&
- (film->audio_channels == 2)) {
+ (film->audio_channels == 2) &&
+ (film->audio_type != CODEC_ID_ADPCM_ADX)) {
/* stereo PCM needs to be interleaved */
if (av_new_packet(pkt, sample->sample_size))
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index 16d26ab..2315b04 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -30,6 +30,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "pcm.h"
diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c
index a07a206..309db75 100644
--- a/libavformat/soxenc.c
+++ b/libavformat/soxenc.c
@@ -30,6 +30,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
#include "avio_internal.h"
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index f90564f..5aab001 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -204,7 +204,6 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
skip:
avio_skip(pb, len);
}
- return 0;
}
AVInputFormat ff_swf_demuxer = {
diff --git a/libavformat/thp.c b/libavformat/thp.c
index 2d1f74e..c40be1f 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -20,6 +20,7 @@
*/
#include "libavutil/intreadwrite.h"
+#include "libavutil/intfloat_readwrite.h"
#include "avformat.h"
typedef struct ThpDemuxContext {
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 21b4455..cbf3b43 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -404,7 +404,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
p = strchr(uri, '?');
if (p) {
if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) {
- char *endptr=NULL;
+ char *endptr = NULL;
s->reuse_socket = strtol(buf, &endptr, 10);
/* assume if no digits were found it is a request to enable it */
if (buf == endptr)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 4d8b922..58b1f56 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -32,6 +32,7 @@
#include "metadata.h"
#include "id3v2.h"
#include "libavutil/avstring.h"
+#include "libavutil/mathematics.h"
#include "riff.h"
#include "audiointerleave.h"
#include "url.h"
@@ -457,17 +458,23 @@ int av_open_input_stream(AVFormatContext **ic_ptr,
opts = convert_format_parameters(ap);
if(!ap->prealloced_context)
- ic = avformat_alloc_context();
+ *ic_ptr = ic = avformat_alloc_context();
else
ic = *ic_ptr;
if (!ic) {
err = AVERROR(ENOMEM);
goto fail;
}
- ic->pb = pb;
+ if (pb && fmt && fmt->flags & AVFMT_NOFILE)
+ av_log(ic, AV_LOG_WARNING, "Custom AVIOContext makes no sense and "
+ "will be ignored with AVFMT_NOFILE format.\n");
+ else
+ ic->pb = pb;
- err = avformat_open_input(ic_ptr, filename, fmt, &opts);
+ err = avformat_open_input(&ic, filename, fmt, &opts);
+ ic->pb = ic->pb ? ic->pb : pb; // don't leak custom pb if it wasn't set above
+ *ic_ptr = ic;
fail:
av_dict_free(&opts);
return err;
@@ -2246,11 +2253,7 @@ int av_find_stream_info(AVFormatContext *ic)
for(i=0;i<ic->nb_streams;i++) {
AVCodec *codec;
st = ic->streams[i];
- if (st->codec->codec_id == CODEC_ID_AAC) {
- st->codec->sample_rate = 0;
- st->codec->frame_size = 0;
- st->codec->channels = 0;
- }
+
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO ||
st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
/* if(!st->time_base.num)
@@ -2268,13 +2271,6 @@ int av_find_stream_info(AVFormatContext *ic)
assert(!st->codec->codec);
codec = avcodec_find_decoder(st->codec->codec_id);
- /* Force decoding of at least one frame of codec data
- * this makes sure the codec initializes the channel configuration
- * and does not trust the values from the container.
- */
- if (codec && codec->capabilities & CODEC_CAP_CHANNEL_CONF)
- st->codec->channels = 0;
-
/* Ensure that subtitle_header is properly set. */
if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE
&& codec && !st->codec->codec)
@@ -2417,8 +2413,16 @@ int av_find_stream_info(AVFormatContext *ic)
/* if still no information, we try to open the codec and to
decompress the frame. We try to avoid that in most cases as
it takes longer and uses more memory. For MPEG-4, we need to
- decompress for QuickTime. */
- if (!has_codec_parameters(st->codec) || !has_decode_delay_been_guessed(st))
+ decompress for QuickTime.
+
+ If CODEC_CAP_CHANNEL_CONF is set this will force decoding of at
+ least one frame of codec data, this makes sure the codec initializes
+ the channel configuration and does not only trust the values from the container.
+ */
+ if (!has_codec_parameters(st->codec) ||
+ !has_decode_delay_been_guessed(st) ||
+ (st->codec->codec &&
+ st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))
try_decode_frame(st, pkt);
st->codec_info_nb_frames++;
@@ -3118,8 +3122,9 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt)
return ret;
ret= s->oformat->write_packet(s, pkt);
- if(!ret)
- ret= url_ferror(s->pb);
+
+ if (ret >= 0)
+ s->streams[pkt->stream_index]->nb_frames++;
return ret;
}
@@ -3240,6 +3245,8 @@ int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt){
return ret;
ret= s->oformat->write_packet(s, &opkt);
+ if (ret >= 0)
+ s->streams[opkt.stream_index]->nb_frames++;
av_free_packet(&opkt);
pkt= NULL;
@@ -3264,6 +3271,8 @@ int av_write_trailer(AVFormatContext *s)
break;
ret= s->oformat->write_packet(s, &pkt);
+ if (ret >= 0)
+ s->streams[pkt.stream_index]->nb_frames++;
av_free_packet(&pkt);
@@ -3288,6 +3297,15 @@ fail:
return ret;
}
+int av_get_output_timestamp(struct AVFormatContext *s, int stream,
+ int64_t *dts, int64_t *wall)
+{
+ if (!s->oformat || !s->oformat->get_output_timestamp)
+ return AVERROR(ENOSYS);
+ s->oformat->get_output_timestamp(s, stream, dts, wall);
+ return 0;
+}
+
void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
{
int i, j;
diff --git a/libavformat/version.h b/libavformat/version.h
index 691f9c0..96cc6d4 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 53
-#define LIBAVFORMAT_VERSION_MINOR 4
+#define LIBAVFORMAT_VERSION_MINOR 5
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
@@ -77,5 +77,14 @@
#ifndef FF_API_FLAG_RTP_HINT
#define FF_API_FLAG_RTP_HINT (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_AVSTREAM_QUALITY
+#define FF_API_AVSTREAM_QUALITY (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_LOOP_INPUT
+#define FF_API_LOOP_INPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
+#ifndef FF_API_LOOP_OUTPUT
+#define FF_API_LOOP_OUTPUT (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif /* AVFORMAT_VERSION_H */
diff --git a/libavformat/vqf.c b/libavformat/vqf.c
index e06f393..7031d03 100644
--- a/libavformat/vqf.c
+++ b/libavformat/vqf.c
@@ -22,6 +22,7 @@
#include "avformat.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
+#include "libavutil/mathematics.h"
typedef struct VqfContext {
int frame_bit_len;
diff --git a/libavformat/wav.c b/libavformat/wav.c
index c5dbd63..f09e676 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -22,6 +22,8 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+
+#include "libavutil/mathematics.h"
#include "avformat.h"
#include "avio_internal.h"
#include "pcm.h"
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index eb2eae1..08bcffa 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -152,7 +152,6 @@ static int wc3_read_header(AVFormatContext *s,
(uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24),
(uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24));
return AVERROR_INVALIDDATA;
- break;
}
fourcc_tag = avio_rl32(pb);
diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c
index 5fe7e9f..816fb90 100644
--- a/libavformat/wtvdec.c
+++ b/libavformat/wtvdec.c
@@ -716,7 +716,7 @@ enum {
* Parse WTV chunks
* @param mode SEEK_TO_DATA or SEEK_TO_PTS
* @param seekts timestamp
- * @param[out] len Length of data chunk
+ * @param[out] len_ptr Length of data chunk
* @return stream index of data chunk, or <0 on error
*/
static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr)
diff --git a/libavutil/Makefile b/libavutil/Makefile
index ad2a3ee..5ff5cb8 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -77,7 +77,8 @@ OBJS-$(ARCH_ARM) += arm/cpu.o
OBJS-$(ARCH_PPC) += ppc/cpu.o
OBJS-$(ARCH_X86) += x86/cpu.o
-TESTPROGS = adler32 aes base64 cpu crc des eval lls md5 pca sha tree
+TESTPROGS = adler32 aes avstring base64 cpu crc des eval file lfg lls \
+ md5 opt pca parseutils rational sha tree
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
DIRS = arm bfin sh4 x86
diff --git a/libavutil/adler32.c b/libavutil/adler32.c
index 4f20010..9d3d896 100644
--- a/libavutil/adler32.c
+++ b/libavutil/adler32.c
@@ -26,24 +26,28 @@
#define BASE 65521L /* largest prime smaller than 65536 */
-#define DO1(buf) {s1 += *buf++; s2 += s1;}
+#define DO1(buf) { s1 += *buf++; s2 += s1; }
#define DO4(buf) DO1(buf); DO1(buf); DO1(buf); DO1(buf);
#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
-unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len)
+unsigned long av_adler32_update(unsigned long adler, const uint8_t * buf,
+ unsigned int len)
{
unsigned long s1 = adler & 0xffff;
unsigned long s2 = adler >> 16;
- while (len>0) {
+ while (len > 0) {
#if CONFIG_SMALL
- while(len>4 && s2 < (1U<<31)){
- DO4(buf); len-=4;
+ while (len > 4 && s2 < (1U << 31)) {
+ DO4(buf);
+ len -= 4;
+ }
#else
- while(len>16 && s2 < (1U<<31)){
- DO16(buf); len-=16;
-#endif
+ while (len > 16 && s2 < (1U << 31)) {
+ DO16(buf);
+ len -= 16;
}
+#endif
DO1(buf); len--;
s1 %= BASE;
s2 %= BASE;
@@ -52,22 +56,32 @@ unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigne
}
#ifdef TEST
+#include <string.h>
#include "log.h"
#include "timer.h"
#define LEN 7001
volatile int checksum;
-int main(void){
+int main(int argc, char **argv)
+{
int i;
char data[LEN];
+
av_log_set_level(AV_LOG_DEBUG);
- for(i=0; i<LEN; i++)
- data[i]= ((i*i)>>3) + 123*i;
- for(i=0; i<1000; i++){
- START_TIMER
- checksum= av_adler32_update(1, data, LEN);
- STOP_TIMER("adler")
+
+ for (i = 0; i < LEN; i++)
+ data[i] = ((i * i) >> 3) + 123 * i;
+
+ if (argc > 1 && !strcmp(argv[1], "-t")) {
+ for (i = 0; i < 1000; i++) {
+ START_TIMER;
+ checksum = av_adler32_update(1, data, LEN);
+ STOP_TIMER("adler");
+ }
+ } else {
+ checksum = av_adler32_update(1, data, LEN);
}
- av_log(NULL, AV_LOG_DEBUG, "%X == 50E6E508\n", checksum);
- return 0;
+
+ av_log(NULL, AV_LOG_DEBUG, "%X (expected 50E6E508)\n", checksum);
+ return checksum == 0x50e6e508 ? 0 : 1;
}
#endif
diff --git a/libavutil/aes.c b/libavutil/aes.c
index 59f1cf3..49093ef 100644
--- a/libavutil/aes.c
+++ b/libavutil/aes.c
@@ -22,6 +22,7 @@
#include "common.h"
#include "aes.h"
+#include "intreadwrite.h"
typedef union {
uint64_t u64[2];
@@ -30,13 +31,13 @@ typedef union {
uint8_t u8[16];
} av_aes_block;
-typedef struct AVAES{
+typedef struct AVAES {
// Note: round_key[16] is accessed in the init code, but this only
// overwrites state, which does not matter (see also r7471).
av_aes_block round_key[15];
av_aes_block state[2];
int rounds;
-}AVAES;
+} AVAES;
const int av_aes_size= sizeof(AVAES);
@@ -54,23 +55,58 @@ static uint32_t enc_multbl[4][256];
static uint32_t dec_multbl[4][256];
#endif
-static inline void addkey(av_aes_block *dst, const av_aes_block *src, const av_aes_block *round_key){
+#if HAVE_BIGENDIAN
+# define ROT(x, s) ((x >> s) | (x << (32-s)))
+#else
+# define ROT(x, s) ((x << s) | (x >> (32-s)))
+#endif
+
+static inline void addkey(av_aes_block *dst, const av_aes_block *src,
+ const av_aes_block *round_key)
+{
dst->u64[0] = src->u64[0] ^ round_key->u64[0];
dst->u64[1] = src->u64[1] ^ round_key->u64[1];
}
-static void subshift(av_aes_block s0[2], int s, const uint8_t *box){
- av_aes_block *s1= (av_aes_block *)(s0[0].u8 - s);
- av_aes_block *s3= (av_aes_block *)(s0[0].u8 + s);
- s0[0].u8[0]=box[s0[1].u8[ 0]]; s0[0].u8[ 4]=box[s0[1].u8[ 4]]; s0[0].u8[ 8]=box[s0[1].u8[ 8]]; s0[0].u8[12]=box[s0[1].u8[12]];
- s1[0].u8[3]=box[s1[1].u8[ 7]]; s1[0].u8[ 7]=box[s1[1].u8[11]]; s1[0].u8[11]=box[s1[1].u8[15]]; s1[0].u8[15]=box[s1[1].u8[ 3]];
- s0[0].u8[2]=box[s0[1].u8[10]]; s0[0].u8[10]=box[s0[1].u8[ 2]]; s0[0].u8[ 6]=box[s0[1].u8[14]]; s0[0].u8[14]=box[s0[1].u8[ 6]];
- s3[0].u8[1]=box[s3[1].u8[13]]; s3[0].u8[13]=box[s3[1].u8[ 9]]; s3[0].u8[ 9]=box[s3[1].u8[ 5]]; s3[0].u8[ 5]=box[s3[1].u8[ 1]];
+static inline void addkey_s(av_aes_block *dst, const uint8_t *src,
+ const av_aes_block *round_key)
+{
+ dst->u64[0] = AV_RN64(src) ^ round_key->u64[0];
+ dst->u64[1] = AV_RN64(src + 8) ^ round_key->u64[1];
+}
+
+static inline void addkey_d(uint8_t *dst, const av_aes_block *src,
+ const av_aes_block *round_key)
+{
+ AV_WN64(dst, src->u64[0] ^ round_key->u64[0]);
+ AV_WN64(dst + 8, src->u64[1] ^ round_key->u64[1]);
+}
+
+static void subshift(av_aes_block s0[2], int s, const uint8_t *box)
+{
+ av_aes_block *s1 = (av_aes_block *) (s0[0].u8 - s);
+ av_aes_block *s3 = (av_aes_block *) (s0[0].u8 + s);
+
+ s0[0].u8[ 0] = box[s0[1].u8[ 0]];
+ s0[0].u8[ 4] = box[s0[1].u8[ 4]];
+ s0[0].u8[ 8] = box[s0[1].u8[ 8]];
+ s0[0].u8[12] = box[s0[1].u8[12]];
+ s1[0].u8[ 3] = box[s1[1].u8[ 7]];
+ s1[0].u8[ 7] = box[s1[1].u8[11]];
+ s1[0].u8[11] = box[s1[1].u8[15]];
+ s1[0].u8[15] = box[s1[1].u8[ 3]];
+ s0[0].u8[ 2] = box[s0[1].u8[10]];
+ s0[0].u8[10] = box[s0[1].u8[ 2]];
+ s0[0].u8[ 6] = box[s0[1].u8[14]];
+ s0[0].u8[14] = box[s0[1].u8[ 6]];
+ s3[0].u8[ 1] = box[s3[1].u8[13]];
+ s3[0].u8[13] = box[s3[1].u8[ 9]];
+ s3[0].u8[ 9] = box[s3[1].u8[ 5]];
+ s3[0].u8[ 5] = box[s3[1].u8[ 1]];
}
static inline int mix_core(uint32_t multbl[][256], int a, int b, int c, int d){
#if CONFIG_SMALL
-#define ROT(x,s) ((x<<s)|(x>>(32-s)))
return multbl[0][a] ^ ROT(multbl[0][b], 8) ^ ROT(multbl[0][c], 16) ^ ROT(multbl[0][d], 24);
#else
return multbl[0][a] ^ multbl[1][b] ^ multbl[2][c] ^ multbl[3][d];
@@ -85,117 +121,137 @@ static inline void mix(av_aes_block state[2], uint32_t multbl[][256], int s1, in
state[0].u32[3] = mix_core(multbl, src[3][0], src[s1-1][1], src[1][2], src[s3-1][3]);
}
-static inline void crypt(AVAES *a, int s, const uint8_t *sbox, uint32_t multbl[][256]){
+static inline void crypt(AVAES *a, int s, const uint8_t *sbox,
+ uint32_t multbl[][256])
+{
int r;
- for(r=a->rounds-1; r>0; r--){
- mix(a->state, multbl, 3-s, 1+s);
+ for (r = a->rounds - 1; r > 0; r--) {
+ mix(a->state, multbl, 3 - s, 1 + s);
addkey(&a->state[1], &a->state[0], &a->round_key[r]);
}
+
subshift(&a->state[0], s, sbox);
}
-void av_aes_crypt(AVAES *a, uint8_t *dst_, const uint8_t *src_, int count, uint8_t *iv_, int decrypt){
- av_aes_block *dst = (av_aes_block *)dst_;
- const av_aes_block *src = (const av_aes_block *)src_;
- av_aes_block *iv = (av_aes_block *)iv_;
- while(count--){
- addkey(&a->state[1], src, &a->round_key[a->rounds]);
- if(decrypt) {
+void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src,
+ int count, uint8_t *iv, int decrypt)
+{
+ while (count--) {
+ addkey_s(&a->state[1], src, &a->round_key[a->rounds]);
+ if (decrypt) {
crypt(a, 0, inv_sbox, dec_multbl);
- if(iv){
- addkey(&a->state[0], &a->state[0], iv);
+ if (iv) {
+ addkey_s(&a->state[0], iv, &a->state[0]);
memcpy(iv, src, 16);
}
- addkey(dst, &a->state[0], &a->round_key[0]);
- }else{
- if(iv) addkey(&a->state[1], &a->state[1], iv);
- crypt(a, 2, sbox, enc_multbl);
- addkey(dst, &a->state[0], &a->round_key[0]);
- if(iv) memcpy(iv, dst, 16);
+ addkey_d(dst, &a->state[0], &a->round_key[0]);
+ } else {
+ if (iv)
+ addkey_s(&a->state[1], iv, &a->state[1]);
+ crypt(a, 2, sbox, enc_multbl);
+ addkey_d(dst, &a->state[0], &a->round_key[0]);
+ if (iv)
+ memcpy(iv, dst, 16);
}
- src++;
- dst++;
+ src += 16;
+ dst += 16;
}
}
-static void init_multbl2(uint8_t tbl[1024], const int c[4], const uint8_t *log8, const uint8_t *alog8, const uint8_t *sbox){
- int i, j;
- for(i=0; i<1024; i++){
- int x= sbox[i>>2];
- if(x) tbl[i]= alog8[ log8[x] + log8[c[i&3]] ];
- }
+static void init_multbl2(uint32_t tbl[][256], const int c[4],
+ const uint8_t *log8, const uint8_t *alog8,
+ const uint8_t *sbox)
+{
+ int i;
+
+ for (i = 0; i < 256; i++) {
+ int x = sbox[i];
+ if (x) {
+ int k, l, m, n;
+ x = log8[x];
+ k = alog8[x + log8[c[0]]];
+ l = alog8[x + log8[c[1]]];
+ m = alog8[x + log8[c[2]]];
+ n = alog8[x + log8[c[3]]];
+ tbl[0][i] = AV_NE(MKBETAG(k,l,m,n), MKTAG(k,l,m,n));
#if !CONFIG_SMALL
- for(j=256; j<1024; j++)
- for(i=0; i<4; i++)
- tbl[4*j+i]= tbl[4*j + ((i-1)&3) - 1024];
+ tbl[1][i] = ROT(tbl[0][i], 8);
+ tbl[2][i] = ROT(tbl[0][i], 16);
+ tbl[3][i] = ROT(tbl[0][i], 24);
#endif
+ }
+ }
}
// this is based on the reference AES code by Paulo Barreto and Vincent Rijmen
-int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) {
+int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
+{
int i, j, t, rconpointer = 0;
uint8_t tk[8][4];
- int KC= key_bits>>5;
- int rounds= KC + 6;
- uint8_t log8[256];
+ int KC = key_bits >> 5;
+ int rounds = KC + 6;
+ uint8_t log8[256];
uint8_t alog8[512];
- if(!enc_multbl[FF_ARRAY_ELEMS(enc_multbl)-1][FF_ARRAY_ELEMS(enc_multbl[0])-1]){
- j=1;
- for(i=0; i<255; i++){
- alog8[i]=
- alog8[i+255]= j;
- log8[j]= i;
- j^= j+j;
- if(j>255) j^= 0x11B;
+ if (!enc_multbl[FF_ARRAY_ELEMS(enc_multbl)-1][FF_ARRAY_ELEMS(enc_multbl[0])-1]) {
+ j = 1;
+ for (i = 0; i < 255; i++) {
+ alog8[i] = alog8[i + 255] = j;
+ log8[j] = i;
+ j ^= j + j;
+ if (j > 255)
+ j ^= 0x11B;
}
- for(i=0; i<256; i++){
- j= i ? alog8[255-log8[i]] : 0;
- j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4);
- j = (j ^ (j>>8) ^ 99) & 255;
- inv_sbox[j]= i;
- sbox [i]= j;
+ for (i = 0; i < 256; i++) {
+ j = i ? alog8[255 - log8[i]] : 0;
+ j ^= (j << 1) ^ (j << 2) ^ (j << 3) ^ (j << 4);
+ j = (j ^ (j >> 8) ^ 99) & 255;
+ inv_sbox[j] = i;
+ sbox[i] = j;
}
- init_multbl2(dec_multbl[0], (const int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox);
- init_multbl2(enc_multbl[0], (const int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox);
+ init_multbl2(dec_multbl, (const int[4]) { 0xe, 0x9, 0xd, 0xb },
+ log8, alog8, inv_sbox);
+ init_multbl2(enc_multbl, (const int[4]) { 0x2, 0x1, 0x1, 0x3 },
+ log8, alog8, sbox);
}
- if(key_bits!=128 && key_bits!=192 && key_bits!=256)
+ if (key_bits != 128 && key_bits != 192 && key_bits != 256)
return -1;
- a->rounds= rounds;
+ a->rounds = rounds;
- memcpy(tk, key, KC*4);
+ memcpy(tk, key, KC * 4);
- for(t= 0; t < (rounds+1)*16;) {
- memcpy(a->round_key[0].u8+t, tk, KC*4);
- t+= KC*4;
+ for (t = 0; t < (rounds + 1) * 16;) {
+ memcpy(a->round_key[0].u8 + t, tk, KC * 4);
+ t += KC * 4;
- for(i = 0; i < 4; i++)
- tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]];
+ for (i = 0; i < 4; i++)
+ tk[0][i] ^= sbox[tk[KC - 1][(i + 1) & 3]];
tk[0][0] ^= rcon[rconpointer++];
- for(j = 1; j < KC; j++){
- if(KC != 8 || j != KC>>1)
- for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i];
+ for (j = 1; j < KC; j++) {
+ if (KC != 8 || j != KC >> 1)
+ for (i = 0; i < 4; i++)
+ tk[j][i] ^= tk[j - 1][i];
else
- for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]];
+ for (i = 0; i < 4; i++)
+ tk[j][i] ^= sbox[tk[j - 1][i]];
}
}
- if(decrypt){
- for(i=1; i<rounds; i++){
+ if (decrypt) {
+ for (i = 1; i < rounds; i++) {
av_aes_block tmp[3];
- memcpy(&tmp[2], &a->round_key[i], 16);
+ tmp[2] = a->round_key[i];
subshift(&tmp[1], 0, sbox);
mix(tmp, dec_multbl, 1, 3);
- memcpy(&a->round_key[i], &tmp[0], 16);
+ a->round_key[i] = tmp[0];
}
- }else{
- for(i=0; i<(rounds+1)>>1; i++){
- for(j=0; j<16; j++)
- FFSWAP(int, a->round_key[i].u8[j], a->round_key[rounds-i].u8[j]);
+ } else {
+ for (i = 0; i < (rounds + 1) >> 1; i++) {
+ FFSWAP(av_aes_block, a->round_key[i], a->round_key[rounds-i]);
}
}
@@ -203,53 +259,76 @@ int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) {
}
#ifdef TEST
+#include <string.h>
#include "lfg.h"
#include "log.h"
-int main(void){
- int i,j;
- AVAES ae, ad, b;
- uint8_t rkey[2][16]= {
- {0},
- {0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3, 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59}};
+int main(int argc, char **argv)
+{
+ int i, j;
+ AVAES b;
+ uint8_t rkey[2][16] = {
+ { 0 },
+ { 0x10, 0xa5, 0x88, 0x69, 0xd7, 0x4b, 0xe5, 0xa3,
+ 0x74, 0xcf, 0x86, 0x7c, 0xfb, 0x47, 0x38, 0x59 }
+ };
uint8_t pt[16], rpt[2][16]= {
- {0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad, 0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3},
- {0}};
+ { 0x6a, 0x84, 0x86, 0x7c, 0xd7, 0x7e, 0x12, 0xad,
+ 0x07, 0xea, 0x1b, 0xe8, 0x95, 0xc5, 0x3f, 0xa3 },
+ { 0 }
+ };
uint8_t rct[2][16]= {
- {0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7, 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf},
- {0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0, 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65}};
+ { 0x73, 0x22, 0x81, 0xc0, 0xa0, 0xaa, 0xb8, 0xf7,
+ 0xa5, 0x4a, 0x0c, 0x67, 0xa0, 0xc4, 0x5e, 0xcf },
+ { 0x6d, 0x25, 0x1e, 0x69, 0x44, 0xb0, 0x51, 0xe0,
+ 0x4e, 0xaa, 0x6f, 0xb4, 0xdb, 0xf7, 0x84, 0x65 }
+ };
uint8_t temp[16];
- AVLFG prng;
+ int err = 0;
- av_aes_init(&ae, "PI=3.141592654..", 128, 0);
- av_aes_init(&ad, "PI=3.141592654..", 128, 1);
av_log_set_level(AV_LOG_DEBUG);
- av_lfg_init(&prng, 1);
- for(i=0; i<2; i++){
+ for (i = 0; i < 2; i++) {
av_aes_init(&b, rkey[i], 128, 1);
av_aes_crypt(&b, temp, rct[i], 1, NULL, 1);
- for(j=0; j<16; j++)
- if(rpt[i][j] != temp[j])
- av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n", j, rpt[i][j], temp[j]);
+ for (j = 0; j < 16; j++) {
+ if (rpt[i][j] != temp[j]) {
+ av_log(NULL, AV_LOG_ERROR, "%d %02X %02X\n",
+ j, rpt[i][j], temp[j]);
+ err = 1;
+ }
+ }
}
- for(i=0; i<10000; i++){
- for(j=0; j<16; j++){
- pt[j] = av_lfg_get(&prng);
- }
-{START_TIMER
- av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
- if(!(i&(i-1)))
- av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n", temp[0], temp[5], temp[10], temp[15]);
- av_aes_crypt(&ad, temp, temp, 1, NULL, 1);
-STOP_TIMER("aes")}
- for(j=0; j<16; j++){
- if(pt[j] != temp[j]){
- av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n", i,j, pt[j], temp[j]);
+ if (argc > 1 && !strcmp(argv[1], "-t")) {
+ AVAES ae, ad;
+ AVLFG prng;
+
+ av_aes_init(&ae, "PI=3.141592654..", 128, 0);
+ av_aes_init(&ad, "PI=3.141592654..", 128, 1);
+ av_lfg_init(&prng, 1);
+
+ for (i = 0; i < 10000; i++) {
+ for (j = 0; j < 16; j++) {
+ pt[j] = av_lfg_get(&prng);
+ }
+ {
+ START_TIMER;
+ av_aes_crypt(&ae, temp, pt, 1, NULL, 0);
+ if (!(i & (i - 1)))
+ av_log(NULL, AV_LOG_ERROR, "%02X %02X %02X %02X\n",
+ temp[0], temp[5], temp[10], temp[15]);
+ av_aes_crypt(&ad, temp, temp, 1, NULL, 1);
+ STOP_TIMER("aes");
+ }
+ for (j = 0; j < 16; j++) {
+ if (pt[j] != temp[j]) {
+ av_log(NULL, AV_LOG_ERROR, "%d %d %02X %02X\n",
+ i, j, pt[j], temp[j]);
+ }
}
}
}
- return 0;
+ return err;
}
#endif
diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index c439a83..32a2eb4 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -44,32 +44,45 @@ int av_get_cpu_flags(void)
#undef printf
#include <stdio.h>
+static const struct {
+ int flag;
+ const char *name;
+} cpu_flag_tab[] = {
+#if ARCH_ARM
+ { AV_CPU_FLAG_IWMMXT, "iwmmxt" },
+#elif ARCH_PPC
+ { AV_CPU_FLAG_ALTIVEC, "altivec" },
+#elif ARCH_X86
+ { AV_CPU_FLAG_MMX, "mmx" },
+ { AV_CPU_FLAG_MMX2, "mmx2" },
+ { AV_CPU_FLAG_SSE, "sse" },
+ { AV_CPU_FLAG_SSE2, "sse2" },
+ { AV_CPU_FLAG_SSE2SLOW, "sse2(slow)" },
+ { AV_CPU_FLAG_SSE3, "sse3" },
+ { AV_CPU_FLAG_SSE3SLOW, "sse3(slow)" },
+ { AV_CPU_FLAG_SSSE3, "ssse3" },
+ { AV_CPU_FLAG_ATOM, "atom" },
+ { AV_CPU_FLAG_SSE4, "sse4.1" },
+ { AV_CPU_FLAG_SSE42, "sse4.2" },
+ { AV_CPU_FLAG_AVX, "avx" },
+ { AV_CPU_FLAG_3DNOW, "3dnow" },
+ { AV_CPU_FLAG_3DNOWEXT, "3dnowext" },
+#endif
+ { 0 }
+};
+
int main(void)
{
int cpu_flags = av_get_cpu_flags();
+ int i;
printf("cpu_flags = 0x%08X\n", cpu_flags);
- printf("cpu_flags = %s%s%s%s%s%s%s%s%s%s%s%s%s\n",
-#if ARCH_ARM
- cpu_flags & AV_CPU_FLAG_IWMMXT ? "IWMMXT " : "",
-#elif ARCH_PPC
- cpu_flags & AV_CPU_FLAG_ALTIVEC ? "ALTIVEC " : "",
-#elif ARCH_X86
- cpu_flags & AV_CPU_FLAG_MMX ? "MMX " : "",
- cpu_flags & AV_CPU_FLAG_MMX2 ? "MMX2 " : "",
- cpu_flags & AV_CPU_FLAG_SSE ? "SSE " : "",
- cpu_flags & AV_CPU_FLAG_SSE2 ? "SSE2 " : "",
- cpu_flags & AV_CPU_FLAG_SSE2SLOW ? "SSE2(slow) " : "",
- cpu_flags & AV_CPU_FLAG_SSE3 ? "SSE3 " : "",
- cpu_flags & AV_CPU_FLAG_SSE3SLOW ? "SSE3(slow) " : "",
- cpu_flags & AV_CPU_FLAG_SSSE3 ? "SSSE3 " : "",
- cpu_flags & AV_CPU_FLAG_ATOM ? "Atom " : "",
- cpu_flags & AV_CPU_FLAG_SSE4 ? "SSE4.1 " : "",
- cpu_flags & AV_CPU_FLAG_SSE42 ? "SSE4.2 " : "",
- cpu_flags & AV_CPU_FLAG_AVX ? "AVX " : "",
- cpu_flags & AV_CPU_FLAG_3DNOW ? "3DNow " : "",
- cpu_flags & AV_CPU_FLAG_3DNOWEXT ? "3DNowExt " : "");
-#endif
+ printf("cpu_flags =");
+ for (i = 0; cpu_flag_tab[i].flag; i++)
+ if (cpu_flags & cpu_flag_tab[i].flag)
+ printf(" %s", cpu_flag_tab[i].name);
+ printf("\n");
+
return 0;
}
diff --git a/libavutil/des.c b/libavutil/des.c
index f3482ae..c473a5f 100644
--- a/libavutil/des.c
+++ b/libavutil/des.c
@@ -39,6 +39,7 @@ static const uint8_t IP_shuffle[] = {
};
#undef T
+#if defined(CONFIG_SMALL) || defined(GENTABLES)
#define T(a, b, c, d) 32-a,32-b,32-c,32-d
static const uint8_t P_shuffle[] = {
T(16, 7, 20, 21),
@@ -51,6 +52,7 @@ static const uint8_t P_shuffle[] = {
T(22, 11, 4, 25)
};
#undef T
+#endif
#define T(a, b, c, d, e, f, g) 64-a,64-b,64-c,64-d,64-e,64-f,64-g
static const uint8_t PC1_shuffle[] = {
@@ -297,10 +299,10 @@ int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
}
void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
- uint64_t iv_val = iv ? av_be2ne64(*(uint64_t *)iv) : 0;
+ uint64_t iv_val = iv ? AV_RB64(iv) : 0;
while (count-- > 0) {
uint64_t dst_val;
- uint64_t src_val = src ? av_be2ne64(*(const uint64_t *)src) : 0;
+ uint64_t src_val = src ? AV_RB64(src) : 0;
if (decrypt) {
uint64_t tmp = src_val;
if (d->triple_des) {
@@ -317,12 +319,12 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
}
iv_val = iv ? dst_val : 0;
}
- *(uint64_t *)dst = av_be2ne64(dst_val);
+ AV_WB64(dst, dst_val);
src += 8;
dst += 8;
}
if (iv)
- *(uint64_t *)iv = av_be2ne64(iv_val);
+ AV_WB64(iv, iv_val);
}
#ifdef TEST
@@ -402,7 +404,7 @@ int main(void) {
printf("Partial Monte-Carlo test failed\n");
return 1;
}
- for (i = 0; i < 1000000; i++) {
+ for (i = 0; i < 1000; i++) {
key[0] = rand64(); key[1] = rand64(); key[2] = rand64();
data = rand64();
av_des_init(&d, key, 192, 0);
diff --git a/libavutil/dict.h b/libavutil/dict.h
index b960923..84f58ec 100644
--- a/libavutil/dict.h
+++ b/libavutil/dict.h
@@ -18,22 +18,55 @@
*/
/**
- * @file Public dictionary API.
+ * @file
+ * Public dictionary API.
* @deprecated
* AVDictionary is provided for compatibility with libav. It is both in
* implementation as well as API inefficient. It does not scale and is
* extremely slow with large dictionaries.
* It is recommended that new code uses our tree container from tree.c/h
- * where applicable, which uses AVL trees to achive O(log n) performance.
+ * where applicable, which uses AVL trees to achieve O(log n) performance.
*/
#ifndef AVUTIL_DICT_H
#define AVUTIL_DICT_H
+/**
+ * @defgroup dict_api Public Dictionary API
+ * @{
+ * Dictionaries are used for storing key:value pairs. To create
+ * an AVDictionary, simply pass an address of a NULL pointer to
+ * av_dict_set(). NULL can be used as an empty dictionary wherever
+ * a pointer to an AVDictionary is required.
+ * Use av_dict_get() to retrieve an entry or iterate over all
+ * entries and finally av_dict_free() to free the dictionary
+ * and all its contents.
+ *
+ * @code
+ * AVDictionary *d = NULL; // "create" an empty dictionary
+ * av_dict_set(&d, "foo", "bar", 0); // add an entry
+ *
+ * char *k = av_strdup("key"); // if your strings are already allocated,
+ * char *v = av_strdup("value"); // you can avoid copying them like this
+ * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL);
+ *
+ * AVDictionaryEntry *t = NULL;
+ * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) {
+ * <....> // iterate over all entries in d
+ * }
+ *
+ * av_dict_free(&d);
+ * @endcode
+ *
+ * @}
+ */
+
#define AV_DICT_MATCH_CASE 1
#define AV_DICT_IGNORE_SUFFIX 2
-#define AV_DICT_DONT_STRDUP_KEY 4
-#define AV_DICT_DONT_STRDUP_VAL 8
+#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been
+ allocated with av_malloc() and children. */
+#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been
+ allocated with av_malloc() and chilren. */
#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries.
#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no
delimiter is added, the strings are simply concatenated. */
@@ -79,7 +112,8 @@ int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags
void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags);
/**
- * Free all the memory allocated for an AVDictionary struct.
+ * Free all the memory allocated for an AVDictionary struct
+ * and all keys and values.
*/
void av_dict_free(AVDictionary **m);
diff --git a/libavutil/eval.c b/libavutil/eval.c
index fa2999b..4e2cb10 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -28,6 +28,7 @@
#include "avutil.h"
#include "eval.h"
+#include "log.h"
typedef struct Parser {
const AVClass *class;
@@ -471,7 +472,7 @@ int av_expr_parse(AVExpr **expr, const char *s,
const char * const *func2_names, double (* const *funcs2)(void *, double, double),
int log_offset, void *log_ctx)
{
- Parser p;
+ Parser p = { 0 };
AVExpr *e = NULL;
char *w = av_malloc(strlen(s) + 1);
char *wp = w;
@@ -499,6 +500,7 @@ int av_expr_parse(AVExpr **expr, const char *s,
if ((ret = parse_expr(&e, &p)) < 0)
goto end;
if (*p.s) {
+ av_expr_free(e);
av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0);
ret = AVERROR(EINVAL);
goto end;
@@ -516,7 +518,7 @@ end:
double av_expr_eval(AVExpr *e, const double *const_values, void *opaque)
{
- Parser p;
+ Parser p = { 0 };
p.const_values = const_values;
p.opaque = opaque;
@@ -575,6 +577,8 @@ void av_free_expr(AVExpr *e)
#ifdef TEST
#undef printf
+#include <string.h>
+
static double const_values[] = {
M_PI,
M_E,
@@ -587,7 +591,7 @@ static const char *const_names[] = {
0
};
-int main(void)
+int main(int argc, char **argv)
{
int i;
double d;
@@ -598,7 +602,7 @@ int main(void)
"-PI",
"+PI",
"1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
- "80G/80Gi"
+ "80G/80Gi",
"1k",
"1Gi",
"1gi",
@@ -656,7 +660,11 @@ int main(void)
av_expr_parse_and_eval(&d, *expr,
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
- printf("'%s' -> %f\n\n", *expr, d);
+ if(isnan(d)){
+ printf("'%s' -> nan\n\n", *expr);
+ }else{
+ printf("'%s' -> %f\n\n", *expr, d);
+ }
}
av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
@@ -668,13 +676,16 @@ int main(void)
NULL, NULL, NULL, NULL, NULL, 0, NULL);
printf("%f == 0.931322575\n", d);
- for (i=0; i<1050; i++) {
- START_TIMER
+ if (argc > 1 && !strcmp(argv[1], "-t")) {
+ for (i = 0; i < 1050; i++) {
+ START_TIMER;
av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)",
const_names, const_values,
NULL, NULL, NULL, NULL, NULL, 0, NULL);
- STOP_TIMER("av_expr_parse_and_eval")
+ STOP_TIMER("av_expr_parse_and_eval");
+ }
}
+
return 0;
}
#endif
diff --git a/libavutil/file.c b/libavutil/file.c
index ed6fa38..31a3b75 100644
--- a/libavutil/file.c
+++ b/libavutil/file.c
@@ -17,6 +17,7 @@
*/
#include "file.h"
+#include "log.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/libavutil/file.h b/libavutil/file.h
index f94d780..f28627c 100644
--- a/libavutil/file.h
+++ b/libavutil/file.h
@@ -22,7 +22,8 @@
#include "avutil.h"
/**
- * @file misc file utilities
+ * @file
+ * Misc file utilities.
*/
/**
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index e04c307..9447779 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -23,6 +23,7 @@
#include "imgutils.h"
#include "internal.h"
+#include "log.h"
#include "pixdesc.h"
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index f34cb2d..f976d21 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -69,7 +69,7 @@ int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int widt
*
* @param data pointers array to be filled with the pointer for each image plane
* @param ptr the pointer to a buffer which will contain the image
- * @param linesizes[4] the array containing the linesize for each
+ * @param linesizes the array containing the linesize for each
* plane, should be filled by av_image_fill_linesizes()
* @return the size in bytes required for the image buffer, a negative
* error code in case of failure
@@ -106,8 +106,8 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
/**
* Copy image in src_data to dst_data.
*
- * @param dst_linesize linesizes for the image in dst_data
- * @param src_linesize linesizes for the image in src_data
+ * @param dst_linesizes linesizes for the image in dst_data
+ * @param src_linesizes linesizes for the image in src_data
*/
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
const uint8_t *src_data[4], const int src_linesizes[4],
diff --git a/libavutil/lfg.h b/libavutil/lfg.h
index 0e89ea3..854ffce 100644
--- a/libavutil/lfg.h
+++ b/libavutil/lfg.h
@@ -55,7 +55,7 @@ static inline unsigned int av_mlfg_get(AVLFG *c){
* Get the next two numbers generated by a Box-Muller Gaussian
* generator using the random numbers issued by lfg.
*
- * @param out[2] array where the two generated numbers are placed
+ * @param out array where the two generated numbers are placed
*/
void av_bmg_get(AVLFG *lfg, double out[2]);
diff --git a/libavutil/lls.c b/libavutil/lls.c
index 3855792..5f59db6 100644
--- a/libavutil/lls.c
+++ b/libavutil/lls.c
@@ -30,76 +30,88 @@
#include "lls.h"
-void av_init_lls(LLSModel *m, int indep_count){
+void av_init_lls(LLSModel *m, int indep_count)
+{
memset(m, 0, sizeof(LLSModel));
-
- m->indep_count= indep_count;
+ m->indep_count = indep_count;
}
-void av_update_lls(LLSModel *m, double *var, double decay){
- int i,j;
+void av_update_lls(LLSModel *m, double *var, double decay)
+{
+ int i, j;
- for(i=0; i<=m->indep_count; i++){
- for(j=i; j<=m->indep_count; j++){
+ for (i = 0; i <= m->indep_count; i++) {
+ for (j = i; j <= m->indep_count; j++) {
m->covariance[i][j] *= decay;
- m->covariance[i][j] += var[i]*var[j];
+ m->covariance[i][j] += var[i] * var[j];
}
}
}
-void av_solve_lls(LLSModel *m, double threshold, int min_order){
- int i,j,k;
- double (*factor)[MAX_VARS+1]= (void*)&m->covariance[1][0];
- double (*covar )[MAX_VARS+1]= (void*)&m->covariance[1][1];
- double *covar_y = m->covariance[0];
- int count= m->indep_count;
-
- for(i=0; i<count; i++){
- for(j=i; j<count; j++){
- double sum= covar[i][j];
-
- for(k=i-1; k>=0; k--)
- sum -= factor[i][k]*factor[j][k];
-
- if(i==j){
- if(sum < threshold)
- sum= 1.0;
- factor[i][i]= sqrt(sum);
- }else
- factor[j][i]= sum / factor[i][i];
+void av_solve_lls(LLSModel *m, double threshold, int min_order)
+{
+ int i, j, k;
+ double (*factor)[MAX_VARS + 1] = (void *) &m->covariance[1][0];
+ double (*covar) [MAX_VARS + 1] = (void *) &m->covariance[1][1];
+ double *covar_y = m->covariance[0];
+ int count = m->indep_count;
+
+ for (i = 0; i < count; i++) {
+ for (j = i; j < count; j++) {
+ double sum = covar[i][j];
+
+ for (k = i - 1; k >= 0; k--)
+ sum -= factor[i][k] * factor[j][k];
+
+ if (i == j) {
+ if (sum < threshold)
+ sum = 1.0;
+ factor[i][i] = sqrt(sum);
+ } else {
+ factor[j][i] = sum / factor[i][i];
+ }
}
}
- for(i=0; i<count; i++){
- double sum= covar_y[i+1];
- for(k=i-1; k>=0; k--)
- sum -= factor[i][k]*m->coeff[0][k];
- m->coeff[0][i]= sum / factor[i][i];
+
+ for (i = 0; i < count; i++) {
+ double sum = covar_y[i + 1];
+
+ for (k = i - 1; k >= 0; k--)
+ sum -= factor[i][k] * m->coeff[0][k];
+
+ m->coeff[0][i] = sum / factor[i][i];
}
- for(j=count-1; j>=min_order; j--){
- for(i=j; i>=0; i--){
- double sum= m->coeff[0][i];
- for(k=i+1; k<=j; k++)
- sum -= factor[k][i]*m->coeff[j][k];
- m->coeff[j][i]= sum / factor[i][i];
+ for (j = count - 1; j >= min_order; j--) {
+ for (i = j; i >= 0; i--) {
+ double sum = m->coeff[0][i];
+
+ for (k = i + 1; k <= j; k++)
+ sum -= factor[k][i] * m->coeff[j][k];
+
+ m->coeff[j][i] = sum / factor[i][i];
}
- m->variance[j]= covar_y[0];
- for(i=0; i<=j; i++){
- double sum= m->coeff[j][i]*covar[i][i] - 2*covar_y[i+1];
- for(k=0; k<i; k++)
- sum += 2*m->coeff[j][k]*covar[k][i];
- m->variance[j] += m->coeff[j][i]*sum;
+ m->variance[j] = covar_y[0];
+
+ for (i = 0; i <= j; i++) {
+ double sum = m->coeff[j][i] * covar[i][i] - 2 * covar_y[i + 1];
+
+ for (k = 0; k < i; k++)
+ sum += 2 * m->coeff[j][k] * covar[k][i];
+
+ m->variance[j] += m->coeff[j][i] * sum;
}
}
}
-double av_evaluate_lls(LLSModel *m, double *param, int order){
+double av_evaluate_lls(LLSModel *m, double *param, int order)
+{
int i;
- double out= 0;
+ double out = 0;
- for(i=0; i<=order; i++)
- out+= param[i]*m->coeff[order][i];
+ for (i = 0; i <= order; i++)
+ out += param[i] * m->coeff[order][i];
return out;
}
@@ -109,26 +121,29 @@ double av_evaluate_lls(LLSModel *m, double *param, int order){
#include <stdlib.h>
#include <stdio.h>
-int main(void){
+int main(void)
+{
LLSModel m;
int i, order;
av_init_lls(&m, 3);
- for(i=0; i<100; i++){
+ for (i = 0; i < 100; i++) {
double var[4];
double eval;
- var[0] = (rand() / (double)RAND_MAX - 0.5)*2;
- var[1] = var[0] + rand() / (double)RAND_MAX - 0.5;
- var[2] = var[1] + rand() / (double)RAND_MAX - 0.5;
- var[3] = var[2] + rand() / (double)RAND_MAX - 0.5;
+
+ var[0] = (rand() / (double) RAND_MAX - 0.5) * 2;
+ var[1] = var[0] + rand() / (double) RAND_MAX - 0.5;
+ var[2] = var[1] + rand() / (double) RAND_MAX - 0.5;
+ var[3] = var[2] + rand() / (double) RAND_MAX - 0.5;
av_update_lls(&m, var, 0.99);
av_solve_lls(&m, 0.001, 0);
- for(order=0; order<3; order++){
- eval= av_evaluate_lls(&m, var+1, order);
+ for (order = 0; order < 3; order++) {
+ eval = av_evaluate_lls(&m, var + 1, order);
printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n",
- var[0], order, eval, sqrt(m.variance[order] / (i+1)),
- m.coeff[order][0], m.coeff[order][1], m.coeff[order][2]);
+ var[0], order, eval, sqrt(m.variance[order] / (i + 1)),
+ m.coeff[order][0], m.coeff[order][1],
+ m.coeff[order][2]);
}
}
return 0;
diff --git a/libavutil/lzo.h b/libavutil/lzo.h
index d1b8fa7..ae5fc53 100644
--- a/libavutil/lzo.h
+++ b/libavutil/lzo.h
@@ -24,7 +24,7 @@
#include <stdint.h>
-/** @defgroup errflags Error flags returned by av_lzo1x_decode
+/** @name Error flags returned by av_lzo1x_decode
* \{ */
//! end of the input buffer reached before decoding finished
#define AV_LZO_INPUT_DEPLETED 1
diff --git a/libavutil/md5.c b/libavutil/md5.c
index 173ed06..471a510 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -30,8 +30,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <string.h>
+#include <stdint.h>
#include "bswap.h"
+#include "intreadwrite.h"
#include "md5.h"
typedef struct AVMD5{
@@ -40,7 +41,7 @@ typedef struct AVMD5{
uint32_t ABCD[4];
} AVMD5;
-const int av_md5_size= sizeof(AVMD5);
+const int av_md5_size = sizeof(AVMD5);
static const uint8_t S[4][4] = {
{ 7, 12, 17, 22 }, /* round 1 */
@@ -71,42 +72,49 @@ static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32)
0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391,
};
-#define CORE(i, a, b, c, d) \
- t = S[i>>4][i&3];\
- a += T[i];\
-\
- if(i<32){\
- if(i<16) a += (d ^ (b&(c^d))) + X[ i &15 ];\
- else a += (c ^ (d&(c^b))) + X[ (1+5*i)&15 ];\
- }else{\
- if(i<48) a += (b^c^d) + X[ (5+3*i)&15 ];\
- else a += (c^(b|~d)) + X[ ( 7*i)&15 ];\
- }\
- a = b + (( a << t ) | ( a >> (32 - t) ));
-
-static void body(uint32_t ABCD[4], uint32_t X[16]){
-
+#define CORE(i, a, b, c, d) do { \
+ t = S[i >> 4][i & 3]; \
+ a += T[i]; \
+ \
+ if (i < 32) { \
+ if (i < 16) a += (d ^ (b & (c ^ d))) + X[ i & 15]; \
+ else a += (c ^ (d & (c ^ b))) + X[(1 + 5*i) & 15]; \
+ } else { \
+ if (i < 48) a += (b ^ c ^ d) + X[(5 + 3*i) & 15]; \
+ else a += (c ^ (b | ~d)) + X[( 7*i) & 15]; \
+ } \
+ a = b + (a << t | a >> (32 - t)); \
+ } while (0)
+
+static void body(uint32_t ABCD[4], uint32_t X[16])
+{
int t;
int i av_unused;
- unsigned int a= ABCD[3];
- unsigned int b= ABCD[2];
- unsigned int c= ABCD[1];
- unsigned int d= ABCD[0];
+ unsigned int a = ABCD[3];
+ unsigned int b = ABCD[2];
+ unsigned int c = ABCD[1];
+ unsigned int d = ABCD[0];
#if HAVE_BIGENDIAN
- for(i=0; i<16; i++)
- X[i]= av_bswap32(X[i]);
+ for (i = 0; i < 16; i++)
+ X[i] = av_bswap32(X[i]);
#endif
#if CONFIG_SMALL
- for( i = 0; i < 64; i++ ){
- CORE(i,a,b,c,d)
- t=d; d=c; c=b; b=a; a=t;
+ for (i = 0; i < 64; i++) {
+ CORE(i, a, b, c, d);
+ t = d;
+ d = c;
+ c = b;
+ b = a;
+ a = t;
}
#else
-#define CORE2(i) CORE(i,a,b,c,d) CORE((i+1),d,a,b,c) CORE((i+2),c,d,a,b) CORE((i+3),b,c,d,a)
-#define CORE4(i) CORE2(i) CORE2((i+4)) CORE2((i+8)) CORE2((i+12))
-CORE4(0) CORE4(16) CORE4(32) CORE4(48)
+#define CORE2(i) \
+ CORE( i, a,b,c,d); CORE((i+1),d,a,b,c); \
+ CORE((i+2),c,d,a,b); CORE((i+3),b,c,d,a)
+#define CORE4(i) CORE2(i); CORE2((i+4)); CORE2((i+8)); CORE2((i+12))
+ CORE4(0); CORE4(16); CORE4(32); CORE4(48);
#endif
ABCD[0] += d;
@@ -115,8 +123,9 @@ CORE4(0) CORE4(16) CORE4(32) CORE4(48)
ABCD[3] += a;
}
-void av_md5_init(AVMD5 *ctx){
- ctx->len = 0;
+void av_md5_init(AVMD5 *ctx)
+{
+ ctx->len = 0;
ctx->ABCD[0] = 0x10325476;
ctx->ABCD[1] = 0x98badcfe;
@@ -124,59 +133,72 @@ void av_md5_init(AVMD5 *ctx){
ctx->ABCD[3] = 0x67452301;
}
-void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){
+void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len)
+{
int i, j;
- j= ctx->len & 63;
+ j = ctx->len & 63;
ctx->len += len;
- for( i = 0; i < len; i++ ){
+ for (i = 0; i < len; i++) {
ctx->block[j++] = src[i];
- if( 64 == j ){
- body(ctx->ABCD, (uint32_t*) ctx->block);
+ if (j == 64) {
+ body(ctx->ABCD, (uint32_t *) ctx->block);
j = 0;
}
}
}
-void av_md5_final(AVMD5 *ctx, uint8_t *dst){
+void av_md5_final(AVMD5 *ctx, uint8_t *dst)
+{
int i;
- uint64_t finalcount= av_le2ne64(ctx->len<<3);
+ uint64_t finalcount = av_le2ne64(ctx->len << 3);
av_md5_update(ctx, "\200", 1);
- while((ctx->len & 63)!=56)
+ while ((ctx->len & 63) != 56)
av_md5_update(ctx, "", 1);
- av_md5_update(ctx, (uint8_t*)&finalcount, 8);
+ av_md5_update(ctx, (uint8_t *)&finalcount, 8);
- for(i=0; i<4; i++)
- ((uint32_t*)dst)[i]= av_le2ne32(ctx->ABCD[3-i]);
+ for (i = 0; i < 4; i++)
+ AV_WL32(dst + 4*i, ctx->ABCD[3 - i]);
}
-void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
- AVMD5 ctx[1];
+void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len)
+{
+ AVMD5 ctx;
- av_md5_init(ctx);
- av_md5_update(ctx, src, len);
- av_md5_final(ctx, dst);
+ av_md5_init(&ctx);
+ av_md5_update(&ctx, src, len);
+ av_md5_final(&ctx, dst);
}
#ifdef TEST
-#include <stdio.h>
-#include <inttypes.h>
#undef printf
+#include <stdio.h>
+
+static void print_md5(uint8_t *md5)
+{
+ int i;
+ for (i = 0; i < 16; i++)
+ printf("%02x", md5[i]);
+ printf("\n");
+}
+
int main(void){
- uint64_t md5val;
+ uint8_t md5val[16];
int i;
uint8_t in[1000];
- for(i=0; i<1000; i++) in[i]= i*i;
- av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%"PRId64"\n", md5val);
- av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%"PRId64"\n", md5val);
- av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%"PRId64"\n", md5val);
- av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%"PRId64"\n", md5val);
- for(i=0; i<1000; i++) in[i]= i % 127;
- av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%"PRId64"\n", md5val);
+ for (i = 0; i < 1000; i++)
+ in[i] = i * i;
+ av_md5_sum(md5val, in, 1000); print_md5(md5val);
+ av_md5_sum(md5val, in, 63); print_md5(md5val);
+ av_md5_sum(md5val, in, 64); print_md5(md5val);
+ av_md5_sum(md5val, in, 65); print_md5(md5val);
+ for (i = 0; i < 1000; i++)
+ in[i] = i % 127;
+ av_md5_sum(md5val, in, 999); print_md5(md5val);
return 0;
}
diff --git a/libavutil/opt.c b/libavutil/opt.c
index c0b529b..609167e 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -30,6 +30,7 @@
#include "opt.h"
#include "eval.h"
#include "dict.h"
+#include "log.h"
#if FF_API_FIND_OPT
//FIXME order them and do a bin search
@@ -195,7 +196,6 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons
return 0;
notfirst=1;
}
- return AVERROR(EINVAL);
}
if (alloc) {
@@ -575,8 +575,9 @@ const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
return o;
while (o = av_next_option(obj, o)) {
- if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) &&
- (o->flags & opt_flags) == opt_flags)
+ if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags &&
+ ((!unit && o->type != FF_OPT_TYPE_CONST) ||
+ (unit && o->unit && !strcmp(o->unit, unit))))
return o;
}
return NULL;
@@ -603,14 +604,14 @@ typedef struct TestContext
#define TEST_FLAG_MU 04
static const AVOption test_options[]= {
-{"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, 0, 0, 100 },
-{"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, 0, 0, 1 },
-{"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, 0, 0, 10 },
-{"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, 0, CHAR_MIN, CHAR_MAX },
-{"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, 0, 0, INT_MAX, 0, "flags" },
-{"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_COOL, INT_MIN, INT_MAX, 0, "flags" },
-{"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_LAME, INT_MIN, INT_MAX, 0, "flags" },
-{"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, TEST_FLAG_MU, INT_MIN, INT_MAX, 0, "flags" },
+{"num", "set num", OFFSET(num), FF_OPT_TYPE_INT, {0}, 0, 100 },
+{"toggle", "set toggle", OFFSET(toggle), FF_OPT_TYPE_INT, {0}, 0, 1 },
+{"rational", "set rational", OFFSET(rational), FF_OPT_TYPE_RATIONAL, {0}, 0, 10 },
+{"string", "set string", OFFSET(string), FF_OPT_TYPE_STRING, {0}, CHAR_MIN, CHAR_MAX },
+{"flags", "set flags", OFFSET(flags), FF_OPT_TYPE_FLAGS, {0}, 0, INT_MAX, 0, "flags" },
+{"cool", "set cool flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" },
+{"lame", "set lame flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" },
+{"mu", "set mu flag ", 0, FF_OPT_TYPE_CONST, {TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" },
{NULL},
};
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index b2404b5..69917d3 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -28,6 +28,7 @@
#include "avstring.h"
#include "avutil.h"
#include "eval.h"
+#include "log.h"
#include "random_seed.h"
#include "parseutils.h"
@@ -462,7 +463,6 @@ const char *small_strptime(const char *p, const char *fmt,
p++;
}
}
- return p;
}
static time_t mktimegm(struct tm *tm)
diff --git a/libavutil/sha.c b/libavutil/sha.c
index ff9e557..301d160 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -42,7 +42,7 @@ const int av_sha_size = sizeof(AVSHA);
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define blk0(i) (block[i] = av_be2ne32(((const uint32_t*)buffer)[i]))
+#define blk0(i) (block[i] = AV_RB32(buffer + 4 * (i)))
#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
@@ -67,7 +67,7 @@ static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
for (i = 0; i < 80; i++) {
int t;
if (i < 16)
- t = av_be2ne32(((uint32_t*)buffer)[i]);
+ t = AV_RB32(buffer + 4 * i);
else
t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
block[i] = t;
diff --git a/libpostproc/postprocess.c b/libpostproc/postprocess.c
index 589c2ce..944d581 100644
--- a/libpostproc/postprocess.c
+++ b/libpostproc/postprocess.c
@@ -246,7 +246,6 @@ static inline int isVertDC_C(uint8_t src[], int stride, PPContext *c)
static inline int isHorizMinMaxOk_C(uint8_t src[], int stride, int QP)
{
int i;
-#if 1
for(i=0; i<2; i++){
if((unsigned)(src[0] - src[5] + 2*QP) > 4*QP) return 0;
src += stride;
@@ -257,19 +256,11 @@ static inline int isHorizMinMaxOk_C(uint8_t src[], int stride, int QP)
if((unsigned)(src[6] - src[3] + 2*QP) > 4*QP) return 0;
src += stride;
}
-#else
- for(i=0; i<8; i++){
- if((unsigned)(src[0] - src[7] + 2*QP) > 4*QP) return 0;
- src += stride;
- }
-#endif
return 1;
}
static inline int isVertMinMaxOk_C(uint8_t src[], int stride, int QP)
{
-#if 1
-#if 1
int x;
src+= stride*4;
for(x=0; x<BLOCK_SIZE; x+=4){
@@ -278,30 +269,7 @@ static inline int isVertMinMaxOk_C(uint8_t src[], int stride, int QP)
if((unsigned)(src[2+x + 4*stride] - src[2+x + 1*stride] + 2*QP) > 4*QP) return 0;
if((unsigned)(src[3+x + 6*stride] - src[3+x + 3*stride] + 2*QP) > 4*QP) return 0;
}
-#else
- int x;
- src+= stride*3;
- for(x=0; x<BLOCK_SIZE; x++){
- if((unsigned)(src[x + stride] - src[x + (stride<<3)] + 2*QP) > 4*QP) return 0;
- }
-#endif
- return 1;
-#else
- int x;
- src+= stride*4;
- for(x=0; x<BLOCK_SIZE; x++){
- int min=255;
- int max=0;
- int y;
- for(y=0; y<8; y++){
- int v= src[x + y*stride];
- if(v>max) max=v;
- if(v<min) min=v;
- }
- if(max-min > 2*QP) return 0;
- }
return 1;
-#endif
}
static inline int horizClassify_C(uint8_t src[], int stride, PPContext *c)
diff --git a/libpostproc/postprocess_internal.h b/libpostproc/postprocess_internal.h
index 3bc51c4..fd0c7c1 100644
--- a/libpostproc/postprocess_internal.h
+++ b/libpostproc/postprocess_internal.h
@@ -28,6 +28,7 @@
#include <string.h>
#include "libavutil/avutil.h"
+#include "libavutil/log.h"
#include "postprocess.h"
#define V_DEBLOCK 0x01
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 45098ef..9d17868 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -80,17 +80,6 @@ untested special converters
#define RV ( (int)(0.500*224/255*(1<<RGB2YUV_SHIFT)+0.5))
#define RU (-(int)(0.169*224/255*(1<<RGB2YUV_SHIFT)+0.5))
-static const double rgb2yuv_table[8][9]={
- {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5}, //ITU709
- {0.7152, 0.0722, 0.2126, -0.386, 0.5, -0.115, -0.454, -0.046, 0.5}, //ITU709
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //DEFAULT / ITU601 / ITU624 / SMPTE 170M
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //DEFAULT / ITU601 / ITU624 / SMPTE 170M
- {0.59 , 0.11 , 0.30 , -0.331, 0.5, -0.169, -0.421, -0.079, 0.5}, //FCC
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //DEFAULT / ITU601 / ITU624 / SMPTE 170M
- {0.587 , 0.114 , 0.299 , -0.331, 0.5, -0.169, -0.419, -0.081, 0.5}, //DEFAULT / ITU601 / ITU624 / SMPTE 170M
- {0.701 , 0.087 , 0.212 , -0.384, 0.5, -0.116, -0.445, -0.055, 0.5}, //SMPTE 240M
-};
-
/*
NOTES
Special versions: fast Y 1:1 scaling (no interpolation in y direction)
@@ -1088,7 +1077,7 @@ yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2,
const uint32_t *b = (const uint32_t *) _b;
#if CONFIG_SMALL
- int sh = hasAlpha ? ((fmt == PIX_FMT_RGB32_1 || fmt == PIX_FMT_BGR32_1) ? 0 : 24) : 0;
+ int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0;
dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0);
dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0);
diff --git a/libswscale/swscale.h b/libswscale/swscale.h
index 4bb2dfc..b54bba3 100644
--- a/libswscale/swscale.h
+++ b/libswscale/swscale.h
@@ -28,6 +28,8 @@
*/
#include "libavutil/avutil.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
#define LIBSWSCALE_VERSION_MAJOR 2
#define LIBSWSCALE_VERSION_MINOR 0
@@ -247,7 +249,6 @@ int sws_scale_ordered(struct SwsContext *context, const uint8_t* const src[],
/**
* @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x]
- * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235
* @return -1 if not supported
*/
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 09e6ad4..2ffd44d 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -28,6 +28,8 @@
#endif
#include "libavutil/avutil.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
@@ -435,7 +437,10 @@ typedef struct SwsContext {
* @param dstW width of destination image
* @param src pointer to source data to be scaled. If scaling depth
* is 8, this is 8bpp in 8bpp (uint8_t) width. If scaling
- * depth is 16, this is 16bpp in 16bpp (uint16_t) depth.
+ * depth is 16, this is native depth in 16bbp (uint16_t)
+ * width. In other words, for 9-bit YUV input, this is
+ * 9bpp, for 10-bit YUV input, this is 10bpp, and for
+ * 16-bit RGB or YUV, this is 16bpp.
* @param filter filter coefficients to be used per output pixel for
* scaling. This contains 14bpp filtering coefficients.
* Guaranteed to contain dstW * filterSize entries.
diff --git a/subdir.mak b/subdir.mak
index e49eb0f..6adc305 100644
--- a/subdir.mak
+++ b/subdir.mak
@@ -60,13 +60,12 @@ distclean:: clean
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
$(Q)mkdir -p "$(SHLIBDIR)"
- $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- $$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- $(Q)cd "$(SHLIBDIR)" && \
- $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
- $(Q)cd "$(SHLIBDIR)" && \
- $(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
- $(SLIB_INSTALL_EXTRA_CMD)
+ $$(INSTALL) -m 755 $$< "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
+ $$(STRIP) "$(SHLIBDIR)/$(SLIB_INSTALL_NAME)"
+ $(Q)$(foreach F,$(SLIB_INSTALL_LINKS),cd "$(SHLIBDIR)" && $(LN_S) $(SLIB_INSTALL_NAME) $(F);)
+ $(if $(SLIB_INSTALL_EXTRA_SHLIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_SHLIB:%=$(SUBDIR)%) "$(SHLIBDIR)")
+ $(if $(SLIB_INSTALL_EXTRA_LIB),$(Q)mkdir -p "$(LIBDIR)")
+ $(if $(SLIB_INSTALL_EXTRA_LIB),$$(INSTALL) -m 644 $(SLIB_INSTALL_EXTRA_LIB:%=$(SUBDIR)%) "$(LIBDIR)")
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
$(Q)mkdir -p "$(LIBDIR)"
@@ -85,7 +84,8 @@ uninstall-libs::
-$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
"$(SHLIBDIR)/$(SLIBNAME)" \
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
- -$(SLIB_UNINSTALL_EXTRA_CMD)
+ -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%)
+ -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%)
-$(RM) "$(LIBDIR)/$(LIBNAME)"
uninstall-headers::
diff --git a/tests/Makefile b/tests/Makefile
index 38d85fb..431a404 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,12 +1,5 @@
-fulltest test: codectest lavftest lavfitest seektest
-
FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
-codectest: fate-codec
-lavftest: fate-lavf
-lavfitest: fate-lavfi
-seektest: fate-seek
-
AREF = fate-acodec-aref
VREF = fate-vsynth1-vref fate-vsynth2-vref
REFS = $(AREF) $(VREF)
@@ -48,8 +41,10 @@ include $(SRC_PATH)/tests/fate/aac.mak
include $(SRC_PATH)/tests/fate/als.mak
include $(SRC_PATH)/tests/fate/amrnb.mak
include $(SRC_PATH)/tests/fate/amrwb.mak
+include $(SRC_PATH)/tests/fate/dct.mak
include $(SRC_PATH)/tests/fate/fft.mak
include $(SRC_PATH)/tests/fate/h264.mak
+include $(SRC_PATH)/tests/fate/libavutil.mak
include $(SRC_PATH)/tests/fate/mp3.mak
include $(SRC_PATH)/tests/fate/vorbis.mak
include $(SRC_PATH)/tests/fate/vp8.mak
@@ -120,4 +115,4 @@ testclean:
-include $(wildcard tests/*.d)
-.PHONY: fate* *test
+.PHONY: fate*
diff --git a/tests/copy.regression.ref b/tests/copy.regression.ref
deleted file mode 100644
index 0f62a7b..0000000
--- a/tests/copy.regression.ref
+++ /dev/null
@@ -1,465 +0,0 @@
-----------------
-./tests/data/a-ac3.rm
-first.nut second.nut differ: char 34, line 1
-1dd5a62b7edb3a1bcf77626af0a85bc1 first.nut
-----------------
-./tests/data/a-adpcm_ima.wav
-first.nut second.nut differ: char 34, line 1
-c95390143078f08db8a3bfba5789c2da first.nut
-----------------
-./tests/data/a-adpcm_ms.wav
-first.nut second.nut differ: char 34, line 1
-05e4d8842f4001fed506423e1a8ef963 first.nut
-----------------
-./tests/data/a-adpcm_qt.aiff
-first.nut second.nut differ: char 34, line 1
-7455d87f626f05e20030f4c93ec91e69 first.nut
-----------------
-./tests/data/a-adpcm_swf.flv
-c0402ee010a483403a655f353e184df1 first.nut
-----------------
-./tests/data/a-adpcm_yam.wav
-first.nut second.nut differ: char 34, line 1
-f861047f6c6f75cdf3ce7bb78a4003ad first.nut
-----------------
-./tests/data/a-alac.m4a
-first.nut second.nut differ: char 34, line 1
-ab152b0b01e540e74b04a807e3882083 first.nut
-----------------
-./tests/data/a-asv1.avi
-636fc0dfef1830cc51cf2c182bd4a7b2 first.nut
-----------------
-./tests/data/a-asv2.avi
-bbfc299390378c7bdbd7463434d8fcbe first.nut
-----------------
-./tests/data/a-dnxhd-1080i.mov
-first.nut second.nut differ: char 113, line 1
-037e31900e6cdf7161c2a0df23d9dc9d first.nut
-----------------
-./tests/data/a-dnxhd-720p-rd.dnxhd
-first.nut second.nut differ: char 113, line 1
-1237abac554ea9adb2a926641eec0de0 first.nut
-----------------
-./tests/data/a-dnxhd-720p.dnxhd
-first.nut second.nut differ: char 113, line 1
-6694322cefa2f482bc3dac8be22eb5d5 first.nut
-----------------
-./tests/data/a-dv.dv
-1aa367a56d31bb45f98d820121820909 first.nut
-----------------
-./tests/data/a-dv411.dv
-7ef296512960e00d96850f2606b4b683 first.nut
-----------------
-./tests/data/a-dv50.dv
-6424dd39e22a1789a8182d7e8da224a9 first.nut
-----------------
-./tests/data/a-error-mpeg4-adv.avi
-715b262e3e7c9be2b59525ba0289f30e first.nut
-----------------
-./tests/data/a-ffv1.avi
-edada4da2170ffd3386636cff67a90f0 first.nut
-----------------
-./tests/data/a-flac.flac
-d5e0a6d87034c21627afb2a904412a21 first.nut
-----------------
-./tests/data/a-flashsv.flv
-985076a8a87df1f91b34cbb81ce96217 first.nut
-----------------
-./tests/data/a-flv.flv
-6d01a0eb07c15ec3d0a70bfad0615bec first.nut
-----------------
-./tests/data/a-g726.wav
-first.nut second.nut differ: char 34, line 1
-59540b44c97b8e1eafc53ebdaeaf3eb8 first.nut
-----------------
-./tests/data/a-h261.avi
-18d47cc50e05e5c855a8aec1a5d8d9ec first.nut
-----------------
-./tests/data/a-h263.avi
-91b67a478420a30cf10c3d872f7e799b first.nut
-----------------
-./tests/data/a-h263p.avi
-1e9f108181dca2dd3bb621bb45fc5834 first.nut
-----------------
-./tests/data/a-huffyuv.avi
-62dccc2a428b561c08497f8378ea1567 first.nut
-----------------
-./tests/data/a-jpegls.avi
-35f1bb0f9b14bf3eb29134784f278c4f first.nut
-----------------
-./tests/data/a-ljpeg.avi
-45ec1072d8e55d6cfa784cc732830f3c first.nut
-----------------
-./tests/data/a-mjpeg.avi
-4e6d42fdda880661de8308cfa45652ee first.nut
-----------------
-./tests/data/a-mp2.mp2
-6c8d1a33dd994d63c68e5c9953b5cb8c first.nut
-----------------
-./tests/data/a-mpeg1.mpg
-first.nut second.nut differ: char 34, line 1
-9d444c67713ef70c06d35fd355200ed5 first.nut
-----------------
-./tests/data/a-mpeg1b.mpg
-first.nut second.nut differ: char 34, line 1
-9d444c67713ef70c06d35fd355200ed5 first.nut
-----------------
-./tests/data/a-mpeg2.mpg
-first.nut second.nut differ: char 34, line 1
-328f6a0069b76397c5ed0dcea8b69b50 first.nut
-----------------
-./tests/data/a-mpeg2.mpg
-first.nut second.nut differ: char 34, line 1
-328f6a0069b76397c5ed0dcea8b69b50 first.nut
-----------------
-./tests/data/a-mpeg2_422.mpg
-first.nut second.nut differ: char 34, line 1
-d27035bcf30801cd1bee6ac59e8f5e3e first.nut
-----------------
-./tests/data/a-mpeg2i.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1 first.nut
-----------------
-./tests/data/a-mpeg2ivlc-qprd.mpg
-first.nut second.nut differ: char 34, line 1
-d910da52fa10eb1deca10fa9443132d2 first.nut
-----------------
-./tests/data/a-mpeg2reuse.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1 first.nut
-----------------
-./tests/data/a-mpeg2thread.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1 first.nut
-----------------
-./tests/data/a-mpeg2threadivlc.mpg
-first.nut second.nut differ: char 34, line 1
-c3351b79649825a6b9f62a2a1db633c1 first.nut
-----------------
-./tests/data/a-mpeg4-Q.avi
-first.nut second.nut differ: char 34, line 1
-305bab90451e2c3b741e3aef51bc2a4c first.nut
-----------------
-./tests/data/a-mpeg4-adap.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53 first.nut
-----------------
-./tests/data/a-mpeg4-adv.avi
-5d672bf4c2e879d6a20e349cb4dc09a6 first.nut
-----------------
-./tests/data/a-mpeg4-nr.avi
-0243b2e03115fe948f99da1ee10ae588 first.nut
-----------------
-./tests/data/a-mpeg4-qprd.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53 first.nut
-----------------
-./tests/data/a-mpeg4-rc.avi
-first.nut second.nut differ: char 34, line 1
-5d9315ec49c4122f6f23cf84cab5fc53 first.nut
-----------------
-./tests/data/a-mpeg4-thread.avi
-first.nut second.nut differ: char 34, line 1
-6aa94d589e9e7626e51575d8a2aec6e7 first.nut
-----------------
-./tests/data/a-msmpeg4.avi
-836d432509ff22fd363237ef1dced5f3 first.nut
-----------------
-./tests/data/a-msmpeg4v2.avi
-37f253da3666fb057edecb86ed2dba39 first.nut
-----------------
-./tests/data/a-odivx.mp4
-e3bd9d8a3417abc749c489e64119dbf3 first.nut
-----------------
-./tests/data/a-pcm_alaw.wav
-first.nut second.nut differ: char 34, line 1
-22853e7806b0f0162fd5e2573e34b03c first.nut
-----------------
-./tests/data/a-pcm_f32be.au
-first.nut second.nut differ: char 34, line 1
-94cb60c3107ec509af79191e86099a0e first.nut
-----------------
-./tests/data/a-pcm_f32le.wav
-first.nut second.nut differ: char 34, line 1
-8d887b27a8531390af5b682557631986 first.nut
-----------------
-./tests/data/a-pcm_f64be.au
-first.nut second.nut differ: char 34, line 1
-e0c7b64e13bb9398a57dac60806515fb first.nut
-----------------
-./tests/data/a-pcm_f64le.wav
-first.nut second.nut differ: char 34, line 1
-9dbb9bda0c990502e910e082a008433f first.nut
-----------------
-./tests/data/a-pcm_mulaw.wav
-first.nut second.nut differ: char 34, line 1
-78c4aae32fdddaba4f9caa5683018c94 first.nut
-----------------
-./tests/data/a-pcm_s16be.mkv
-first.nut second.nut differ: char 34, line 1
-279810a0c30a06c4ab7de154e3de140d first.nut
-----------------
-./tests/data/a-pcm_s16be.mov
-first.nut second.nut differ: char 42, line 1
-0a8ede3d121f17a98e9038771eb98e1a first.nut
-----------------
-./tests/data/a-pcm_s16le.mkv
-47942f5188f8d081bcbe7fb82550b135 first.nut
-----------------
-./tests/data/a-pcm_s16le.wav
-first.nut second.nut differ: char 34, line 1
-9f868acb99ba107750f165431f95c382 first.nut
-----------------
-./tests/data/a-pcm_s24be.mov
-first.nut second.nut differ: char 34, line 1
-9c96762f631851014dec14b506091cc1 first.nut
-----------------
-./tests/data/a-pcm_s24daud.302
-60ecb7037b205e2013490fdadab9697b first.nut
-----------------
-./tests/data/a-pcm_s24le.wav
-first.nut second.nut differ: char 34, line 1
-5805a2e6e2eddede4757fd488d0d6adb first.nut
-----------------
-./tests/data/a-pcm_s32be.mov
-first.nut second.nut differ: char 34, line 1
-d6c868a1130be573bbe0cfc88913a60c first.nut
-----------------
-./tests/data/a-pcm_s32le.wav
-first.nut second.nut differ: char 34, line 1
-3e0a81669647739c490f12521f897527 first.nut
-----------------
-./tests/data/a-pcm_s8.mov
-first.nut second.nut differ: char 34, line 1
-a6fe0827966ee4515f27c7053d579229 first.nut
-----------------
-./tests/data/a-pcm_u8.wav
-first.nut second.nut differ: char 34, line 1
-f0d398fd651cdedfd7b4c5433c08fd79 first.nut
-----------------
-./tests/data/a-pcm_zork.wav
-first.nut second.nut differ: char 34, line 1
-69e40cc9266836a7101000677ee14a87 first.nut
-----------------
-./tests/data/a-roqav.roq
-first.nut second.nut differ: char 34, line 1
-0e7a57bb28054b7e319eac2ba0a4be23 first.nut
-----------------
-./tests/data/a-rv10.rm
-first.nut second.nut differ: char 34, line 1
-80f982c6bffea91ff45a9b320cb93c14 first.nut
-----------------
-./tests/data/a-rv20.rm
-first.nut second.nut differ: char 34, line 1
-5b02113c0941578ca6918215eed8a728 first.nut
-----------------
-./tests/data/a-snow.avi
-e73b88690aa491491ede5970641134ad first.nut
-----------------
-./tests/data/a-snow53.avi
-18a6b061252c8c74bd22b42a7d5b2bae first.nut
-----------------
-./tests/data/a-svq1.mov
-first.nut second.nut differ: char 197, line 1
-6bbe90d47c1763654e8388ce51ab911e first.nut
-----------------
-./tests/data/a-wmav1.asf
-first.nut second.nut differ: char 34, line 1
-c3f7bc239ff166d738b29252b47bd437 first.nut
-----------------
-./tests/data/a-wmav2.asf
-first.nut second.nut differ: char 34, line 1
-930f1824b9677f0b6b714f1c6ddcf825 first.nut
-----------------
-./tests/data/a-wmv1.avi
-206bd9985b575f61a8a580656af39beb first.nut
-----------------
-./tests/data/a-wmv2.avi
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-bgr24.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-gray.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-monob.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-monow.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-rgb24.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-rgb32.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-rgb555.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-rgb565.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv410p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv411p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv420p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv422p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv440p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuv444p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuvj420p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuvj422p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuvj440p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuvj444p.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf-yuyv422.yuv
-09178a3c2b99d4f7ad1f7a761a2b803a first.nut
-----------------
-./tests/data/b-lavf.aif
-first.nut second.nut differ: char 34, line 1
-3f1d3faae1671f1cf862ddb66a5c59d1 first.nut
-----------------
-./tests/data/b-lavf.al
-e6d4b977e74a535b039a6a1dfed2dbc1 first.nut
-----------------
-./tests/data/b-lavf.asf
-first.nut second.nut differ: char 34, line 1
-57727c41b3974697c0a79cfd08515ddd first.nut
-----------------
-./tests/data/b-lavf.au
-first.nut second.nut differ: char 34, line 1
-1da12f41bc5ea1fd851e8a48b222c204 first.nut
-----------------
-./tests/data/b-lavf.avi
-a88edf9fb8e02e658ba3cae9313a3cdc first.nut
-----------------
-./tests/data/b-lavf.dv
-first.nut second.nut differ: char 34, line 1
-819018a5d91c55312ffe784e8712ac4b first.nut
-----------------
-./tests/data/b-lavf.ffm
-first.nut second.nut differ: char 34, line 1
-17f8894a05c71adb51c9a0ff1b9040bb first.nut
-----------------
-./tests/data/b-lavf.flv
-d74edb56e74e0eea748863f3aeeafa61 first.nut
-----------------
-./tests/data/b-lavf.gif
-first.nut second.nut differ: char 34, line 1
-ef9ba6bf88f44d9d326049ef2872a4d3 first.nut
-----------------
-./tests/data/b-lavf.gxf
-first.nut second.nut differ: char 44, line 1
-522957f46ba46051fd03a0868c905e54 first.nut
-----------------
-./tests/data/b-lavf.mkv
-8c9427bb75c96210d6580d9b881d9e4d first.nut
-----------------
-./tests/data/b-lavf.mmf
-first.nut second.nut differ: char 42, line 1
-298136aef02389fc5b0844995fe6ac72 first.nut
-----------------
-./tests/data/b-lavf.mov
-ce895b33ff206fafbae89fd5a8f959d2 first.nut
-----------------
-./tests/data/b-lavf.mpg
-d279e3343993267241c2fac4f4563cdb first.nut
-----------------
-./tests/data/b-lavf.mxf
-first.nut second.nut differ: char 34, line 1
-3e98a90d40986b8ea4305be06175927a first.nut
-----------------
-./tests/data/b-lavf.mxf_d10
-1ee69644165344a096ddfaaac951a0e9 first.nut
-----------------
-./tests/data/b-lavf.nut
-1426bca4c65796516a3e94b6bebc5a58 first.nut
-----------------
-./tests/data/b-lavf.ogg
-c986ce79045f2068ae1bedc2b8702884 first.nut
-----------------
-./tests/data/b-lavf.rm
-first.nut second.nut differ: char 34, line 1
-a3b2c9d3ec2c86b6d4c3bf0ed91391c3 first.nut
-----------------
-./tests/data/b-lavf.swf
-first.nut second.nut differ: char 34, line 1
-d4a5c5e6343dc17bed49397d889e0799 first.nut
-----------------
-./tests/data/b-lavf.ts
-40fd2ece0c8386d3a250943eab023795 first.nut
-----------------
-./tests/data/b-lavf.ul
-1c4c747e2e9c0fd195656359341eef76 first.nut
-----------------
-./tests/data/b-lavf.voc
-first.nut second.nut differ: char 42, line 1
-500ef42830c5bc2af849dbdcc4380f1b first.nut
-----------------
-./tests/data/b-lavf.wav
-first.nut second.nut differ: char 42, line 1
-8d4c6a79af442610ad912625c9b85d02 first.nut
-----------------
-./tests/data/b-lavf.y4m
-f42a6ff4488de306925b057ecee75b0e first.nut
-----------------
-./tests/data/b-lavf02.bmp
-first.nut second.nut differ: char 113, line 1
-02e3c782ef3a0c96e820201d4d4b8268 first.nut
-----------------
-./tests/data/b-lavf02.jpg
-61a19c3012a5aa056d8e9a589e29de2e first.nut
-----------------
-./tests/data/b-lavf02.pcx
-first.nut second.nut differ: char 113, line 1
-3c4e1b9c8d5dd2bedb8eebd1edc7a2f5 first.nut
-----------------
-./tests/data/b-lavf02.pgm
-first.nut second.nut differ: char 113, line 1
-cc36bdadd7aef501a6d5d588dec2188b first.nut
-----------------
-./tests/data/b-lavf02.ppm
-first.nut second.nut differ: char 113, line 1
-453ec690bea6c3668e2b65e0b7ad14c8 first.nut
-----------------
-./tests/data/b-lavf02.sgi
-first.nut second.nut differ: char 113, line 1
-6cdadd58aaa5ad196697352e96723e52 first.nut
-----------------
-./tests/data/b-lavf02.tga
-4144d2b4ee2948c1a16f7fc31b381be3 first.nut
-----------------
-./tests/data/b-lavf02.tiff
-first.nut second.nut differ: char 113, line 1
-237fa2da2d5f4930dae9825c9cf928a6 first.nut
-----------------
-./tests/data/b-pbmpipe.pbm
-first.nut second.nut differ: char 113, line 1
-2c65ef7188398da8a5f107b9dd5fb998 first.nut
-----------------
-./tests/data/b-pgmpipe.pgm
-first.nut second.nut differ: char 113, line 1
-b7e98248ada1e6f7170bc7fedee3825c first.nut
-----------------
-./tests/data/b-ppmpipe.ppm
-first.nut second.nut differ: char 113, line 1
-869fcefe430c35a9a8e46fd5f040b62e first.nut
diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 2c744b8..10497c4 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -123,6 +123,7 @@ if test -e "$ref"; then
diff) diff -u -w "$ref" "$outfile" >$cmpfile ;;
oneoff) oneoff "$ref" "$outfile" "$fuzz" >$cmpfile ;;
stddev) stddev "$ref" "$outfile" "$fuzz" >$cmpfile ;;
+ null) cat "$outfile" >$cmpfile ;;
esac
cmperr=$?
test $err = 0 && err=$cmperr
diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 6701e14..8c80557 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -2,10 +2,22 @@ FATE_AAC += fate-aac-al04_44
fate-aac-al04_44: CMD = pcm -i $(SAMPLES)/aac/al04_44.mp4
fate-aac-al04_44: REF = $(SAMPLES)/aac/al04_44.s16
+FATE_AAC += fate-aac-al05_44
+fate-aac-al05_44: CMD = pcm -i $(SAMPLES)/aac/al05_44.mp4
+fate-aac-al05_44: REF = $(SAMPLES)/aac/al05_44.s16
+
+FATE_AAC += fate-aac-al06_44
+fate-aac-al06_44: CMD = pcm -i $(SAMPLES)/aac/al06_44.mp4
+fate-aac-al06_44: REF = $(SAMPLES)/aac/al06_44.s16
+
FATE_AAC += fate-aac-al07_96
fate-aac-al07_96: CMD = pcm -i $(SAMPLES)/aac/al07_96.mp4
fate-aac-al07_96: REF = $(SAMPLES)/aac/al07_96.s16
+FATE_AAC += fate-aac-al17_44
+fate-aac-al17_44: CMD = pcm -i $(SAMPLES)/aac/al17_44.mp4
+fate-aac-al17_44: REF = $(SAMPLES)/aac/al17_44.s16
+
FATE_AAC += fate-aac-am00_88
fate-aac-am00_88: CMD = pcm -i $(SAMPLES)/aac/am00_88.mp4
fate-aac-am00_88: REF = $(SAMPLES)/aac/am00_88.s16
diff --git a/tests/fate/dct.mak b/tests/fate/dct.mak
new file mode 100644
index 0000000..8f2ab7a
--- /dev/null
+++ b/tests/fate/dct.mak
@@ -0,0 +1,5 @@
+FATE_TESTS += fate-idct8x8
+fate-idct8x8: libavcodec/dct-test$(EXESUF)
+fate-idct8x8: CMD = run libavcodec/dct-test -i
+fate-idct8x8: REF = /dev/null
+fate-idct8x8: CMP = null
diff --git a/tests/fate/fft.mak b/tests/fate/fft.mak
index 042a7bf..feb47af 100644
--- a/tests/fate/fft.mak
+++ b/tests/fate/fft.mak
@@ -1,28 +1,36 @@
-FATE_FFT = fate-fft fate-ifft \
- fate-mdct fate-imdct \
- fate-rdft fate-irdft \
- fate-dct1d fate-idct1d
-
-fate-fft: CMD = run libavcodec/fft-test
-fate-ifft: CMD = run libavcodec/fft-test -i
-fate-mdct: CMD = run libavcodec/fft-test -m
-fate-imdct: CMD = run libavcodec/fft-test -m -i
-fate-rdft: CMD = run libavcodec/fft-test -r
-fate-irdft: CMD = run libavcodec/fft-test -r -i
-fate-dct1d: CMD = run libavcodec/fft-test -d
-fate-idct1d: CMD = run libavcodec/fft-test -d -i
+define DEF_FFT
+FATE_FFT += fate-fft-$(1) fate-ifft-$(1) \
+ fate-mdct-$(1) fate-imdct-$(1) \
+ fate-rdft-$(1) fate-irdft-$(1) \
+ fate-dct1d-$(1) fate-idct1d-$(1)
+
+fate-fft-$(N): CMD = run libavcodec/fft-test -n$(1)
+fate-ifft-$(N): CMD = run libavcodec/fft-test -n$(1) -i
+fate-mdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m
+fate-imdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m -i
+fate-rdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r
+fate-irdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r -i
+fate-dct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d
+fate-idct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d -i
+endef
+
+$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT,$(N))))
fate-fft-test: $(FATE_FFT)
$(FATE_FFT): libavcodec/fft-test$(EXESUF)
$(FATE_FFT): REF = /dev/null
-FATE_FFT_FIXED = fate-fft-fixed fate-ifft-fixed \
- fate-mdct-fixed fate-imdct-fixed
+define DEF_FFT_FIXED
+FATE_FFT_FIXED += fate-fft-fixed-$(1) fate-ifft-fixed-$(1) \
+ fate-mdct-fixed-$(1) fate-imdct-fixed-$(1)
+
+fate-fft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1)
+fate-ifft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -i
+fate-mdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m
+fate-imdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m -i
+endef
-fate-fft-fixed: CMD = run libavcodec/fft-fixed-test
-fate-ifft-fixed: CMD = run libavcodec/fft-fixed-test -i
-fate-mdct-fixed: CMD = run libavcodec/fft-fixed-test -m
-fate-imdct-fixed: CMD = run libavcodec/fft-fixed-test -m -i
+$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT_FIXED,$(N))))
fate-fft-fixed-test: $(FATE_FFT_FIXED)
$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
new file mode 100644
index 0000000..4299f081
--- /dev/null
+++ b/tests/fate/libavutil.mak
@@ -0,0 +1,34 @@
+FATE_TESTS += fate-adler32
+fate-adler32: libavutil/adler32-test$(EXESUF)
+fate-adler32: CMD = run libavutil/adler32-test
+fate-adler32: REF = /dev/null
+
+FATE_TESTS += fate-aes
+fate-aes: libavutil/aes-test$(EXESUF)
+fate-aes: CMD = run libavutil/aes-test
+fate-aes: REF = /dev/null
+
+FATE_TESTS += fate-base64
+fate-base64: libavutil/base64-test$(EXESUF)
+fate-base64: CMD = run libavutil/base64-test
+
+FATE_TESTS += fate-crc
+fate-crc: libavutil/crc-test$(EXESUF)
+fate-crc: CMD = run libavutil/crc-test
+
+FATE_TESTS += fate-des
+fate-des: libavutil/des-test$(EXESUF)
+fate-des: CMD = run libavutil/des-test
+fate-des: REF = /dev/null
+
+FATE_TESTS += fate-eval
+fate-eval: libavutil/eval-test$(EXESUF)
+fate-eval: CMD = run libavutil/eval-test
+
+FATE_TESTS += fate-md5
+fate-md5: libavutil/md5-test$(EXESUF)
+fate-md5: CMD = run libavutil/md5-test
+
+FATE_TESTS += fate-sha
+fate-sha: libavutil/sha-test$(EXESUF)
+fate-sha: CMD = run libavutil/sha-test
diff --git a/tests/fate2.mak b/tests/fate2.mak
index b45efdd..c5b91e2 100644
--- a/tests/fate2.mak
+++ b/tests/fate2.mak
@@ -213,12 +213,12 @@ fate-mjpegb: CMD = framecrc -idct simple -flags +bitexact -i $(SAMPLES)/mjpegb/m
FATE_TESTS += fate-rv30
fate-rv30: CMD = framecrc -flags +bitexact -dct fastint -idct simple -i $(SAMPLES)/real/rv30.rm -an
-FATE_TESTS += fate-sha
-fate-sha: libavutil/sha-test$(EXESUF)
-fate-sha: CMD = run libavutil/sha-test
-
FATE_TESTS += fate-musepack7
fate-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc
fate-musepack7: CMP = oneoff
fate-musepack7: REF = $(SAMPLES)/musepack/inside-mp7.pcm
fate-musepack7: FUZZ = 1
+
+FATE_TESTS += fate-iirfilter
+fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)
+fate-iirfilter: CMD = run libavcodec/iirfilter-test
diff --git a/tests/ref/fate/base64 b/tests/ref/fate/base64
new file mode 100644
index 0000000..24fa9ad
--- /dev/null
+++ b/tests/ref/fate/base64
@@ -0,0 +1,9 @@
+Encoding/decoding tests
+Passed!
+Passed!
+Passed!
+Passed!
+Passed!
+Passed!
+Passed!
+Passed!
diff --git a/tests/ref/fate/crc b/tests/ref/fate/crc
new file mode 100644
index 0000000..4a82680
--- /dev/null
+++ b/tests/ref/fate/crc
@@ -0,0 +1,4 @@
+crc EDB88320 =3D5CDD04
+crc 04C11DB7 =E0BAF5C0
+crc 00008005 =BB1F
+crc 00000007 =E3
diff --git a/tests/ref/fate/eval b/tests/ref/fate/eval
new file mode 100644
index 0000000..3bc35db
--- /dev/null
+++ b/tests/ref/fate/eval
@@ -0,0 +1,164 @@
+Evaluating ''
+'' -> nan
+
+Evaluating '1;2'
+'1;2' -> 2.000000
+
+Evaluating '-20'
+'-20' -> -20.000000
+
+Evaluating '-PI'
+'-PI' -> -3.141593
+
+Evaluating '+PI'
+'+PI' -> 3.141593
+
+Evaluating '1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)'
+'1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)' -> 12.700000
+
+Evaluating '80G/80Gi'
+'80G/80Gi' -> 0.931323
+
+Evaluating '1k'
+'1k' -> 1000.000000
+
+Evaluating '1Gi'
+'1Gi' -> 1073741824.000000
+
+Evaluating '1gi'
+'1gi' -> nan
+
+Evaluating '1GiFoo'
+'1GiFoo' -> nan
+
+Evaluating '1k+1k'
+'1k+1k' -> 2000.000000
+
+Evaluating '1Gi*3foo'
+'1Gi*3foo' -> nan
+
+Evaluating 'foo'
+'foo' -> nan
+
+Evaluating 'foo('
+'foo(' -> nan
+
+Evaluating 'foo()'
+'foo()' -> nan
+
+Evaluating 'foo)'
+'foo)' -> nan
+
+Evaluating 'sin'
+'sin' -> nan
+
+Evaluating 'sin('
+'sin(' -> nan
+
+Evaluating 'sin()'
+'sin()' -> nan
+
+Evaluating 'sin)'
+'sin)' -> nan
+
+Evaluating 'sin 10'
+'sin 10' -> nan
+
+Evaluating 'sin(1,2,3)'
+'sin(1,2,3)' -> nan
+
+Evaluating 'sin(1 )'
+'sin(1 )' -> 0.841471
+
+Evaluating '1'
+'1' -> 1.000000
+
+Evaluating '1foo'
+'1foo' -> nan
+
+Evaluating 'bar + PI + E + 100f*2 + foo'
+'bar + PI + E + 100f*2 + foo' -> nan
+
+Evaluating '13k + 12f - foo(1, 2)'
+'13k + 12f - foo(1, 2)' -> nan
+
+Evaluating '1gi'
+'1gi' -> nan
+
+Evaluating '1Gi'
+'1Gi' -> 1073741824.000000
+
+Evaluating 'st(0, 123)'
+'st(0, 123)' -> 123.000000
+
+Evaluating 'st(1, 123); ld(1)'
+'st(1, 123); ld(1)' -> 123.000000
+
+Evaluating 'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)'
+'st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)' -> 4950.000000
+
+Evaluating 'st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)'
+'st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)' -> 144.000000
+
+Evaluating 'while(0, 10)'
+'while(0, 10)' -> nan
+
+Evaluating 'st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))'
+'st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))' -> 100.000000
+
+Evaluating 'isnan(1)'
+'isnan(1)' -> 0.000000
+
+Evaluating 'isnan(NAN)'
+'isnan(NAN)' -> 1.000000
+
+Evaluating 'floor(NAN)'
+'floor(NAN)' -> nan
+
+Evaluating 'floor(123.123)'
+'floor(123.123)' -> 123.000000
+
+Evaluating 'floor(-123.123)'
+'floor(-123.123)' -> -124.000000
+
+Evaluating 'trunc(123.123)'
+'trunc(123.123)' -> 123.000000
+
+Evaluating 'trunc(-123.123)'
+'trunc(-123.123)' -> -123.000000
+
+Evaluating 'ceil(123.123)'
+'ceil(123.123)' -> 124.000000
+
+Evaluating 'ceil(-123.123)'
+'ceil(-123.123)' -> -123.000000
+
+Evaluating 'sqrt(1764)'
+'sqrt(1764)' -> 42.000000
+
+Evaluating 'sqrt(-1)'
+'sqrt(-1)' -> nan
+
+Evaluating 'not(1)'
+'not(1)' -> 0.000000
+
+Evaluating 'not(NAN)'
+'not(NAN)' -> 0.000000
+
+Evaluating 'not(0)'
+'not(0)' -> 1.000000
+
+Evaluating 'pow(0,1.23)'
+'pow(0,1.23)' -> 0.000000
+
+Evaluating 'pow(PI,1.23)'
+'pow(PI,1.23)' -> 4.087844
+
+Evaluating 'PI^1.23'
+'PI^1.23' -> 4.087844
+
+Evaluating 'pow(-1,1.23)'
+'pow(-1,1.23)' -> nan
+
+12.700000 == 12.7
+0.931323 == 0.931322575
diff --git a/tests/ref/fate/iirfilter b/tests/ref/fate/iirfilter
new file mode 100644
index 0000000..2e5902d
--- /dev/null
+++ b/tests/ref/fate/iirfilter
@@ -0,0 +1,1024 @@
+ 0 0
+ 38 2
+ 151 15
+ 339 65
+ 603 182
+ 942 381
+ 1356 664
+ 1845 1021
+ 2409 1450
+ 3046 1953
+ 3755 2530
+ 4535 3182
+ 5384 3907
+ 6300 4700
+ 7278 5563
+ 8315 6491
+ 9405 7481
+ 10541 8529
+ 11717 9629
+ 12924 10773
+ 14151 11956
+ 15385 13167
+ 16615 14396
+ 17825 15630
+ 18997 16857
+ 20114 18060
+ 21156 19222
+ 22102 20325
+ 22929 21349
+ 23613 22273
+ 24132 23073
+ 24461 23726
+ 24575 24208
+ 24453 24495
+ 24073 24564
+ 23416 24392
+ 22467 23959
+ 21213 23245
+ 19649 22236
+ 17773 20922
+ 15590 19296
+ 13116 17360
+ 10371 15119
+ 7386 12591
+ 4201 9797
+ 867 6771
+ -2559 3554
+ -6008 199
+ -9405 -3235
+-12667 -6678
+-15707 -10053
+-18435 -13277
+-20762 -16261
+-22602 -18916
+-23875 -21153
+-24511 -22887
+-24457 -24040
+-23675 -24546
+-22151 -24352
+-19895 -23428
+-16946 -21762
+-13370 -19370
+ -9265 -16296
+ -4757 -12613
+ 0 -8423
+ 4831 -3858
+ 9544 923
+ 13934 5743
+ 17799 10406
+ 20942 14708
+ 23189 18447
+ 24395 21430
+ 24457 23488
+ 23323 24483
+ 21001 24321
+ 17563 22963
+ 13148 20426
+ 7959 16795
+ 2259 12223
+ -3643 6922
+ -9405 1166
+-14670 -4731
+-19092 -10421
+-22359 -15550
+-24213 -19777
+-24481 -22797
+-23087 -24368
+-20071 -24334
+-15590 -22639
+ -9924 -19343
+ -3457 -14629
+ 3345 -8793
+ 9959 -2236
+ 15851 4563
+ 20517 11078
+ 23528 16779
+ 24575 21171
+ 23506 23846
+ 20349 24522
+ 15327 23076
+ 8845 19572
+ 1469 14264
+ -6117 7589
+-13180 135
+-18997 -7403
+-22942 -14289
+-24553 -19814
+-23592 -23377
+-20092 -24551
+-14366 -23145
+ -6989 -19239
+ 1244 -13192
+ 9405 -5620
+ 16532 2656
+ 21744 10697
+ 24357 17548
+ 23978 22356
+ 20579 24483
+ 14518 23593
+ 6518 19723
+ -2409 13293
+-11083 5078
+-18310 -3876
+-23048 -12378
+-24568 -19252
+-22573 -23500
+-17270 -24458
+ -9370 -21908
+ 0 -16140
+ 9439 -7935
+ 17484 1526
+ 22832 10824
+ 24568 18508
+ 22327 23330
+ 16392 24452
+ 7673 21608
+ -2409 15181
+-12146 6168
+-19828 -3955
+-24050 -13466
+-23978 -20689
+-19535 -24292
+-11451 -23552
+ -1168 -18512
+ 9405 -10015
+ 18234 416
+ 23560 10836
+ 24257 19234
+ 20092 23929
+ 11817 23916
+ 1055 19105
+ -9993 10379
+-18997 -540
+-23986 -11413
+-23802 -19939
+-18385 -24246
+ -8845 -23318
+ 2746 -17260
+ 13778 -7325
+ 21691 4319
+ 24575 15045
+ 21656 22357
+ 13528 24482
+ 2071 20823
+ -9959 12152
+-19581 484
+-24331 -11367
+-22915 -20460
+-15590 -24459
+ -4164 -22257
+ 8421 -14315
+ 18828 -2603
+ 24213 9857
+ 23022 19756
+ 15474 24383
+ 3569 22388
+ -9405 14211
+-19761 2031
+-24471 -10785
+-22069 -20591
+-13148 -24512
+ -264 -21311
+ 12763 -11818
+ 21968 1241
+ 24457 13990
+ 19351 22545
+ 8137 24211
+ -5715 18362
+-17799 6720
+-24167 -7108
+-22646 -18722
+-13622 -24326
+ 0 -21995
+ 13685 -12382
+ 22762 1409
+ 24035 14788
+ 16946 23188
+ 3867 23644
+-10643 15884
+-21401 2514
+-24457 -11806
+-18584 -21960
+ -5825 -24220
+ 9160 -17649
+ 20762 -4546
+ 24527 10303
+ 18901 21343
+ 5935 24337
+ -9405 18028
+-21098 4727
+-24442 -10470
+-17979 -21608
+ -4201 -24206
+ 11351 -17110
+ 22280 -3064
+ 23970 12287
+ 15590 22636
+ 565 23615
+-14760 14693
+-23773 -479
+-22467 -15504
+-11284 -23907
+ 4942 -21954
+ 19021 -10373
+ 24575 5837
+ 18973 19502
+ 4646 24445
+-11883 18316
+-22929 3786
+-23226 -12541
+-12505 -23090
+ 4239 -22841
+ 18997 -11784
+ 24567 4932
+ 18107 19331
+ 2671 24403
+-14151 17558
+-23919 2036
+-21602 -14549
+ -8244 -23897
+ 9405 -21206
+ 22232 -7710
+ 23473 9785
+ 12342 22272
+ -5384 23186
+-20286 11920
+-24287 -5693
+-15090 -20319
+ 2409 -24060
+ 18633 -14771
+ 24538 2613
+ 16698 18608
+ -603 24329
+-17616 16471
+-24575 -682
+-17351 -17495
+ 0 -24355
+ 17404 -17211
+ 24575 -65
+ 17136 17163
+ -603 24334
+-18031 17094
+-24538 -374
+-16023 -17660
+ 2409 -24287
+ 19397 -16108
+ 24287 1992
+ 13872 18902
+ -5384 24066
+-21251 14131
+-23473 -4761
+-10473 -20664
+ 9405 -23351
+ 23151 -10967
+ 21602 8573
+ 5642 22543
+-14151 21682
+-24430 6431
+-18107 -13147
+ 641 -23920
+ 18997 -18514
+ 24207 -475
+ 12505 17922
+ -8030 23970
+-22929 13357
+-21511 -6625
+ -4646 -21972
+ 15619 -21758
+ 24575 -6009
+ 15561 14083
+ -4942 24019
+-21831 16485
+-22467 -3138
+ -6227 -20474
+ 14760 -22641
+ 24569 -7904
+ 15590 12791
+ -5421 23839
+-22280 16760
+-21797 -3160
+ -4201 -20666
+ 16754 -22169
+ 24442 -6381
+ 12602 14430
+ -9405 23865
+-23848 14348
+-18901 -6644
+ 1545 -22308
+ 20762 -19937
+ 22804 -1339
+ 5825 18365
+-16080 22954
+-24457 8529
+-12080 -13009
+ 10643 -23650
+ 24269 -14353
+ 16946 7119
+ -5127 22521
+-22762 18602
+-20413 -1370
+ 0 -20152
+ 20454 -21342
+ 22646 -3797
+ 4461 17096
+-17799 22804
+-23902 8148
+ -8137 -13817
+ 15149 -23296
+ 24457 -11618
+ 11016 10660
+-12763 23135
+-24574 14243
+-13148 -7861
+ 10813 -22608
+ 24471 -16124
+ 14609 5565
+ -9405 21949
+-24315 17379
+-15474 -3849
+ 8598 -21336
+ 24213 -18120
+ 15793 2745
+ -8421 20885
+-24220 18429
+-15590 -2263
+ 8880 -20663
+ 24331 -18359
+ 14851 2398
+ -9959 20685
+-24488 17917
+-13528 -3137
+ 11618 -20918
+ 24575 -17075
+ 11551 4460
+-13778 21286
+-24421 15770
+ -8845 -6328
+ 16307 -21661
+ 23802 -13916
+ 5348 8671
+-18997 21868
+-22452 11421
+ -1055 -11371
+ 21548 -21685
+ 20092 -8212
+ -3941 14242
+-23560 20853
+-16476 4267
+ 9405 -17009
+ 24547 -19106
+ 11451 343
+-14911 19309
+-23978 16208
+ -5053 -5409
+ 19828 -20699
+ 21364 -12016
+ -2409 10553
+-23347 20700
+-16392 6559
+ 10268 -15211
+ 24568 -18879
+ 9090 -118
+-17484 18664
+-22690 14969
+ 0 -6714
+ 22719 -20134
+ 17270 -9014
+ -9717 13022
+-24568 18943
+ -8527 1506
+ 18310 -17662
+ 21934 -14749
+ -2409 6538
+-23695 19463
+-14518 7789
+ 13433 -13633
+ 23978 -17566
+ 3270 935
+-21744 18075
+-18184 11812
+ 9405 -9654
+ 24544 -18394
+ 6989 -3082
+-19939 16117
+-20092 13945
+ 6881 -6613
+ 24553 -18196
+ 8809 -5437
+-18997 14458
+-20742 14731
+ 6117 -4859
+ 24531 -17657
+ 8845 -6307
+-19210 13526
+-20349 14588
+ 7170 -4444
+ 24575 -17109
+ 7098 -5874
+-20517 13412
+-18780 13691
+ 9959 -5272
+ 24347 -16558
+ 3457 -4241
+-22482 13949
+-15590 11979
+ 14181 -7142
+ 23087 -15723
+ -2146 -1459
+-24213 14726
+-10200 9228
+ 19092 -9692
+ 19717 -14108
+ -9405 2343
+-24304 15085
+ -2259 5221
+ 23251 -12286
+ 13148 -11127
+-17190 6746
+-21001 14161
+ 7745 2
+ 24457 -13938
+ 2971 -6372
+-23189 10842
+-12860 11094
+ 17799 -5795
+ 20243 -13421
+ -9544 -30
+-24096 13184
+ 0 5498
+ 24110 -10713
+ 9265 -9718
+-20620 6673
+-16946 12155
+ 14427 -1883
+ 22151 -12653
+ -6591 -2861
+-24457 11378
+ -1770 6908
+ 23875 -8726
+ 9648 -9817
+-20762 5209
+-16251 11385
+ 15707 -1358
+ 21059 -11610
+ -9405 -2353
+-23830 10656
+ 2559 5560
+ 24560 -8789
+ 4201 -8028
+-23439 6314
+-10371 9643
+ 20783 -3542
+ 15590 -10404
+-16973 742
+-19649 10386
+ 12407 1870
+ 22467 -9720
+ -7458 -4144
+-24073 8562
+ 2446 5991
+ 24575 -7072
+ 2371 -7375
+-24132 5398
+ -6808 8306
+ 22929 -3667
+ 10745 -8824
+-21156 1980
+-14120 8987
+ 18997 -408
+ 16918 -8863
+-16615 -1001
+-19163 8521
+ 14151 2220
+ 20902 -8027
+-11717 -3241
+-22200 7441
+ 9405 4071
+ 23126 -6811
+ -7278 -4722
+-23754 6177
+ 5384 5213
+ 24153 -5571
+ -3755 -5566
+-24386 5013
+ 2409 5801
+ 24506 -4521
+ -1356 -5939
+-24557 4104
+ 603 5999
+ 24573 -3765
+ -151 -5994
+-24575 3508
+ 0 5937
+ 24575 -3331
+ -151 -5835
+-24573 3232
+ 603 5694
+ 24557 -3205
+ -1356 -5517
+-24506 3244
+ 2409 5303
+ 24386 -3343
+ -3755 -5049
+-24153 3494
+ 5384 4752
+ 23754 -3685
+ -7278 -4407
+-23126 3906
+ 9405 4007
+ 22200 -4143
+-11717 -3547
+-20902 4380
+ 14151 3025
+ 19163 -4598
+-16615 -2434
+-16918 4778
+ 18997 1780
+ 14120 -4898
+-21156 -1066
+-10745 4934
+ 22929 304
+ 6808 -4862
+-24132 489
+ -2371 4664
+ 24575 -1288
+ -2446 -4320
+-24073 2060
+ 7458 3820
+ 22467 -2767
+-12407 -3162
+-19649 3365
+ 16973 2357
+ 15590 -3808
+-20783 -1429
+-10371 4050
+ 23439 419
+ 4201 -4055
+-24560 616
+ 2559 3795
+ 23830 -1607
+ -9405 -3266
+-21059 2473
+ 15707 2486
+ 16251 -3130
+-20762 -1499
+ -9648 3505
+ 23875 386
+ 1770 -3539
+-24457 754
+ 6591 3205
+ 22151 -1798
+-14427 -2518
+-16946 2618
+ 20620 1540
+ 9265 -3101
+-24110 -381
+ 0 3162
+ 24096 -809
+ -9544 -2775
+-20243 1859
+ 17799 1978
+ 12860 -2598
+-23189 -879
+ -2971 2893
+ 24457 -344
+ -7745 -2674
+-21001 1478
+ 17190 1966
+ 13148 -2304
+-23251 -890
+ -2259 2647
+ 24304 -341
+ -9405 -2421
+-19717 1467
+ 19092 1662
+ 10200 -2229
+-24213 -535
+ 2146 2434
+ 23087 -692
+-14181 -2022
+-15590 1706
+ 22482 1090
+ 3457 -2230
+-24347 115
+ 9959 2111
+ 18780 -1251
+-20517 -1374
+ -7098 1975
+ 24575 238
+ -7170 -2057
+-20349 938
+ 19210 1464
+ 8845 -1763
+-24531 -392
+ 6117 1949
+ 20742 -783
+-18997 -1425
+ -8809 1630
+ 24553 385
+ -6881 -1825
+-20092 770
+ 19939 1291
+ 6989 -1572
+-24544 -244
+ 9405 1688
+ 18184 -869
+-21744 -1069
+ -3270 1559
+ 23978 -7
+-13433 -1511
+-14518 1041
+ 23695 753
+ -2409 -1536
+-21934 344
+ 18310 1251
+ 8527 -1225
+-24568 -337
+ 9717 1436
+ 17270 -719
+-22719 -869
+ 0 1342
+ 22690 -157
+-17484 -1188
+ -9090 1051
+ 24568 353
+-10268 -1293
+-16392 658
+ 23347 745
+ -2409 -1224
+-21364 244
+ 19828 996
+ 5053 -1036
+-23978 -132
+ 14911 1114
+ 11451 -783
+-24547 -437
+ 9405 1124
+ 16476 -513
+-23560 -661
+ 3941 1058
+ 20092 -257
+-21548 -807
+ -1055 945
+ 22452 -37
+-18997 -887
+ -5348 815
+ 23802 142
+-16307 -917
+ -8845 682
+ 24421 276
+-13778 -913
+-11551 563
+ 24575 371
+-11618 -888
+-13528 463
+ 24488 431
+ -9959 -854
+-14851 386
+ 24331 462
+ -8880 -815
+-15590 333
+ 24220 471
+ -8421 -779
+-15793 302
+ 24213 460
+ -8598 -746
+-15474 292
+ 24315 433
+ -9405 -717
+-14609 300
+ 24471 391
+-10813 -689
+-13148 324
+ 24574 336
+-12763 -660
+-11016 359
+ 24457 267
+-15149 -627
+ -8137 400
+ 23902 184
+-17799 -584
+ -4461 444
+ 22646 90
+-20454 -527
+ 0 483
+ 20413 -15
+-22762 -452
+ 5127 511
+ 16946 -124
+-24269 -357
+ 10643 517
+ 12080 -232
+-24457 -241
+ 16080 495
+ 5825 -328
+-22804 -107
+ 20762 440
+ -1545 -400
+-18901 35
+ 23848 347
+ -9405 -437
+-12602 173
+ 24442 220
+-16754 -426
+ -4201 290
+ 21797 69
+-22280 -362
+ 5421 366
+ 15590 -89
+-24569 -247
+ 14760 384
+ 6227 -228
+-22467 -95
+ 21831 335
+ -4942 -321
+-15561 71
+ 24575 222
+-15619 -344
+ -4646 214
+ 21511 65
+-22929 -288
+ 8030 300
+ 12505 -102
+-24207 -162
+ 18997 304
+ -641 -232
+-18107 4
+ 24430 218
+-14151 -286
+ -5642 160
+ 21602 68
+-23151 -244
+ 9405 253
+ 10473 -97
+-23473 -115
+ 21251 247
+ -5384 -216
+-13872 49
+ 24287 142
+-19397 -238
+ 2409 183
+ 16023 -17
+-24538 -153
+ 18031 224
+ -603 -158
+-17136 0
+ 24575 153
+-17404 -209
+ 0 142
+ 17351 6
+-24575 -144
+ 17616 196
+ -603 -133
+-16698 -1
+ 24538 131
+-18633 -182
+ 2409 132
+ 15090 -11
+-24287 -111
+ 20286 169
+ -5384 -134
+-12342 30
+ 23473 86
+-22232 -152
+ 9405 138
+ 8244 -53
+-21602 -56
+ 23919 132
+-14151 -138
+ -2671 76
+ 18107 21
+-24567 -104
+ 18997 134
+ -4239 -98
+-12505 16
+ 23226 69
+-22929 -119
+ 11883 111
+ 4646 -53
+-18973 -28
+ 24575 92
+-19021 -113
+ 4942 82
+ 11284 -16
+-22467 -54
+ 23773 97
+-14760 -97
+ -565 56
+ 15590 8
+-23970 -65
+ 22280 93
+-11351 -82
+ -4201 37
+ 17979 21
+-24442 -67
+ 21098 85
+ -9405 -69
+ -5935 26
+ 18901 24
+-24527 -64
+ 20762 77
+ -9160 -61
+ -5825 23
+ 18584 21
+-24457 -56
+ 21401 69
+-10643 -57
+ -3867 25
+ 16946 15
+-24035 -47
+ 22762 62
+-13685 -55
+ 0 29
+ 13622 4
+-22646 -35
+ 24167 53
+-17799 -52
+ 5715 36
+ 8137 -8
+-19351 -21
+ 24457 41
+-21968 -49
+ 12763 41
+ 264 -21
+-13148 -4
+ 22069 27
+-24471 -40
+ 19761 42
+ -9405 -31
+ -3569 12
+ 15474 9
+-23022 -27
+ 24213 36
+-18828 -35
+ 8421 25
+ 4164 -9
+-15590 -9
+ 22915 23
+-24331 -31
+ 19581 31
+ -9959 -23
+ -2071 10
+ 13528 5
+-21656 -18
+ 24575 26
+-21691 -27
+ 13778 22
+ -2746 -12
+ -8845 0
+ 18385 11
+-23802 -20
+ 23986 23
+-18997 -22
+ 9993 15
+ 1055 -7
+-11817 -3
+ 20092 11
+-24257 -17
+ 23560 19
+-18234 -17
+ 9405 12
+ 1168 -5
+-11451 -3
+ 19535 10
+-23978 -14
+ 24050 16
+-19828 -14
+ 12146 11
+ -2409 -5
+ -7673 0
+ 16392 6
+-22327 -10
+ 24568 12
+-22832 -12
+ 17484 11
+ -9439 -7
+ 0 3
+ 9370 2
+-17270 -5
+ 22573 8
+-24568 -9
+ 23048 10
+-18310 -8
+ 11083 5
+ -2409 -3
+ -6518 -1
+ 14518 3
+-20579 -5
+ 23978 7
+-24357 -7
+ 21744 7
+-16532 -6
+ 9405 3
+ -1244 -1
+ -6989 -1
+ 14366 3
+-20092 -4
+ 23592 5
+-24553 -5
+ 22942 5
+-18997 -4
+ 13180 3
+ -6117 -2
+ -1469 1
+ 8845 2
+-15327 -2
+ 20349 3
+-23506 -4
+ 24575 3
+-23528 -4
+ 20517 3
+-15851 -2
+ 9959 1
+ -3345 0
+ -3457 0
+ 9924 1
+-15590 -2
+ 20071 2
+-23087 -2
+ 24481 3
+-24213 -2
+ 22359 2
+-19092 -1
+ 14670 1
+ -9405 0
+ 3643 0
+ 2259 0
+ -7959 -1
+ 13148 1
+-17563 -1
+ 21001 1
+-23323 -1
+ 24457 1
+-24395 -1
+ 23189 1
+-20942 -1
+ 17799 1
+-13934 0
+ 9544 0
+ -4831 0
+ 0 0
+ 4757 1
+ -9265 0
+ 13370 0
+-16946 -1
+ 19895 0
+-22151 -1
+ 23675 0
+-24457 -1
+ 24511 0
+-23875 0
+ 22602 0
+-20762 0
+ 18435 0
+-15707 0
+ 12667 0
+ -9405 0
+ 6008 0
+ -2559 0
+ -867 0
+ 4201 0
+ -7386 0
+ 10371 0
+-13116 0
+ 15590 0
+-17773 0
+ 19649 0
+-21213 0
+ 22467 0
+-23416 0
+ 24073 0
+-24453 0
+ 24575 0
+-24461 0
+ 24132 0
+-23613 0
+ 22929 0
+-22102 0
+ 21156 0
+-20114 0
+ 18997 0
+-17825 0
+ 16615 0
+-15385 0
+ 14151 0
+-12924 0
+ 11717 0
+-10541 0
+ 9405 0
+ -8315 0
+ 7278 0
+ -6300 0
+ 5384 0
+ -4535 0
+ 3755 0
+ -3046 0
+ 2409 0
+ -1845 0
+ 1356 0
+ -942 0
+ 603 0
+ -339 0
+ 151 0
+ -38 0
diff --git a/tests/ref/fate/md5 b/tests/ref/fate/md5
new file mode 100644
index 0000000..af08a84
--- /dev/null
+++ b/tests/ref/fate/md5
@@ -0,0 +1,5 @@
+0bf1bcc8a1d72e2cf58d42182b637e56
+993a3eb298e52aca83ecfbb6a766b4d0
+07c01ca7c733475fad38c84c56f305c1
+9fc8404827cac26385f48f4f58fd32ce
+a22bfef14302c5ca46e0ae91092bc0e0
diff --git a/tests/ref/lavf/ffm b/tests/ref/lavf/ffm
index b89af6e..b20e132 100644
--- a/tests/ref/lavf/ffm
+++ b/tests/ref/lavf/ffm
@@ -1,3 +1,3 @@
-b6acf782a38d313153b68c4ca204fc90 *./tests/data/lavf/lavf.ffm
+f9bee27ea1b6b83a06b5f9efb0a4ac1f *./tests/data/lavf/lavf.ffm
376832 ./tests/data/lavf/lavf.ffm
./tests/data/lavf/lavf.ffm CRC=0xf361ed74
diff --git a/tests/ref/lavf/gif b/tests/ref/lavf/gif
index fa55d0e..4a4ebfb 100644
--- a/tests/ref/lavf/gif
+++ b/tests/ref/lavf/gif
@@ -1,3 +1,3 @@
-98968ceb210ab260a6a7af36767b94d3 *./tests/data/lavf/lavf.gif
-2906382 ./tests/data/lavf/lavf.gif
+e6089fd4ef3b9df44090ab3650bdd810 *./tests/data/lavf/lavf.gif
+2906401 ./tests/data/lavf/lavf.gif
./tests/data/lavf/lavf.gif CRC=0xe5605ff6
diff --git a/tests/ref/seek/lavf_gif b/tests/ref/seek/lavf_gif
index 5da803d..883f187 100644
--- a/tests/ref/seek/lavf_gif
+++ b/tests/ref/seek/lavf_gif
@@ -1,4 +1,4 @@
-ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:2906382
+ret: 0 st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos: -1 size:2906401
ret:-EINVAL st:-1 flags:0 ts:-1.000000
ret:-EINVAL st:-1 flags:1 ts: 1.894167
ret:-EINVAL st: 0 flags:0 ts: 0.800000
diff --git a/tests/seek_test.c b/tests/seek_test.c
index 81a7821..76a3e8c 100644
--- a/tests/seek_test.c
+++ b/tests/seek_test.c
@@ -25,6 +25,7 @@
#include <string.h>
#include "libavutil/common.h"
+#include "libavutil/mathematics.h"
#include "libavformat/avformat.h"
#undef exit
OpenPOWER on IntegriCloud