diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-03-02 12:37:09 +0000 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2016-03-04 22:40:58 +0000 |
commit | b88be742fac7a77a8095e8155ba8790db4b77568 (patch) | |
tree | 0bbf0dd664338a2ddbefcc6a7c5af0d445da1bc8 /libavcodec/pthread_internal.h | |
parent | 3c658e2655179fa2738a7806a342f89a17bd9230 (diff) | |
download | ffmpeg-b88be742fac7a77a8095e8155ba8790db4b77568.tar.gz |
vc2enc: do not allocate packet until exact frame size is known
This commit solves most of the crashes and issues with the encoder and
the bitrate setting. Now the encoder will always allocate the absolute
lowest amount of memory regardless of what the bitrate has been set to.
Therefore if a user inputs a very low bitrate the encoder will use the
maximum possible quantization (basically zero out all coefficients),
allocate a packet and encode it. There is no coupling between the
bitrate and the allocation size and so no crashes because the buffer
isn't large enough.
The maximum quantizer was raised to the size of the table now to both
keep the overshoot at ridiculous bitrates low and to improve quality
with higher bit depths (since the coefficients grow larger per transform
quantizing them to the same relative level requires larger quantization
indices).
Since the quantization index start follows the previous quantization
index for that slice, the quantization step was reduced to a static 1
to improve performance. Previously with quant/5 the step was usually
set to 0 upon start (and was later clipped to 1), that isn't a big change.
As the step size increases so does the amount of bits leftover and so
the redistribution algorithm has to iterate more and thus waste more
time.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/pthread_internal.h')
0 files changed, 0 insertions, 0 deletions