Commit Graph

231 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt 5abb5c0415 avcodec/flacenc: Avoid copying packet data, allow user-supplied buffers
The FLAC encoder calculates the size in advance, so one can avoid
an intermediate buffer for the packet data by using
ff_get_encode_buffer() and also set AV_CODEC_CAP_DR1 at the same time.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-05-23 15:12:57 +02:00
Andreas Rheinhardt 9fd34c8bb3 avcodec/flacenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 03:16:56 +02:00
Andreas Rheinhardt 2606c48391 avcodec/flacenc: Remove always-true check
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-28 17:42:37 +02:00
Andreas Rheinhardt 1c7f252783 avcodec: Remove redundant freeing of extradata of encoders
AVCodecContext.extradata is freed generically by libavcodec for
encoders, so it is unnecessary for an encoder to do it on its own.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-28 16:56:40 +02:00
Andreas Rheinhardt a247ac640d avcodec: Constify AVCodecs
Given that the AVCodec.next pointer has now been removed, most of the
AVCodecs are not modified at all any more and can therefore be made
const (as this patch does); the only exceptions are the very few codecs
for external libraries that have a init_static_data callback.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt d85c41b572 avcodec: Remove private options from AVCodecContext
Several options that were too codec-specific were deprecated between
0e6c853221 and
0e9c4fe254.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:02 -03:00
Andreas Rheinhardt 26ca5ebd7b avcodec: Remove sidedata-only-packet cruft
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:42:59 -03:00
Andreas Rheinhardt 56bd071e54 avcodec/flacenc: Fix memleak upon init error
An AVMD5 struct would leak if an error happened after its allocation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-04-02 18:55:27 +02:00
Andreas Rheinhardt c81b8e04aa Avoid intermediate bitcount for number of bytes in PutBitContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-30 12:36:32 +02:00
James Almer 13b1bbff0b avcodec: deprecate Lossless and Intra Only encoder capabilites
Both are codec properties and not encoder capabilities. The relevant
AVCodecDescriptor.props flags exist for this purpose.

Signed-off-by: James Almer <jamrial@gmail.com>
2020-05-21 12:32:15 -03:00
Michael Niedermayer d8ef5a47bb avcodec/flacenc: Replace "return -1" by named constant
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-09-24 02:33:48 +02:00
Jai Luthra 0c023d181e lavc/lpc: Add min_shift parameter in LPC
The min_shift parameter is needed by the MLP encoder

Signed-off-by: Jai Luthra <me@jailuthra.in>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-28 11:18:16 +02:00
Clément Bœsch 9b35242370 Merge commit 'b7f98659f21dce438c33b512e25fd64b8d07c347'
* commit 'b7f98659f21dce438c33b512e25fd64b8d07c347':
  Remove unnecessary get_bits.h #includes

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-29 11:16:01 +02:00
Diego Biurrun b7f98659f2 Remove unnecessary get_bits.h #includes 2016-06-07 13:09:57 +02:00
Michael Niedermayer 5781bfae0c flacenc: Load default prediction_order parameters if none is selected
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-02-08 15:00:29 -05:00
Derek Buitenhuis 1ba1fede9d flacenc: Restore defaults and range for {min, max}_prediction_order
This was broken in 243df1351d.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-01 00:57:43 +01:00
Michael Niedermayer 3c8e95ab5d avcodec/flacenc: Fix prediction_order parameter
Fixes regression

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-31 20:05:41 +01:00
Derek Buitenhuis e9eb8b3ba2 flacenc: Restore defaults and range for {min,max}_prediction_order
This was broken in 243df1351d.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-31 18:25:29 +00:00
Derek Buitenhuis c86ecdf3f7 Merge commit '243df1351d2d928caa084a5704ed783f0b83f072'
* commit '243df1351d2d928caa084a5704ed783f0b83f072':
  lavc: Move {min,max}_prediction_order to codec private options

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-01-31 13:29:04 +00:00
Paul B Mahol 3e7d684912 avcodec/flacenc: fix calculation of bits required in case of custom sample rate
Sample rate of 11025 takes 16 bits but previous code would pick only 8.
Fixes assertion failure.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-01-24 21:54:13 +01:00
Vittorio Giovara 243df1351d lavc: Move {min,max}_prediction_order to codec private options
These options are only used by alac and flac.
They are very codec-specific options, so deprecate the global variants.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2016-01-21 15:33:19 -05:00
Paul B Mahol 367ffa0c15 avcodec/flacenc: use designated initializers for AVClass
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-12-20 17:47:21 +01:00
Clément Bœsch fb99ef0bd3 avcodec: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:37:05 +01:00
Derek Buitenhuis 5ebaf1e1cb Merge commit '79d89cf2f4b62eeb653fd8139041c87e75f7ca65'
* commit '79d89cf2f4b62eeb653fd8139041c87e75f7ca65':
  flacenc: Clamp user-supplied min/max prediction orders

  Conflicts:
      libavcodec/flacenc.c

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2015-11-22 17:10:42 +00:00
Vittorio Giovara 79d89cf2f4 flacenc: Clamp user-supplied min/max prediction orders
This mimics what the code does internally for default order values.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-11-16 16:56:42 +01:00
Ronald S. Bultje 93866c2aa2 intmath: remove av_ctz.
It's a non-installed header and only used in one place (flacenc).
Since ff_ctz is static inline, it's fine to use that instead.
2015-10-11 18:03:10 -04:00
Vittorio Giovara 6064f697a3 lavc: Enable side data only packets by default
Deprecate the now unused option, but temporarily retain the capability
to disable the now default behaviour.

