Commit Graph

91 Commits

Author SHA1 Message Date
Michael Niedermayer
8c6cfffa01 Merge commit 'b574e1e97ea7067a5fcd3876e30a67df0e4e6611'
* commit 'b574e1e97ea7067a5fcd3876e30a67df0e4e6611':
  get_bits: Add OPEN_READER macro variant w/o size_plus8

Conflicts:
	libavcodec/get_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 19:08:27 +02:00
Diego Biurrun
b574e1e97e get_bits: Add OPEN_READER macro variant w/o size_plus8
This avoids a trillion warnings from MSVC.
2014-09-05 13:55:03 +02:00
Michael Niedermayer
9e59a7be1c Merge commit '91d305790ea0f6fe0f54b48236da42181c39c18b'
* commit '91d305790ea0f6fe0f54b48236da42181c39c18b':
  get_bits: Rename HAVE_BITS_REMAINING --> BITS_AVAILABLE

Conflicts:
	libavcodec/golomb.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-02 22:18:12 +02:00
Diego Biurrun
91d305790e get_bits: Rename HAVE_BITS_REMAINING --> BITS_AVAILABLE
The HAVE_ prefix is reserved for macros set by configure.
2014-09-02 13:10:38 +02:00
Michael Niedermayer
11512d70fa avcodec/get_bits: add BITS_LEFT() for finding the bits left with an opened reader
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 15:15:54 +02:00
Timothy Gu
ea6178fff8 get_bits: remove unused assignment
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-16 14:27:45 +02:00
Michael Niedermayer
e6f9fc4adc avcodec/bitstream: try to make vlc init code inherently thread safe
also remove spinlock, it doesnt work on AIX

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-16 20:09:21 +02:00
Matthew Lindner
b372f67342 avcodec: better level/index printing 2014-05-09 22:05:57 +02:00
Michael Niedermayer
6df33c4926 avcodec: include GET_RL_VLC() in trace output
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-09 02:03:54 +02:00
Reimar Döffinger
8cbf0827e1 Various small spelling fixes.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2014-04-22 20:44:31 +02:00
Michael Niedermayer
44e8e82d34 avcodec/get_bits: add skip_1stop_8data_bits
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-30 18:22:03 +01:00
Michael Niedermayer
54197c7aae skip_bits: dont call UPDATE_CACHE
UPDATE_CACHE isnt needed and can cause segfaults

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-30 14:34:12 +02:00
Michael Niedermayer
121fc05b4d avcodec/get_bits: place volatile at the right spot
Should fix Ticket2825

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 20:55:54 +02:00
Michael Niedermayer
43411f416f avcodec/get_bits: init_state is used for thread sync, make it volatile
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-30 20:38:19 +02:00
Michael Niedermayer
6af8326354 avcodec/ff_init_vlc_sparse: use a spinlock for thread sync
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 16:48:41 +02:00
Paul B Mahol
48f2750de8 get_bits: add get_bits_le()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-07-05 16:51:08 +00:00
Michael Niedermayer
ff130d7363 get_xbits: assert validity of the number of bits
similar is already done in the other get_bits() functions

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-30 01:40:18 +02:00
Ronald S. Bultje
9918f57dcf get_bits: Return pointer to buffer that is the result of the alignment
This allows more transparent mixing of get_bits and whole-byte access
without having to touch get_bits internals.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-02-19 22:33:52 +02:00
Ronald S. Bultje
fd6a021d8e get_bits: return pointer to buffer that is the result of the alignment.
This allows more transparent mixing of get_bits and whole-byte access
without having to touch get_bits internals.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-11 02:29:43 +01:00
Michael Niedermayer
766f055201 Merge commit '4af5310d29379283553bcd9f541a3f6c317f706e'
* commit '4af5310d29379283553bcd9f541a3f6c317f706e':
  get_bits/put_bits: K&R formatting cosmetics

Conflicts:
	libavcodec/get_bits.h
	libavcodec/put_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-22 13:49:45 +01:00
Diego Biurrun
4af5310d29 get_bits/put_bits: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-21 17:03:41 +01:00
Michael Niedermayer
a85311ef84 Merge commit '68f18f03519ae550e25cf12661172641e9f0eaca'
* commit '68f18f03519ae550e25cf12661172641e9f0eaca':
  videodsp_armv5te: remove #if HAVE_ARMV5TE_EXTERNAL
  dsputil: drop non-compliant "fast" qpel mc functions
  get_bits: change the failure condition in init_get_bits

Conflicts:
	libavcodec/get_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-21 13:38:57 +01:00
Luca Barbato
4603ec85ed get_bits: change the failure condition in init_get_bits
Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.

