Commit Graph

199 Commits

Author SHA1 Message Date
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
Diego Biurrun c67b449beb dsputil: Split bswap*_buf() off into a separate context 2014-06-22 18:22:31 -07:00
Michael Niedermayer 05c5dd403d Merge commit 'ed39cda02923316b6710c1bcc34d3445370be5b4'
* commit 'ed39cda02923316b6710c1bcc34d3445370be5b4':
  flacenc: send final extradata in packet side data

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-01 13:55:49 +02:00
Anton Khirnov ed39cda029 flacenc: send final extradata in packet side data 2014-06-01 08:27:01 +02:00
Michael Niedermayer 0eb9482e32 avcodec/flacenc: Use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 18:28:40 +02:00
Michael Niedermayer ee77140afa Merge commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2'
* commit 'b2bed9325dbd6be0da1d91ffed3f513c40274fd2':
  cosmetics: Group .name and .long_name together in codec/format declarations

Conflicts:
	libavcodec/8svx.c
	libavcodec/alac.c
	libavcodec/cljr.c
	libavcodec/dnxhddec.c
	libavcodec/dnxhdenc.c
	libavcodec/dpxenc.c
	libavcodec/dvdec.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/ffv1dec.c
	libavcodec/flacdec.c
	libavcodec/flvdec.c
	libavcodec/fraps.c
	libavcodec/frwu.c
	libavcodec/g726.c
	libavcodec/gif.c
	libavcodec/gifdec.c
	libavcodec/h261dec.c
	libavcodec/h263dec.c
	libavcodec/iff.c
	libavcodec/imc.c
	libavcodec/libopencore-amr.c
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libspeexenc.c
	libavcodec/libvo-amrwbenc.c
	libavcodec/libvorbisenc.c
	libavcodec/libvpxenc.c
	libavcodec/libx264.c
	libavcodec/libxavs.c
	libavcodec/libxvid.c
	libavcodec/ljpegenc.c
	libavcodec/mjpegbdec.c
	libavcodec/mjpegdec.c
	libavcodec/mpeg12dec.c
	libavcodec/mpeg4videodec.c
	libavcodec/msmpeg4dec.c
	libavcodec/pgssubdec.c
	libavcodec/pngdec.c
	libavcodec/pngenc.c
	libavcodec/proresdec_lgpl.c
	libavcodec/proresenc_kostya.c
	libavcodec/ra144enc.c
	libavcodec/rawdec.c
	libavcodec/rv10.c
	libavcodec/sp5xdec.c
	libavcodec/takdec.c
	libavcodec/tta.c
	libavcodec/v210dec.c
	libavcodec/vp6.c
	libavcodec/wavpack.c
	libavcodec/xbmenc.c
	libavcodec/yop.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-04 12:34:23 +02:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Michael Niedermayer 0104570fb6 Merge commit 'a5f8873620ce502d37d0cc3ef93ada2ea8fb8de7'
* commit 'a5f8873620ce502d37d0cc3ef93ada2ea8fb8de7':
  silly typo fixes

Conflicts:
	doc/protocols.texi
	libavcodec/aacpsy.c
	libavformat/utils.c
	tools/patcheck

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-04 10:17:52 +02:00
Diego Biurrun a5f8873620 silly typo fixes 2013-05-03 18:26:12 +02:00
Michael Niedermayer e052f06531 Merge commit '0f24a3ca999a702f83af9307f9f47b6fdeb546a5'
* commit '0f24a3ca999a702f83af9307f9f47b6fdeb546a5':
  lavc: remove disabled FF_API_OLD_ENCODE_VIDEO cruft
  lavc: remove disabled FF_API_OLD_ENCODE_AUDIO cruft
  lavc: remove disabled FF_API_OLD_DECODE_AUDIO cruft

Conflicts:
	libavcodec/flacenc.c
	libavcodec/libgsm.c
	libavcodec/utils.c
	libavcodec/version.h

The compatibility wrapers are left as they likely sre still
in wide use. They will be removed when they break or otherwise
cause work without an volunteer being available.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-12 22:04:16 +01:00
Anton Khirnov f073b1500e lavc: remove disabled FF_API_OLD_ENCODE_AUDIO cruft 2013-03-09 08:36:40 +01:00
James Zern bcaf64b605 normalize calls to ff_alloc_packet2
- check ret < 0
- remove excessive error log

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-06 22:11:46 +01:00
Paul B Mahol 92d874cb78 flacenc: include correct header
Encoder needs put_bits.h, not get_bits.h

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-01-23 11:21:09 +00:00
Nicolas George 9e28e0035a lavc/flacenc: improve error return.
Use meaningful error codes and add log messages.
2012-12-31 19:11:12 +01:00
Michael Niedermayer 7c425e4f2d Merge commit 'd7d6efe42b0d2057e67999b96b9a391f533d2333'
* commit 'd7d6efe42b0d2057e67999b96b9a391f533d2333':
  h264: check sps.log2_max_frame_num for validity
  mov: validate number of DataReferenceBox entries against box size
  mov: compute avg_frame_rate only if duration is known
  flac: change minimum and default of lpc_passes option to 1

Conflicts:
	libavcodec/h264_ps.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-07 15:52:43 +01:00
Janne Grunau 480be07a96 flac: change minimum and default of lpc_passes option to 1
Avoid use of uninitialized and uncomputed linear least square models
during ff_lpc_calc_coefs() for FF_LPC_TYPE_CHOLESKY. Fixes running
make fate-flac-16-lpc-cholesk with valgrind --undef-value-errors=yes.
2012-12-07 11:43:28 +01:00
Michael Niedermayer 1b5a6d3c49 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  flacenc: ensure the order is within the min/max range in LPC order search
  avconv: rescale packet duration to muxer time base when flushing encoders
  add 24-bit FLAC encoding to Changelog
  rtpenc_aac: Fix calculation of the header size
  x86: h264_intrapred: port to cpuflags

