Make av_get_profile_name() return NULL if no profile is detected.
Fix trac issue #130, fix crash reading file tek3.m2v.
(cherry picked from commit e5d80c7b2d)
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* qatar/master:
vorbisdec: Rename silly "class_" variable to plain "class".
simple_idct_alpha: Drop some useless casts.
Simplify av_log_missing_feature().
ac3enc: remove check for mismatching channels and channel_layout
If AVCodecContext.channels is 0 and AVCodecContext.channel_layout is non-zero, set channels based on channel_layout.
If AVCodecContext.channel_layout and AVCodecContext.channels are both non-zero, check to make sure they do not contradict eachother.
cosmetics: indentation
Check AVCodec.supported_samplerates and AVCodec.channel_layouts in avcodec_open().
aacdec: remove sf_scale and sf_offset.
aacdec: use a scale of 2 in the LTP MDCT rather than doubling the coefficient table values from the spec.
Define POW_SF2_ZERO in aac.h and use for ff_aac_pow2sf_tabp[] offsets instead of hardcoding 200 everywhere.
Large intensity stereo and PNS indices are legal. Clip them instead of erroring out. A magnitude of 100 corresponds to 2^25 so the will most likely result in clipped output anyway.
qpeg: use reget_buffer() in decode_frame()
ultimotion: use reget_buffer() in ulti_decode_frame()
smacker: remove unnecessary call to avctx->release_buffer in decode_frame()
avparser: don't av_malloc(0).
Merged-by: Michael Niedermayer <michaelni@gmx.at>
avcodec_open().
If the encoder has a channel_layouts list and AVCodecContext.channel_layout
is 0, then only print a warning and let the encoder decide how to handle it.
Instead, scalefactors are adjusted by the offset amount, removing the need
for sf_scale, and the MDCT scales are adjusted to compensate for the higher
scalefactors. Floating-point output will be handled by modifying the MDCT
scales.
erroring out. A magnitude of 100 corresponds to 2^25 so the will most
likely result in clipped output anyway.
None of the conformance streams fall in the range that need to be clipped.
Decoder relies on previous frame data, so use reget_buffer().
This also set frame->reference to 3, as the frame will be requested
unmodified later so it shouldn't be modified by the application.
Fix playback of file Clock.avi.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
The release_buffer was cleaning the provided frame, thus causing the
successive call to avctx->reget_buffer() to allocate a new frame. In
case the returned frame was not the same one previously returned but a
new one with different data, it resulted in artifacts.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Also remove unnecessary call to avctx->release_buffer(). reget_buffer
is required since apparently the codec needs to be feeded with the
previous frame data.
Releasing the frame and using get_buffer was working only in the case
get_buffer() was returning the old frame data, and resulting in
playback artifacts otherwise.
Fix trac issue #85.
Store palette data in the codec context, do not assume that the frame
allocated the first time by avctx->get_buffer will be returned again.
This requires to store the palette which comes with the first frame in
the context, and copy it to the following frames.
Fix trac issue #84.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Also deprecate av_get_pict_type_char() in favor of
av_get_picture_type_char().
The new enum and av_get_picture_type_char() are defined in libavutil.
This allows the use in libavfilter without the need to link against
libavcodec.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
* qatar/master:
graphparser: add a NULL check on the argument passed to strstr
setdar: prefer "sar" over "par" in log info message
fade: fix draw_slice() check on fade->factor value
fade: make draw_slice() chroma check against planes 1 and 2
win32: include the correct header in cmdutils.c
ac3: fix memleak in fixed-point encoder
flashsv: Return more meaningful error values.
flashsv: Employ explicit AVCodec struct initializers.
read AVI palette from the end of extradata
cosmetics: K&R coding style and more whitespace for Flash Screen Video
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This is required for setting up the filterchain, as it requires the
pixel format to be set, which is usually done when probing the file
with av_find_stream_info().
Fix trac issue #83.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
* qatar/master:
vorbisdec: Employ proper printf format specifiers for uint_fast32_t.
applehttp: Don't export variant_bitrate if it isn't known
crypto: Use av_freep instead of av_free
configure: Add missing libm library dependencies to .pc files.
oggdec: reindent after 8f3eebd6
configure: Add missing libavutil inter-library dependencies to .pc files.
Conflicts:
configure
Merged-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vorbisdec.c:543: warning: format ‘%d’ expects type ‘int’, but argument 4 has type ‘uint_fast32_t’
libavcodec/vorbisdec.c:543: warning: format ‘%d’ expects type ‘int’, but argument 5 has type ‘uint_fast32_t’
The CrystalHD hardware can do scaling, which is particularly
desirable when dealing with some high resolution clips that take
so long to decode and copy out that they end up playing back
slower than realtime. By using scaling, we can make the output
frames smaller and reduce the copy out time.
This option takes the desired horizontal width in pixels, and
the hardware will do an aspect-scale. Upscaling is not supported
and the hardware will simply ignore any request to do so.
Signed-off-by: Philip Langdale <philipl@overt.org>
* qatar/master:
Handle unicode file names on windows
rtp: Rename the open/close functions to alloc/free
Lowercase all ff* program names.
Refer to ff* tools by their lowercase names.
NOT Pulled Replace more FFmpeg instances by Libav or ffmpeg.
Replace `` by $() syntax in shell scripts.
patcheck: Allow overiding grep program(s) through environment variables.
NOT Pulled Remove stray libavcore and _g binary references.
vorbis: Rename decoder/encoder files to follow general file naming scheme.
aacenc: Fix whitespace after last commit.
cook: Fix small typo in av_log_ask_for_sample message.
aacenc: Finish 3GPP psymodel analysis for non mid/side cases.
Remove RDFT dependency from AAC decoder.
Add some debug log messages to AAC extradata
Fix mov debug (u)int64_t format strings.
bswap: use native types for av_bwap16().
doc: FLV muxing is supported.
applehttp: Handle AES-128 encrypted streams
Add a protocol handler for AES CBC decryption with PKCS7 padding
doc: Mention that DragonFly BSD requires __BSD_VISIBLE set
Conflicts:
ffplay.c
ffprobe.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Add a check in flic_decode_frame_8BPP(), in case chunk_size is >
frame_size issue a warning and resize chunk_size to frame_size, in
order to avoid out-of-buffer reads.
Fix roundup issue #2520, trac issue #69.
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
There is still are still a few sections missing relating to TNS (not present)
and mid/side (contains other bugs).
Overall this improves quality, and vastly improves rate-control.
Signed-off-by: Martin Storsjö <martin@martin.st>
* qatar/master:
Use av_log_ask_for_sample() to request samples from users.
Make av_log_ask_for_sample() accept a variable number of arguments.
vqavideo: We no longer need to ask for version 1 samples.
aacdec: indentation cosmetics
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
APIChanges: document git revision for CODEC_CAP_SLICE_THREADS addition.
Introduce slice threads flag.
FATE: allow forcing thread-type when doing threaded fate runs.
Use av_log_ask_for_sample() where appropriate.
error: sort, pack, and align error code and string definitions
The stabilization period after version bumps should be one month, not one week.
applehttp: Expose the stream bitrate via metadata
doc: Add some initial docs on the applehttp demuxer
Provide a fallback version of the libm function trunc
libavdevice: Define _XOPEN_SOURCE for usleep
lavc: provide deprecated avcodec_thread_init until next major version
lavc: provide the opt.h header until the next bump
error: change AVERROR_EOF value
error: remove AVERROR_NUMEXPECTED
error: add error code AVERROR_OPTION_NOT_FOUND, and use it in opt.c
Conflicts:
libavcodec/h264.c
libavutil/error.c
libavutil/error.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master: (37 commits)
In avcodec_open(), set return code to an error value only when an error occurs instead of unconditionally at the start of the function.
lavc: remove reference to opt.h from Makefile.
prefer avio_check() over url_exist()
avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
lavu: remove misc disabled cruft
lavu: remove FF_API_OLD_IMAGE_NAMES cruft
NOT PULLED lavu: remove FF_API_OLD_EVAL_NAMES cruft
lavc: remove misc disabled cruft.
lavc: remove the FF_API_INOFFICIAL cruft.
lavc: remove the FF_API_SET_STRING_OLD cruft.
lavc: remove the FF_API_USE_LPC cruft.
lavc: remove the FF_API_SUBTITLE_OLD cruft.
lavc: remove the FF_API_VIDEO_OLD cruft.
lavc: remove the FF_API_AUDIO_OLD cruft.
lavc: remove the FF_API_OPT_SHOW cruft.
lavc: remove the FF_API_MM_FLAGS cruft.
lavf: remove misc disabled cruft.
lavf: remove FF_API_INDEX_BUILT cruft
lavf: remove FF_API_URL_CLASS cruft.
lavf: remove FF_API_SYMVER cruft
...
Merged-by: Michael Niedermayer <michaelni@gmx.at>
instead of unconditionally at the start of the function.
This fixes a bug where a successful call to ff_thread_init() masks errors that
occur after that point in the function. It also makes future bugs like this
less likely since the error code is now set near to the point in the code
where the error is found.
* commit 'f0a41afd8a37ebe972436fabfa3d289178bbd83b':
Not pulled: Replace mplayerhq.hu URLs by libav.org.
asfdec: Remove dead code from asf_read_close().
ptx: Use av_log_ask_for_sample() where appropriate.
Conflicts:
libavcodec/utils.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* ffmpeg-mt/master:
Release unused pictures even when not calling ff_h264_frame_start()
h264: Fix decoding race condition with PAFF
h264: cosmetic whitespace change
Duplicate Fix REBASE_PICTURE with h.264
Not pulled Update test scripts to use ffmpeg instead of ffmpeg_g
Duplicate Fix ffmpeg-mt fixme in h264
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
ac3dec: fix processing of delta bit allocation information.
vc1: fix fate-vc1 after previous commit.
wmv3dec: fix playback of complex WMV3 files using simple_idct.
make av_dup_packet() more cautious on allocation failures
make containers pass palette change in AVPacket
introduce side information for AVPacket
Politic commits that have not been pulled:
Update regtest checksums after revision 6001dad.
Replace more FFmpeg references by Libav.
Replace references to ffmpeg-devel with libav-devel; fix roundup URL.
Merged-by: Michael Niedermayer <michaelni@gmx.at>
PROFILE_ADVANCED doesn't set res_fasttx, so make that a special case
in the condition that decides which IDCT to use (and whether to read
coefficients transposed or not).
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
There is no need to have 2 encoders, the input sample format can,does and should choose which is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
IDCT coefficients are read transposed, but simple_idct does not expect
this. Therefore, only do tranposed coefficient reading if we're not
using simple_idct.
Fixes http://forum.videolan.org/viewtopic.php?f=14&t=89651
I was using the wrong value to track the position of the parser in the
stream. For an error-free stream, the size of the frame and number of
bytes consumed will be the same, but in an error situation they can
diverge.
Signed-off-by: Philip Langdale <philipl@overt.org>
The warning is printed with loglevel error because the output
stream is known to be broken.
Also warn if no channel layout was provided for multichannel input.
* commit 'a3a0af4fb1237bed0af75868073f9a63db8b1864':
avutil: make aes and sha api public
handle malloc failures in ff_get_wav_header
add xWMA demuxer
mpegts: force the default timebase
libavcodec: Bump micro after adding the dtx AVOptions
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master: (32 commits)
libopencore-amr, libvo-amrwbenc: Allow enabling DTX via private AVOptions
libopencore-amr, libvo-amrwbenc: Only check the bitrate when changed
libopencore-amr, libvo-amrwbenc: Find the closest matching bitrate
libvo-*: Fix up the long codec names
libavcodec: Mark AVCodec->priv_class const
swscale: Factorize FAST_BGR2YV12 definition.
libvo-aacenc: Only produce extradata if the global header flag is set
lavf: postpone removal of public metadata conversion API
lavc: postpone removal of request_channels
lavc: postpone removal of audioconvert and sample_fmt wrappers
lavf: postpone removal of deprecated avio functions
libopencore-amr: Cosmetics: Rewrap and align
libopencore-amr, libvo-amrbwenc: Rename variables and functions
libopencore-amr: Convert commented out debug logging into av_dlog
libopencore-amr: Remove an unused state variable
libvo-amrwbenc: Don't explicitly store bitrate modes in the bitrate table
libopencore-amr: Remove a useless local variable
libopencore-amr, libvo-amrwbenc: Make the bitrate/mode mapping array static const
libopencore-amr, libvo-amrwbenc: Return proper error codes in most places
libopencore-amr: Don't print carriage returns in log messages
...
Conflicts:
doc/developer.texi
libavcodec/avcodec.h
libavcodec/libvo-aacenc.c
libavcodec/libvo-amrwbenc.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
DTX, discontinuous transmission, allows emitting frames with
comfort noise when no voice is detected in the input audio.
Signed-off-by: Martin Storsjö <martin@martin.st>
Also rename the incorrectly named enc_bitrate to enc_mode, use the
enc_bitrate variable for storing the last chosen bitrate.
This avoids continuous warning log messages if not using an
exactly matching bitrate, while still allowing changing bitrate
at any point.
Signed-off-by: Martin Storsjö <martin@martin.st>
Dynamically print the supported bitrates from the local table,
instead of using a hardcoded log message.
Signed-off-by: Martin Storsjö <martin@martin.st>
Include VisualOn to clarify the codec name, but remove the
actual library name from the user-friendly description.
Also mention Android, to clarify which VisualOn implementation
this refers to, since they do sell other variants of the same
code, too.
Signed-off-by: Martin Storsjö <martin@martin.st>
This avoids warnings of this kind, everywhere priv_class
is initialized:
warning: initialization discards qualifiers from pointer target type
Signed-off-by: Martin Storsjö <martin@martin.st>
* qatar/master:
Partially merged:flvdec: Allow parsing keyframes metadata without seeking in most cases
Error out if vaapi is not found
avio: undeprecate av_url_read_fseek/fpause under nicer names
libvo-*: Don't use deprecated sample format names and enum names
DUPLICATE flvdec: Fix support for flvtool2 "keyframes based" generated index
DUPLICATE libavcodec: Use "const enum AVSampleFormat[]" in AVCodec initialization
Fix the conversion of AV_SAMPLE_FMT_FLT and _DBL to AV_SAMPLE_FMT_S32.
Convert some undefined 1<<31 shifts into 1U<<31.
Conflicts:
configure
libavcodec/libvo-aacenc.c
libavcodec/libvo-amrwbenc.c
libavformat/flvdec.c
Marged-by: Michael Niedermayer <michaelni@gmx.at>
According to ISO 9899:1999 S 6.5.7/4:
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits
are filled with zeros. If E1 has an unsigned type, the value of the
result is E1× 2^E2, reduced modulo one more than the maximum value
representable in the result type. If E1 has a signed type and
nonnegative value, and E1× 2^E2 is representable in the result type, then
that is the resulting value; otherwise, the behavior is undefined.
via the equivalent AVCodecContext::crf modifying the range allowed by
options.c (0-51 -> 0-63)
update configure check to require libvpx 0.9.6 (Bali)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* qatar/master:
Not pulled due to wrong author, according to carl: Add unconditional return statement to yuva420_rgb32_MMX() / yuva420_bgr32_MMX().
Fix compilation of timefilter test program.
Add support for AMR-WB encoding via libvo-amrwbenc
Add an AAC encoder by using the libvo-aacenc library
g722: Return 8 bits per sample for g722 in av_get_bits_per_sample
Conflicts:
Changelog
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Call this new function before decode() to replace the custom and
inconsistant initialization in various decoders.
This function is equivalent to avcodec_get_frame_defaults() for AVFrame.
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
This fixes a failing assert in ff_raw_read_header (in
fate-g722dec-1), where bits_per_coded_sample is set using this
function and is required to have a positive value.
Signed-off-by: Martin Storsjö <martin@martin.st>
* qatar/master:
avio: add more documentation for AVIOContext.
Parse sprite data for WMVP and WVP2, and decode sprites for the latter
Replace outdated info on the FAQ
Redefine sameq
pad: fix example explanation
gradfun: add notice from the MPlayer manual
eval: add support for trunc, ceil, and floor functions
documentation: add setdar and setsar description to filters.texi
avio: document some members of AVIOContext.
avio: document avio_close().
avio: cosmetics, vertically align comments.
avio: cosmetics, group the reading functions.
avio: cosmetics, merge all the FF_API_OLD_AVIO blocks.
avio: cosmetics, move AVIOContext to start of the file.
avio: update file header.
os: fix OpenBSD/PowerPC compilation
pixfmt: add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE
oggdec: fix demuxing chained audio streams
fix typo
Conflicts:
doc/filters.texi
libavformat/avio.h
libavutil/pixfmt.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This patch lets e.g. dsputil_init chose dsp functions with respect to
the bit depth to decode. The naming scheme of bit depth dependent
functions is <base name>_<bit depth>[_<prefix>] (i.e. the old
clear_blocks_c is now named clear_blocks_8_c).
Note: Some of the functions for high bit depth is not dependent on the
bit depth, but only on the pixel size. This leaves some room for
optimizing binary size.
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
In high bit depth, the QP values may now be up to (51 + 6*(bit_depth-8)).
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
In high bit depth the pixels will not be stored in uint8_t like in the
normal case, but in uint16_t. The pixel size is thus 1 in normal bit
depth and 2 in high bit depth.
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The functions moved are used when decoding h264.
Preparatory patch for high bit depth h264 decoding support.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Unfortunately the output buffer size check assumes that the
input buffer is never over-consumed, thus this actually
also allowed to write outside the output buffer if "lucky".
AS libavcodec/arm/ac3dsp_armv6.o
ffmpeg-src/libavcodec/arm/ac3dsp_armv6.S: Assembler messages:
ffmpeg-src/libavcodec/arm/ac3dsp_armv6.S:40: Error: selected processor
does not support `movw r8,#0x1fe0'
make[1]: *** [libavcodec/arm/ac3dsp_armv6.o] Error 1
MOVW is ARMv7 way to load constant:
* movw, or move wide, will move a 16-bit constant into a register,
implicitly zeroing the top 16 bits of the target register.
* movt, or move top, will move a 16-bit constant into the top half
of a given register without altering the bottom 16 bits
To load 32 bit constant, movw lower16; movt upper16; is better than
ldr if available, because:
While this approach takes two instructions, it does not require any
extra space to store the constant so both the movw/movt method and the
ldr method will end up using the same amount of memory. Memory
bandwidth is precious in and the movw/movt approach avoids an extra
read on the data side, not to mention the read could have missed the
cache.
But here it is armv6 optimization, so that we have to use ldr.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
The thread_type API allows you to request only FF_THREAD_FRAME (instead of
FRAME | SLICE), but it was being ignored.
We don't implement both of them at the same time, so there isn't an effect
on current codecs, except that you can request no kinds of threading now
(a bit useless).
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
As previously discussed, the CrystalHD hardware returns exceptionally
useless information about interlaced h.264 content - to the extent
that it's not possible to distinguish most MBAFF and PAFF content until
it's too late.
In an attempt to compensate for this, I'm introducing two mechanisms:
1) Peeking at the picture number of the next picture
The hardware provides a capability to peek the next picture number. If
it is the same as the current picture number, then we are clearly dealing
with two fields and not a frame or fieldpair.
If this always worked, it would be all we need, but it's not guaranteed
to work. Sometimes, the next picture may not be decoded sufficiently
for the number to be known; alternately, a corruption in the stream may
cause the hardware to refuse to return the number even if the next
intact frame is decoded. In either case, the query will return 0.
If we are unable to peek the next picture number, we assume that the
picture is a frame/fieldpair and return it accordingly. If that turns
out to be incorrect, we discard the second field, and the user has
to live with the glitch. In testing, false detection can occur for
the first couple of seconds, and then the pipeline stabalizes and
we get correct detection.
2) Use the h264_parser to detect when individual input fields have
been combined into an output fieldpair.
I have multiple PAFF samples where this behaviour is detected. The
peeking mechanism described above will correctly detect that the
output is a fieldpair, but we need to know what the input type was
to ensure pipeline stability (only return one output frame per input
frame).
If we find ourselves with an output fieldpair, yet the input picture
type was a field, as reported by the parser, then we are dealing with
this case, and can make sure not to return anything on the next
decode() call.
Taken together, these allow us to remove the hard-coded hacks for
different h.264 types, and we can clearly describe the conditions
under which we can trust the hardware's claim that content is
interlaced.
Signed-off-by: Philip Langdale <philipl@overt.org>
Now that we know the type of the input picture, we have to bring
that information to the output picture to help identify its type.
We do this by adding a field to the opaque_list node.
Signed-off-by: Philip Langdale <philipl@overt.org>
As the hardware is unreliable, we will have to use the h.264 parser
to identify whether an input picture is a field or a frame. This
change loads the parser and extracts the picture type.
Signed-off-by: Philip Langdale <philipl@overt.org>
In preparation for adding additional fields to the node, return
the node instead of the pts value. This requires the caller to
free the node.
Signed-off-by: Philip Langdale <philipl@overt.org>
I found another MBAFF sample where the input:output pattern is
the same as mpeg2 and vc1 (fieldpair input, individual field output).
While I'm not sure how you can output individual fields from MBAFF,
if I apply the mpeg2/vc1 handling to this file, it plays correctly.
So, this changes the detection algorithm to handle the known cases.
Whitespace will be fixed in a separate change.
Signed-off-by: Philip Langdale <philipl@overt.org>