Commit Graph

66 Commits

Author SHA1 Message Date
Ronald S. Bultje 2e59210edf lavc/h264: don't touch H264Context->ref_count[] during MB decoding.
The variable is copied to subsequent threads at the same time, so this
may cause wrong ref_count[] values to be copied to subsequent threads.

This bug was found using TSAN and Helgrind.

Original patch by Ronald, adapted with a local_ref_count by Clément,
following the suggestion of Michael Niedermayer.

Signed-off-by: Clément Bœsch <clement.boesch@smartjog.com>
2012-10-05 07:35:58 +02:00
Michael Niedermayer 710600077d h264_cavlc: switch forgotten assert to av_assert
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-13 05:59:44 +02:00
Michael Niedermayer 506ffa793f h264_cabac: switch to av_assert
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-26 16:33:39 +02:00
Michael Niedermayer 39f0a45a1a h264_cavlc: check prefix before using it.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-30 16:42:01 +02:00
Michael Niedermayer 2c5a2958e9 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: Factorize declaration of mb_sizes array.
  vsrc_buffer: when no frame is available, return an error instead of segfaulting.
  configure: add dl to frei0r extralibs.
  dsputil x86: use SSE float instruction instead of SSE2 integer equivalent
  dsputil x86: remove deprecated parameter from scalarproduct_int16 prototype
  vp8dsp x86: perform rounding shift with a single instruction
  fate: add BMP tests.
  swscale: handle complete dimensions for monoblack/white.
  aacenc: Mark deinterleave_input_samples argument as const.
  vf_unsharp: Mark readonly variable as const.
  h264: fix 4:2:2 PCM-macroblocks decoding

Conflicts:
	configure
	libavcodec/h264.h
	libavcodec/x86/dsputil_mmx.c
	libavfilter/vf_unsharp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-05 22:26:50 +02:00
Diego Biurrun 0becb07842 h264: Factorize declaration of mb_sizes array. 2012-04-05 17:17:22 +02:00
Michael Niedermayer a78f6b8cb9 Merge remote-tracking branch 'qatar/master'
* qatar/master: (38 commits)
  v210enc: remove redundant check for pix_fmt
  wavpack: allow user to disable CRC checking
  v210enc: Use Bytestream2 functions
  cafdec: Check return value of avio_seek and avoid modifying state if it fails
  yop: Check return value of avio_seek and avoid modifying state if it fails
  tta: Check return value of avio_seek and avoid modifying state if it fails
  tmv: Check return value of avio_seek and avoid modifying state if it fails
  r3d: Check return value of avio_seek and avoid modifying state if it fails
  nsvdec: Check return value of avio_seek and avoid modifying state if it fails
  mpc8: Check return value of avio_seek and avoid modifying state if it fails
  jvdec: Check return value of avio_seek and avoid modifying state if it fails
  filmstripdec: Check return value of avio_seek and avoid modifying state if it fails
  ffmdec: Check return value of avio_seek and avoid modifying state if it fails
  dv: Check return value of avio_seek and avoid modifying state if it fails
  bink: Check return value of avio_seek and avoid modifying state if it fails
  Check AVCodec.pix_fmts in avcodec_open2()
  svq3: Prevent illegal reads while parsing extradata.
  remove ParseContext1
  vc1: use ff_parse_close
  mpegvideo parser: move specific fields into private context
  ...

Conflicts:
	libavcodec/4xm.c
	libavcodec/aacdec.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/mpeg4video_parser.c
	libavcodec/svq3.c
	libavcodec/v210enc.c
	libavformat/cafdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-11 01:22:22 +01:00