Conflicts:
	Changelog
	libavformat/rtpenc_aac.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-09 10:29:51 +01:00
Justin Ruggles 3a2731cbd3 flacenc: ensure the order is within the min/max range in LPC order search
This fixes use of uninitialized values when the FLAC encoder uses the
2-level, 4-level, and 8-level search methods. Fixes failure of the
fate-flac-24-comp-8 test when run using valgrind.
2012-11-08 13:57:34 -05:00
Michael Niedermayer 6493842900 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  FATE: add a 24-bit FLAC encoding test
  FATE: rename FLAC tests from flac-* to flac-16-*
  flacenc: use RICE2 entropy coding mode for 24-bit
  flacenc: add 24-bit encoding
  flacdsp: move lpc encoding from FLAC encoder to FLACDSPContext

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-05 23:01:34 +01:00
Michael Niedermayer 7d26be63c2 Merge commit '5ff998a233d759d0de83ea6f95c383d03d25d88e'
* commit '5ff998a233d759d0de83ea6f95c383d03d25d88e':
  flacenc: use uint64_t for bit counts
  flacenc: remove wasted trailing 0 bits
  lavu: add av_ctz() for trailing zero bit count
  flacenc: use a separate buffer for byte-swapping for MD5 checksum on big-endian
  fate: aac: Place LATM tests and general AAC tests in different groups
  build: The A64 muxer depends on rawenc.o for ff_raw_write_packet()

Conflicts:
	doc/APIchanges
	libavutil/version.h
	tests/fate/aac.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-11-05 22:51:20 +01:00
Justin Ruggles 5ff998a233 flacenc: use uint64_t for bit counts
Needed to avoid integer overflows for 24-bit encoding.
2012-11-05 15:32:30 -05:00
Justin Ruggles e783316322 flacenc: remove wasted trailing 0 bits 2012-11-05 15:32:30 -05:00
Justin Ruggles 2e76f34387 flacenc: use RICE2 entropy coding mode for 24-bit 2012-11-05 15:32:30 -05:00
Justin Ruggles 13e1ee6c84 flacenc: add 24-bit encoding 2012-11-05 15:32:30 -05:00
Justin Ruggles 799e232490 flacdsp: move lpc encoding from FLAC encoder to FLACDSPContext
Also, templatize the functions for 16-bit and 32-bit sample range. This will
be used for 24-bit FLAC encoding.
2012-11-05 15:32:30 -05:00
Justin Ruggles 6a744d2619 flacenc: use a separate buffer for byte-swapping for MD5 checksum on big-endian
This is much faster than calculating the MD5 one sample at a time.
2012-11-05 15:32:29 -05:00
Michael Niedermayer f391e405df Merge commit 'e002e3291e6dc7953f843abf56fc14f08f238b21'
* commit 'e002e3291e6dc7953f843abf56fc14f08f238b21':
  Use the new aes/md5/sha/tree allocation functions
  avutil: Add functions for allocating opaque contexts for algorithms
  svq3: fix pointer type warning
  svq3: replace unsafe pointer casting with intreadwrite macros
  parseutils-test: various cleanups

Conflicts:
	doc/APIchanges
	libavcodec/svq3.c
	libavutil/parseutils.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-12 14:52:34 +02:00
Martin Storsjö e002e3291e Use the new aes/md5/sha/tree allocation functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-11 23:35:28 +03:00
Michael Niedermayer d46c1c72e4 Merge commit 'e6153f173a49e5bfa70b0c04d2f82930533597b9'
* commit 'e6153f173a49e5bfa70b0c04d2f82930533597b9':
  avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member

Conflicts:
	libavcodec/libopenjpegdec.c
	libavcodec/libopenjpegenc.c
	libavcodec/libx264.c
	libavcodec/mpeg12enc.c
	libavcodec/options_table.h
	libavcodec/snowenc.c
	libavcodec/tiffenc.c
	libavdevice/v4l2.c
	libavdevice/x11grab.c
	libavfilter/af_amix.c
	libavfilter/af_asyncts.c
	libavfilter/af_join.c
	libavfilter/buffersrc.c
	libavfilter/src_movie.c
	libavfilter/vf_delogo.c
	libavfilter/vf_drawtext.c
	libavformat/http.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/movenc.c
	libavformat/mpegenc.c
	libavformat/mpegtsenc.c
	libavformat/options_table.h
	libavformat/segment.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-05 14:33:32 +02:00
Michael Niedermayer d5f65e9d40 Merge commit '124134e42455763b28cc346fed1d07017a76e84e'
* commit '124134e42455763b28cc346fed1d07017a76e84e':
  avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member

Conflicts:
	libavcodec/aacenc.c
	libavcodec/libopenjpegenc.c
	libavcodec/options_table.h
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavdevice/x11grab.c
	libavfilter/af_amix.c
	libavfilter/vf_drawtext.c
	libavformat/movenc.c
	libavformat/options_table.h
	libavutil/opt.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-05 13:58:11 +02:00
Martin Storsjö e6153f173a avopt: Store defaults for AV_OPT_TYPE_INT in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:44 +03:00
Martin Storsjö 124134e424 avopt: Store defaults for AV_OPT_TYPE_CONST in the i64 union member
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 23:13:32 +03:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00