Check for NULL buffer instead.
2013-01-20 13:37:56 +01:00
Michael Niedermayer
7980cca05c init_get_bits: fix off by 1 error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 16:35:41 +01:00
Michael Niedermayer
153fad14e5 init_get_bits8: zero pointers & struct on error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 16:35:41 +01:00
Michael Niedermayer
ac73d3a12a init_get_bits8: check byte_size against being positive
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 16:35:41 +01:00
Michael Niedermayer
329675cfd7 Merge commit 'a1c525f7eb0783d31ba7a653865b6cbd3dc880de'
* commit 'a1c525f7eb0783d31ba7a653865b6cbd3dc880de':
  pcx: return meaningful error codes.
  tmv: return meaningful error codes.
  msrle: return meaningful error codes.
  cscd: return meaningful error codes.
  yadif: x86: fix build for compilers without aligned stack
  lavc: introduce the convenience function init_get_bits8
  lavc: check for overflow in init_get_bits

Conflicts:
	libavcodec/cscd.c
	libavcodec/pcx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-14 14:43:32 +01:00
Luca Barbato
e28ac6e5e2 lavc: introduce the convenience function init_get_bits8
Accept the buffer size in bytes and check for overflow before passing
the value in bits to init_get_bits.
2013-01-14 04:49:14 +01:00
Luca Barbato
d9cf5f5169 lavc: check for overflow in init_get_bits
Fix an undefined behaviour and make the function return a proper
error in case of overflow.

CC: libav-stable@libav.org
2013-01-14 04:49:14 +01:00
Michael Niedermayer
57cee85023 Merge commit '096abfa15052977eed93f0b5e01afd2d47c53c1f'
* commit '096abfa15052977eed93f0b5e01afd2d47c53c1f':
  parser: fix large overreads
  bitstream: add get_bits64() to support reading more than 32 bits at once
  arm: detect cpu features at runtime on Linux

Conflicts:
	libavcodec/parser.c
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-08 14:58:56 +01:00
Michael Niedermayer
7efee140d7 get_bits: rename get_bits_longlong to get_bits64
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-08 14:53:01 +01:00
Michael Niedermayer
41540b36a1 bitstream: add get_bits64() to support reading more than 32 bits at once
Also remove a duplicate function in the MPEG-TS demuxer.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-12-07 16:15:02 -05:00
Michael Niedermayer
094a82c7de get_bits: get_bits_long() support n=0 as the docs allow it
also the 0 case is indeed used in some code pathes

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-06 23:04:10 +02:00
Michael Niedermayer
f51c4bfe3f bitstream: add get_bits_longlong() to support more than 32bits
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-30 15:20:40 +02:00
Michael Niedermayer
5f1c3c785c get_bits_long: fix variable type
This fixes a theoretical signed overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-30 02:37:40 +02:00
Michael Niedermayer
2acb5cd907 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libopus: Remap channels using libopus' internal remapping.
  Opus decoder using libopus
  avcodec: document the use of AVCodecContext.delay for audio decoding
  vc1dec: add flush function for WMV9 and VC-1 decoders
  http: Increase buffer sizes to cope with longer URIs
  nutenc: const correctness for ff_put_v_trace/put_s_trace function arguments
  h264_refs: Fix debug tprintf argument types
  golomb: const correctness for get_ue()/get_se() function arguments
  get_bits: const correctness for get_bits_trace()/get_xbits_trace() arguments

Conflicts:
	Changelog
	libavcodec/Makefile
	libavcodec/version.h
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-28 13:54:40 +02:00
Diego Biurrun
e00215040a get_bits: const correctness for get_bits_trace()/get_xbits_trace() arguments 2012-09-27 19:10:10 +02:00
Michael Niedermayer
6560fa390e get_bits: check the number of bits parameter through av_assert2()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-07 19:59:00 +02:00
Michael Niedermayer
b008ac18bb Merge remote-tracking branch 'qatar/master'
* qatar/master:
  docs: use -bsf:[vas] instead of -[vas]bsf.
  mpegaudiodec: Prevent premature clipping of mp3 input buffer.
  lavf: move the packet keyframe setting code.
  oggenc: free comment header for all codecs
  lcl: error out if uncompressed input buffer is smaller than framesize.
  mjpeg: abort decoding if packet is too large.
  golomb: use HAVE_BITS_REMAINING() macro to prevent infloop on EOF.
  get_bits: add HAVE_BITS_REMAINING macro.
  lavf/output-example: use new audio encoding API correctly.
  lavf/output-example: more proper usage of the new API.
  tiff: Prevent overreads in the type_sizes array.
  tiff: Make the TIFF_LONG and TIFF_SHORT types unsigned.
  apetag: do not leak memory if avio_read() fails
  apetag: propagate errors.
  SBR DSP x86: implement SSE sbr_hf_g_filt
  SBR DSP x86: implement SSE sbr_sum_square_sse
  SBR DSP: use intptr_t for the ixh parameter.

Conflicts:
	doc/bitstream_filters.texi
	doc/examples/muxing.c
	doc/ffmpeg.texi
	libavcodec/golomb.h
	libavcodec/x86/Makefile
	libavformat/oggenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-25 04:00:43 +01:00