Mention this change in the AVPacket documentation.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-09-12 13:38:31 +02:00
Hendrik Leppkes 580c4fc98a Merge commit '6064f697a321174232a3fad351afb21150c3e9e5'
* commit '6064f697a321174232a3fad351afb21150c3e9e5':
  lavc: Enable side data only packets by default

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-12 15:12:05 +02:00
Michael Niedermayer 444e9874a7 Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'
* commit 'def97856de6021965db86c25a732d78689bd6bb0':
  lavc: AV-prefix all codec capabilities

Conflicts:
	cmdutils.c
	ffmpeg.c
	ffplay.c
	libavcodec/8svx.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.c
	libavcodec/adpcm.c
	libavcodec/alac.c
	libavcodec/atrac3plusdec.c
	libavcodec/bink.c
	libavcodec/dnxhddec.c
	libavcodec/dvdec.c
	libavcodec/dvenc.c
	libavcodec/ffv1dec.c
	libavcodec/ffv1enc.c
	libavcodec/fic.c
	libavcodec/flacdec.c
	libavcodec/flacenc.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/hevc.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopenjpegdec.c
	libavcodec/libvo-aacenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxdec.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpegaudiodec_float.c
	libavcodec/msmpeg4dec.c
	libavcodec/mxpegdec.c
	libavcodec/nvenc_h264.c
	libavcodec/nvenc_hevc.c
	libavcodec/pngdec.c
	libavcodec/qpeg.c
	libavcodec/ra288.c
	libavcodec/rv10.c
	libavcodec/s302m.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tiff.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/vp9.c
	libavcodec/wavpack.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 22:50:18 +02:00
Vittorio Giovara def97856de lavc: AV-prefix all codec capabilities
Express bitfields more simply.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:58 +01:00
Michael Niedermayer e36db49b7b avcodec: Add a min size parameter to ff_alloc_packet2()
This parameter can be used to inform the allocation code about how much
downsizing might occur, and can be used to optimize how to allocate the
packet

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 19:57:52 +02:00
George Boyle 2469ed32c8 avcodec/flacenc: Fix Invalid Rice order
Fixes ticket #4628.