Ronald S. Bultje 45b7bd7c53 h264: disallow constrained intra prediction modes for luma.
Conversion of the luma intra prediction mode to one of the constrained
("alzheimer") ones can happen by crafting special bitstreams, causing
a crash because we'll call a NULL function pointer for 16x16 block intra
prediction, since constrained intra prediction functions are only
implemented for chroma (8x8 blocks).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-09 22:57:01 -08:00
Michael Niedermayer c065255bba Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacenc: Fix LONG_START windowing.
  aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
  avplay: use the correct array size for stride.
  lavc: extend doxy for avcodec_alloc_context3().
  APIchanges: mention avcodec_alloc_context()/2/3
  avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS.
  aacsbr: ARM NEON optimised sbrdsp functions
  aacsbr: align some arrays
  aacsbr: move some simdable loops to function pointers
  cosmetics: Remove extra newlines at EOF

Conflicts:
	libavcodec/utils.c
	libavfilter/formats.c
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-29 00:34:59 +01:00
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Michael Niedermayer 38331d2036 h264: disable checking reader, overreads are not possible
in ffmpegs h264 decoder.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-18 03:17:44 +01:00
Michael Niedermayer 8bc7fe4daf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  doxygen: misc consistency, spelling and wording fixes
  vcr1: drop unnecessary emms_c() calls without MMX code
  Replace all uses of av_close_input_file() with avformat_close_input().
  lavf: add avformat_close_input().
  lavf: deprecate av_close_input_stream().
  lavf doxy: add some basic demuxing documentation.
  lavf doxy: add some general lavf information.
  lavf doxy: add misc utility functions to a group.
  lavf doxy: add av_guess_codec/format to the encoding group.
  lavf doxy: add core functions to a doxy group.
  Add basic libavdevice documentation.
  lavc: convert error_recognition to err_recognition.
  avconv: update -map option help text
  x86: Require 7 registers for the cabac asm
  x86: bswap: remove test for bswap instruction
  bswap: make generic implementation more compiler-friendly
  h264: remove useless cast
  proresdec: fix decode_slice() prototype

Conflicts:
	configure
	doc/APIchanges
	ffprobe.c
	libavcodec/avcodec.h
	libavcodec/celp_math.h
	libavcodec/h264.c
	libavfilter/src_movie.c
	libavformat/anm.c
	libavformat/avformat.h
	libavformat/version.h
	libavutil/avstring.h
	libavutil/bswap.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-13 00:39:48 +01:00
Diego Biurrun 58c42af722 doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01:00
Baptiste Coudurier 76741b0e56 h264: 4:2:2 intra decoding support
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-10-21 01:00:41 -07:00
Michael Niedermayer b81f8880e0 Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
  fix AC3ENC_OPT_MODE_ON/OFF
  h264: fix HRD parameters parsing
  prores: implement multithreading.
  prores: idct sse2/sse4 optimizations.
  swscale: use aligned move for storage into temporary buffer.
  prores: extract idct into its own dspcontext and merge with put_pixels.
  h264: fix invalid shifts in init_cavlc_level_tab()
  intfloat_readwrite: fix signed addition overflows
  mov: do not misreport empty stts
  mov: cosmetics, fix for and if spacing
  id3v2: fix NULL pointer dereference
  mov: read album_artist atom
  mov: fix disc/track numbers and totals
  doc: fix references to obsolete presets directories for avconv/ffmpeg
  flashsv: return more meaningful error value
  flashsv: fix typo in av_log() message
  smacker: validate channels and sample format.
  smacker: check buffer size before reading output size
  smacker: validate number of channels
  smacker: Separate audio flags from sample rates in smacker demuxer.
  ...

Conflicts:
	cmdutils.h
	doc/ffmpeg.texi
	libavcodec/Makefile
	libavcodec/motion_est_template.c
	libavformat/id3v2.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-12 05:40:57 +02:00