Ronald S. Bultje
b44b41633f get_bits: add HAVE_BITS_REMAINING macro. 2012-02-24 07:28:14 -08:00
Michael Niedermayer
6cb2085278 Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
  ppc: Add ff_ prefix to nonstatic symbols
  sh4: Add ff_ prefix to nonstatic symbols
  mpegvideo: Add ff_ prefix to nonstatic functions
  rtjpeg: Add ff_ prefix to nonstatic symbols
  rv: Add ff_ prefix to nonstatic symbols
  vp56: Add ff_ prefix to nonstatic symbols
  vorbis: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefix to nonstatic symbols
  vc1: Add ff_ prefix to nonstatic symbols
  msmpeg4: Add ff_ prefixes to nonstatic symbols
  snow: Add ff_ prefix to nonstatic symbols
  mpeg12: Add ff_ prefix to nonstatic symbols
  mpeg4: Add ff_ prefixes to nonstatic symbols
  lagarith: Add ff_ prefix to lag_rac_init
  libavcodec: Add ff_ prefix to j_rev_dct*
  dsputil: Add ff_ prefix to inv_zigzag_direct16
  libavcodec: Prefix fdct_ifast, fdct_ifast248
  dsputil: Add ff_ prefix to the dsputil*_init* functions
  libavcodec: Add ff_ prefix to some nonstatic symbols
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  ...

Conflicts:
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/dnxhddec.c
	libavcodec/ffv1.c
	libavcodec/h263.h
	libavcodec/h263dec.c
	libavcodec/h264.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/proresdsp.c
	libavcodec/svq3.c
	libavcodec/version.h
	libavformat/dv.h
	libavformat/dvenc.c
	libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-16 01:34:37 +01:00
Martin Storsjö
e96b4a53df vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:06:26 +02:00
Michael Niedermayer
d1c28e3530 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  build: fix standalone compilation of OMA muxer
  build: fix standalone compilation of Microsoft XMV demuxer
  build: fix standalone compilation of Core Audio Format demuxer
  kvmc: fix invalid reads
  4xm: Add a check in decode_i_frame to prevent buffer overreads
  adpcm: fix IMA SMJPEG decoding
  options: set minimum for "threads" to zero
  bsd: use number of logical CPUs as automatic thread count
  windows: use number of CPUs as automatic thread count
  linux: use number of CPUs as automatic thread count
  pthreads: reset active_thread_type when slice thread_init returrns early
  v410dec: include correct headers
  Drop ALT_ prefix from BITSTREAM_READER_LE name.
  lavfi: always build vsrc_buffer.
  ra144enc: zero the reflection coeffs if the filter is unstable
  sws: readd PAL8 to isPacked()
  mov: Don't stick the QuickTime field ordering atom in extradata.
  truespeech: fix invalid reads in truespeech_apply_twopoint_filter()

Conflicts:
	configure
	libavcodec/4xm.c
	libavcodec/avcodec.h
	libavfilter/Makefile
	libavfilter/allfilters.c
	libavformat/Makefile
	libswscale/swscale_internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-23 03:25:51 +01:00
Diego Biurrun
aaf47bcde7 Drop ALT_ prefix from BITSTREAM_READER_LE name.
The prefix is a historic remnant that probably meant "alternative".
Now that the A32 bitstream reader has been dropped it makes no sense anymore.
2011-12-22 16:51:23 +01:00
Michael Niedermayer
1bdc212a39 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  build: link test programs with static libraries
  dct-test: remove unused variable cropTbl
  swscale: fix overflow in gray16 vertical scaling.
  get_bits: remove LAST_SKIP_CACHE macro
  swscale: fix integer overflows in RGB pixel writing.
  swscale: add endian conversion for RGB555 and RGB444 pixel formats
  swscale: fix overflows in output of RGB48 pixels.
  get_bits: remove strange/obsolete comments
  get_bits: whitespace (mostly) cosmetics
  swscale: add rgb565 endianess conversion
  get_bits: remove unnecessary #includes
  mp3dec: hack: fix decoding with safe bitstream reader
  fate: fix eatqi test
  adpcm: Check for channels to be a non-zero integer
  swscale: fix overflows in RGB rounding constants.
  get_bits: introduce safe bitreading to prevent overreads.

Conflicts:
	libswscale/swscale.c
	libswscale/swscale_unscaled.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-18 03:04:44 +01:00
Michael Niedermayer
1a2484fc4e get_bits: drop the a32 reader.
that way qatar maintains the code for me and i dont need to resolve conflicts.
If someone wants the a32 reader back, only thing you need to do is maintain
it, i would be happy to have it back, iam just not volunteering to maintain
it due to lack of time.

Based on: a1e98f198e by Mans Rullgard.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-18 02:09:17 +01:00
Mans Rullgard
86a10281c7 get_bits: remove LAST_SKIP_CACHE macro
This macro is empty since the removal of the A32 bitstream reader.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 20:04:28 +00:00
Mans Rullgard
5d8122db5c get_bits: remove strange/obsolete comments
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 18:36:20 +00:00
Mans Rullgard
e42bb0ee01 get_bits: whitespace (mostly) cosmetics
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 18:36:20 +00:00
Mans Rullgard
adb28c49bd get_bits: remove unnecessary #includes
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-12-17 17:53:57 +00:00