The problem arose, in the sample file at least, in the last block where the
minimum and maximum Rice partition orders were both 0. In that case, and any
other where pmax == pmin, the original UINT32_MAX placeholder value for
bits[opt_porder] was getting overwritten before the comparison to check if the
current partition order is a new optimal, so the correct partition order and
RiceContext params were not being set.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-16 12:55:20 +02:00
Michael Niedermayer fccde16afa avcodec/flacenc: Simplify sizeof()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-02 15:41:44 +02:00
Michael Niedermayer b8e7f2b277 avcodec/flacenc: Support Multi dimensional quantization
Now with exact bit computations if exact_rice_parameters is enabled

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-20 01:35:29 +02:00
Michael Niedermayer 215410860f avcodec/flacenc: Mark pointers/array arguments const which are not changed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-19 19:47:22 +02:00
Michael Niedermayer 5dfcb4f74d avcodec/flacenc: Simplify md5 calculation code by using AV_WL24()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-19 19:41:44 +02:00
Michael Niedermayer 7786a91b47 avcodec/flacenc: Move udata and sums to FlacSubframe
This significantly reduces the amount of stack space needed and
also permits to simply copy the rice context again without speed
penalty

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-19 13:48:30 +02:00
Michael Niedermayer 80f9d6e0ab avcodec/flacenc: Support calculating rice parameters exactly
Some files benefit by about 0.3% from this, and speedwise its ok
other files do not benefit and encode to the same size

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-19 13:42:56 +02:00
Michael Niedermayer d3dcd28812 avcodec/flacenc: Do not copy unused udata array -> 5x faster calc_rice_params()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-19 12:11:27 +02:00
Carl Eugen Hoyos e609cfd697 lavc/flac: Fix encoding and decoding with high lpc.
Based on an analysis by trac user lvqcl.

Fixes ticket #4421, reported by Chase Walker.
2015-05-17 02:08:58 +02:00
Michael Niedermayer 77010a41fe Merge commit 'f5ba67ee1342b7741200ff637fc3ea3387b68a1b'
* commit 'f5ba67ee1342b7741200ff637fc3ea3387b68a1b':
  flacenc: Move a scratch buffer to struct used by the function

Conflicts:
	libavcodec/flacenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-29 03:32:47 +02:00
Vittorio Giovara f5ba67ee13 flacenc: Move a scratch buffer to struct used by the function
This avoids allocating/freeing memory at every function call,
checking its return value, and carrying the error around.
2015-04-28 16:25:09 +01:00
Michael Niedermayer 09b0f227ce avcodec/flacenc: also count wasted bits in subframe_count_exact()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 14:36:36 +02:00
Vittorio Giovara 70d246d5cc flacenc: initialize sums matrix
CC: libav-stable@libav.org
Bug-Id: CID 703821
2015-01-29 17:33:38 +00:00
Reimar Döffinger 254da44bf9 flacenc: calculate lower sum levels in-place.
Should improve cache usage and reduces stack usage.
Also reduces number of copies in case many levels
have the same number of bits.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-12-17 04:27:09 +01:00
James Almer 3cec54b7d7 x86/flacdsp: add SSE2 and AVX decorrelate functions
Two to four times faster depending on instruction set, block size and channel count.
2014-11-13 13:47:55 -03:00
James Darnley 54a51d3840 lavc/flacenc: partially unroll loop in flac_enc_lpc_16
It now does 12 samples per iteration, up from 4.

From 1.8 to 3.2 times faster again.  3.6 to 5.7 times faster overall.
Runtime is reduced by a further 2 to 18%.  Overall runtime reduced by
4 to 50%.

Same conditions as before apply.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-13 03:09:26 +02:00
James Darnley 0081a14e7d lavc/flacenc: add sse4 version of the 16-bit lpc encoder
From 1.8 to 2.4 times faster.  Runtime is reduced by 2 to 39%.  The
speed-up generally increases with compression_level.

This lpc encoder is not used with levels < 3 so it provides no speed-up
in these cases.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-13 01:14:47 +02:00
Michael Niedermayer 35bb74900b Merge commit 'c67b449bebbe0b35c73b203683e77a0a649bc765'
* commit 'c67b449bebbe0b35c73b203683e77a0a649bc765':
  dsputil: Split bswap*_buf() off into a separate context

Conflicts:
	configure
	libavcodec/4xm.c
	libavcodec/ac3dec.c
	libavcodec/ac3dec.h
	libavcodec/apedec.c
	libavcodec/eamad.c
	libavcodec/flacenc.c
	libavcodec/fraps.c
	libavcodec/huffyuv.c
	libavcodec/huffyuvdec.c
	libavcodec/motionpixels.c
	libavcodec/truemotion2.c
	libavcodec/x86/Makefile
	libavcodec/x86/dsputil_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 13:31:26 +02:00