Mans Rullgard 8babfc033e h264: fix invalid shifts in init_cavlc_level_tab()
The level_code expression includes a shift which is invalid in
those cases where the value is not used.  Moving the calculation
to the branch where the result is used avoids these.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-11 15:00:56 +01:00
Laurent Aimar a4fd95b5d5 h264: fix intra 16x16 mode check when using mbaff and constrained_intra_pred.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-02 21:20:57 +02:00
Baptiste Coudurier 231a6df9ea h264dec: h264: 4:2:2 intra decoding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-08-15 00:39:55 +02:00
Michael Niedermayer e10979ff56 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  changelog: misc typo and wording fixes
  H.264: add filter_mb_fast support for >8-bit decoding
  doc: Remove outdated comments about gcc 2.95 and gcc 3.3 support.
  lls: use av_lfg instead of rand() in test program
  build: remove unnecessary dependency on libs from 'all' target
  H.264: avoid redundant alpha/beta calculations in loopfilter
  H.264: optimize intra/inter loopfilter decision
  mpegts: fix Continuity Counter error detection
  build: remove unnecessary FFLDFLAGS variable
  vp8/mt: flush worker thread, not application thread context, on seek.
  mt: proper locking around release_buffer calls.
  DxVA2: unbreak build after [657ccb5ac7]
  hwaccel: unbreak build
  Eliminate FF_COMMON_FRAME macro.

Conflicts:
	Changelog
	Makefile
	doc/developer.texi
	libavcodec/avcodec.h
	libavcodec/h264.c
	libavcodec/mpeg4videodec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-12 01:42:32 +02:00
Diego Biurrun 657ccb5ac7 Eliminate FF_COMMON_FRAME macro.
FF_COMMON_FRAME holds the contents of the AVFrame structure and is also copied
to struct Picture.  Replace by an embedded AVFrame structure in struct Picture.
2011-07-11 00:19:00 +02:00
Michael Niedermayer 976a8b2179 Merge remote-tracking branch 'qatar/master'
* qatar/master: (40 commits)
  H.264: template left MB handling
  H.264: faster fill_decode_caches
  H.264: faster write_back_*
  H.264: faster fill_filter_caches
  H.264: make filter_mb_fast support the case of unavailable top mb
  Do not include log.h in avutil.h
  Do not include pixfmt.h in avutil.h
  Do not include rational.h in avutil.h
  Do not include mathematics.h in avutil.h
  Do not include intfloat_readwrite.h in avutil.h
  Remove return statements following infinite loops without break
  RTSP: Doxygen comment cleanup
  doxygen: Escape '\' in Doxygen documentation.
  md5: cosmetics
  md5: use AV_WL32 to write result
  md5: add fate test
  md5: include correct headers
  md5: fix test program
  doxygen: Drop array size declarations from Doxygen parameter names.
  doxygen: Fix parameter names to match the function prototypes.
  ...

Conflicts:
	libavcodec/x86/dsputil_mmx.c
	libavformat/flvenc.c
	libavformat/oggenc.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-04 00:45:21 +02:00
Jason Garrett-Glaser 3b7ebeb4d5 H.264: faster write_back_*
Avoid aliasing, unroll loops, and inline more functions.
2011-07-03 15:05:55 -07:00
Michael Niedermayer c137fdd778 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  swscale: remove misplaced comment.
  ffmpeg: fix streaming to ffserver.
  swscale: split out RGB48 output functions from yuv2packed[12X]_c().
  build: move vpath directives to main Makefile
  swscale: fix JPEG-range YUV scaling artifacts.
  build: move ALLFFLIBS to a more logical place
  ARM: factor some repetitive code into macros
  Fix SVQ3 after adding 4:4:4 H.264 support
  H.264: fix CODEC_FLAG_GRAY
  4:4:4 H.264 decoding support
  ac3enc: fix allocation of floating point samples.

Conflicts:
	ffmpeg.c
	libavcodec/dsputil_template.c
	libavcodec/h264.c
	libavcodec/mpegvideo.c
	libavcodec/snow.c
	libswscale/swscale.c
	libswscale/swscale_internal.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-15 02:15:25 +02:00
Jason Garrett-Glaser c90b94424c 4:4:4 H.264 decoding support
Note: this is 4:4:4 from the 2007 spec revision, not the previous (now deprecated) 4:4:4 mode in H.264.
2011-06-13 21:16:30 -07:00
Jason Garrett-Glaser 504811baea Roll back 4:4:4 H.264 for now
Needs some ARM/PPC asm modifications.
2011-06-13 13:38:46 -07:00
Jason Garrett-Glaser c9c493872c 4:4:4 H.264 decoding support
Note: this is 4:4:4 from the 2007 spec revision, not the previous (now deprecated) 4:4:4 mode in H.264.
2011-06-13 12:21:39 -07:00
Michael Niedermayer 59eb12faff Merge remote branch 'qatar/master'
* qatar/master: (30 commits)
  AVOptions: make default_val a union, as proposed in AVOption2.
  arm/h264pred: add missing argument type.
  h264dsp_mmx: place bracket outside #if/#endif block.
  lavf/utils: fix ff_interleave_compare_dts corner case.
  fate: add 10-bit H264 tests.
  h264: do not print "too many references" warning for intra-only.
  Enable decoding of high bit depth h264.
  Adds 8-, 9- and 10-bit versions of some of the functions used by the h264 decoder.
  Add support for higher QP values in h264.
  Add the notion of pixel size in h264 related functions.
  Make the h264 loop filter bit depth aware.
  Template dsputil_template.c with respect to pixel size, etc.
  Template h264idct_template.c with respect to pixel size, etc.
  Preparatory patch for high bit depth h264 decoding support.
  Move some functions in dsputil.c into a new file dsputil_template.c.
  Move the functions in h264idct into a new file h264idct_template.c.
  Move the functions in h264pred.c into a new file h264pred_template.c.
  Preparatory patch for high bit depth h264 decoding support.
  Add pixel formats for 9- and 10-bit yuv420p.
  Choose h264 chroma dc dequant function dynamically.
  ...

Conflicts:
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/alpha/dsputil_alpha.c
	libavcodec/arm/dsputil_init_arm.c
	libavcodec/arm/dsputil_init_armv6.c
	libavcodec/arm/dsputil_init_neon.c
	libavcodec/arm/dsputil_iwmmxt.c
	libavcodec/arm/h264pred_init_arm.c
	libavcodec/bfin/dsputil_bfin.c
	libavcodec/dsputil.c
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_loopfilter.c
	libavcodec/h264_ps.c
	libavcodec/h264_refs.c
	libavcodec/h264dsp.c
	libavcodec/h264idct.c
	libavcodec/h264pred.c
	libavcodec/mlib/dsputil_mlib.c
	libavcodec/options.c
	libavcodec/ppc/dsputil_altivec.c
	libavcodec/ppc/dsputil_ppc.c
	libavcodec/ppc/h264_altivec.c
	libavcodec/ps2/dsputil_mmi.c
	libavcodec/sh4/dsputil_align.c
	libavcodec/sh4/dsputil_sh4.c
	libavcodec/sparc/dsputil_vis.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/dsputil_mmx.c
	libavformat/options.c
	libavformat/utils.c
	libavutil/pixfmt.h
	libswscale/swscale.c
	libswscale/swscale_internal.h
	libswscale/swscale_template.c
	tests/ref/seek/lavf_avi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-05-11 05:47:02 +02:00
Oskar Arvidsson fcc0224e4f Add support for higher QP values in h264.
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: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-10 07:24:35 -04:00
Oskar Arvidsson 6e3ef511d7 Add the notion of pixel size in h264 related functions.
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: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-10 07:24:33 -04:00
Stefano Sabatini ce5e49b0c2 replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_* 2011-05-02 16:41:41 +02:00
Stefano Sabatini 301183d9be replace deprecated av_get_pict_type_char() with av_get_picture_type_char() 2011-05-02 16:41:35 +02:00
Stefano Sabatini 975a1447f7 Replace deprecated FF_*_TYPE symbols with AV_PICTURE_TYPE_*.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-02 12:18:44 +02:00
Stefano Sabatini 6209669de4 Replace deprecated av_get_pict_type_char() with av_get_picture_type_char().
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-02 11:24:45 +02:00
Michael Niedermayer e7077f5e7b H264: replace pixel_size by pixel_shift
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-04-10 22:33:42 +02:00
Oskar Arvidsson d268bed209 Add support for higher QP values in h264.
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>
2011-04-10 22:33:42 +02:00
Oskar Arvidsson dc172ecc6e Add the notion of pixel size in h264 related functions.
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>
2011-04-10 22:33:41 +02:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Ronald S. Bultje 7f8c11b005 Set gray (128) U/V planes for chroma-less samples. Fixes two fate samples
when played with -flags emu_edge.
(cherry picked from commit 8bcfe7f7fd)
2011-01-21 20:36:01 +01:00
Ronald S. Bultje 772225c041 Revert 2a1f431d38, it broke H264 lossless.
(cherry picked from commit 66c6b5e2a5)
2011-01-21 20:36:01 +01:00
Ronald S. Bultje 66c6b5e2a5 Revert 2a1f431d38, it broke H264 lossless. 2011-01-20 17:24:44 -05:00
Ronald S. Bultje 8bcfe7f7fd Set gray (128) U/V planes for chroma-less samples. Fixes two fate samples
when played with -flags emu_edge.
2011-01-20 17:24:44 -05:00
Jason Garrett-Glaser 2a1f431d38 H.264/SVQ3: make chroma DC work the same way as luma DC
No speed improvement, but necessary for some future stuff.
Also opens up the possibility of asm chroma dc idct/dequant.

Originally committed as revision 26349 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-15 01:10:46 +00:00
Jason Garrett-Glaser 5657d14094 H.264: switch to x264-style tracking of luma/chroma DC NNZ
Useful so that we don't have to run the hierarchical DC iDCT if there aren't
any coefficients.  Opens up some future opportunities for optimization as well.

Originally committed as revision 26337 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-14 21:36:16 +00:00
Jason Garrett-Glaser 19fb234e4a H.264: split luma dc idct out and implement MMX/SSE2 versions
About 2.5x the speed.

NOTE: the way that the asm code handles large qmuls is a bit suboptimal.
If x264-style dequant was used (separate shift and qmul values), it might
be possible to get some extra speed.

Originally committed as revision 26336 to svn://svn.ffmpeg.org/ffmpeg/trunk
2011-01-14 21:34:25 +00:00
Jason Garrett-Glaser b70c95e05a H.264: 8% faster CAVLC zero-run decoding
Originally committed as revision 24736 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-07 12:30:44 +00:00
Diego Biurrun ba87f0801d Remove explicit filename from Doxygen @file commands.
Passing an explicit filename to this command is only necessary if the
documentation in the @file block refers to a file different from the
one the block resides in.

Originally committed as revision 22921 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-20 14:45:34 +00:00
Michael Niedermayer 9885284c22 Check level_prefix a bit (this just checks the max our bitreader can handle,
as i did nt find a limit in the spec)
This should stop cavlc_decode_residual() on a zero bitstream

Originally committed as revision 22429 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-10 09:55:03 +00:00
Michael Niedermayer 8897b247a5 Remove some unneeded fill_rectangle() for 16x16 blocks.
Originally committed as revision 22124 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-28 23:54:24 +00:00
Michael Niedermayer 69cc31832f Move check for and call of predict_field_decoding_flag() from the mb code to
the row code. This function would only be needed on a MB basis for MBAFF+FMO

Originally committed as revision 21860 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-17 02:14:02 +00:00
Michael Niedermayer c1bb66ac19 Split setting neighboring MBs from fill_decode_caches()
no speed change.

Originally committed as revision 21842 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-15 22:07:02 +00:00