Commit Graph

467 Commits

Author SHA1 Message Date
Anton Khirnov 5823686261 mpeg12: do not decode extradata more than once.
Fixes CVE-2012-2803.

CC: libav-stable@libav.org
2012-12-19 22:32:54 +01:00
Janne Grunau f1d8763a02 mpegvideo: allocate scratch buffers after linesize is known
Since we can't know which stride a custom get_buffer() implementation is
going to use we have to allocate this scratch buffers after the linesize
is known. It was pretty safe for 8 bit per pixel pixel formats since we
always allocated memory for up to 16 bits per pixel. It broke hoever
with cmdutis.c's alloc_buffer() and high pixel bit depth since it
allocated larger edges than mpegvideo expected.

Fixes fuzzed sample nasa-8s2.ts_s244342.
2012-12-18 19:48:30 +01:00
Martin Storsjö eaa9b2e66c avcodec: Rename avpriv_frame_rate_tab to ff_mpeg12_frame_rate_tab
This table doesn't need to be shared with libavformat any longer.
Add mpeg12 to the name to make it less ambiguous, while renaming it.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 14:26:14 +03:00
Anton Khirnov 716d413c13 Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat 2012-10-08 07:13:26 +02:00
Diego Biurrun 1218777ffd avcodec: Convert some commented-out printf/av_log instances to av_dlog 2012-10-01 10:24:28 +02:00
Anton Khirnov 0f583d20d5 mpeg12: fix the semantics of the int* parameter of decode()
It is got_output, not data_size.
2012-09-29 19:18:39 +02:00
Anton Khirnov d9a2e87b1c mpeg12: move mpeg_decode_frame() lower
Avoids a forward declaration of decode_chunks().
2012-09-29 19:18:24 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Hendrik Leppkes 1d4a01474d mpeg12: fixed parsing in some mpeg2 streams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-05-03 12:15:52 -04:00
Mans Rullgard 2bcbd98459 Remove lowres video decoding
This feature is complex, of questionable utility, and slows down
normal decoding.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-04-21 18:56:19 +01:00
Gwenole Beauchesne 9cb150c9ab hwaccel: mpeg2: decode first field, if requested.
If user opted to present fields as they come, then the first field
picture needs to be submitted to the HW for decoding. In particular,
this fixes MPEG-2 decoding of interlaced streams.

Tested on Intel Cedar Trail, Sandy Bridge and Ivy Bridge platforms.
Someone reported on the ffmpeg-devel@ list this also works on DXVA
(Windows) and other Linux platforms (NVIDIA, through the VA wrapper).

This also means a similar patch to non-hwaccel VDPAU may be necessary.

Note: I believe the SLICE_FLAG_ALLOW_FIELD is useless since the first
field shall always be submitted to the HW anyway. Nobody uses HW accels
(dxva, vaapi, vdpau, etc.) without that flag though.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-08 13:08:52 +03:00
Martin Storsjö 00c3b67b8a cosmetics: Align codec declarations
Also break some long lines, remove codec function placeholder comments
and add spaces in sample/pixel format lists.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 22:37:38 +03:00
Anne Aaron fdf3a749d3 mpeg12: Do not change frame_pred_frame_dct flag and demote error into a warning
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 18:32:17 +03:00
Anton Khirnov 02beb9826b lavc: deprecate AVCodecContext.sub_id.
In most places where it's used, it's as a pointless write-only field.

Only rv10 decoder actually reads from it, but it stores some internal
version info in it. There is no reason for it to be in a public field.
2012-03-04 21:02:45 +01:00
Diego Biurrun 324deaa268 Replace AVFrame pointer type punning by proper struct member assignments. 2012-03-01 23:11:13 +01:00
Martin Storsjö efd29844eb mpegvideo: Add ff_ prefix to nonstatic functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-02-15 22:07:23 +02: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
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Jindřich Makovička a85ce653fb mpeg12: check for available bits to avoid an infinite loop
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-01-19 14:14:21 +01:00
Diego Biurrun 3dc99a18d4 cosmetics: drop some pointless parentheses 2012-01-07 22:13:07 +01:00
Janne Grunau 881a5e047d mpegenc: use avctx->slices as number of slices
Adds a new member to MpegEncContext to hold the number of used slice
contexts. Fixes segfaults with '-threads 17 -thread_type slice' and
fate-vsynth{1,2}-mpeg{2,4}thread{,_ilace} with --disable-pthreads.
2012-01-02 19:20:23 +01:00
Luca Barbato 5bf2ac2b37 error_resilience: use the ER_ namespace
Add the namespace to {AC_,DC_,MV_}{END,ERROR} macros

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-12-13 16:20:58 +01:00
Diego Biurrun 58c42af722 doxygen: misc consistency, spelling and wording fixes 2011-12-12 23:06:23 +01:00
Anton Khirnov 15946eb8a9 lavc: remove "legacy" mpegvideo decoder. 2011-10-27 23:06:26 +02:00
Janne Grunau d99fe3a478 mpeg12: fix mpeg_decode_slice context parameter type
During slice threading only MpegEncContext is passed to
mpeg_decode_slice, remove a wrong cast and change the function
definition to take MpegEncContext pointer.
2011-10-24 01:05:00 +02:00
Janne Grunau cd8c64e197 Revert "mpeg12: move full_pel from MpegEncContext to Mpeg1Context"
This reverts commit da22ba7df4 since it
broke slice threading. Slice threading just duplicates MpegEncContext
so every value used during mpeg_decode_slice has to be in it.
A second patch will fix the illusion that Mpeg1Context is available
in mpeg_decode_slice.
2011-10-24 00:59:41 +02:00
Anton Khirnov 3fc0830432 mpeg12: move closed_gop from MpegEncContext to Mpeg1Context
It's MPEG-1/2 specific.
2011-10-23 14:15:56 +02:00
Anton Khirnov da22ba7df4 mpeg12: move full_pel from MpegEncContext to Mpeg1Context
It's MPEG-1 specific.
2011-10-23 14:14:39 +02:00
Anton Khirnov cc05a45d33 mpeg12: move Mpeg1Context from mpeg12.c to mpeg12.h
It will be used in vdpau code.
2011-10-23 14:14:34 +02:00
Dustin Brody 9abc98737f lavc: replace references to deprecated AVCodecContext.error_recognition to use AVCodecContext.err_recognition
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-10-22 14:49:55 +02:00
Anton Khirnov 9138a130cd lavc: use avpriv_ prefix for ff_frame_rate_tab.
It's used in lavf.
2011-10-20 21:06:58 +02:00
Anton Khirnov 773375c3d0 lavc: rename ff_find_start_code to avpriv_mpv_find_start_code
It's used in lavf.
2011-10-20 21:06:58 +02:00
Steven Walters 27237d524e w32threads: support for frame multithreading
Replace our incomplete w32threads implementation with x264's pthreads
w32threads wrapper.
Relicensed to LGPL with kind permission by Pegasys Inc.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-16 21:45:16 +02:00
Mans Rullgard aa498fef0d mpeg124: use sign_extend() function
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-10-09 23:22:14 +01:00
Anton Khirnov e5b29c1f6b lavc: replace some deprecated FF_*_TYPE with AV_PICTURE_TYPE_* 2011-09-21 13:51:53 +02:00
Diego Biurrun a05ea77c9f mpeg12: reorder functions to avoid ugly forward declarations 2011-09-13 15:53:05 +02:00
Diego Biurrun 6192b6f3e7 mpeg12: cosmetics: reformat as K&R 2011-09-06 11:46:57 +02:00
Dustin Brody ff17fc6353 mpeg12: propagate more real return values through chunk decode error return and fix some indentation
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-05 11:19:14 +02:00
Dustin Brody 09c274e067 mpeg12: propagate chunk decode errors and fix conditional indentation
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-08-25 15:49:28 -07:00
Dustin Brody 2bfdb34c8a mpeg12: remove repeat-field code disabled since May 2002
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-08-15 13:03:20 +02:00
Anton Khirnov ec6402b7c5 lavc: use designated initialisers for all codecs.
It's more readable and less prone to breakage.
2011-07-29 08:42:34 +02:00
Ronald S. Bultje cdc5a3a194 mpeg1video: add CODEC_CAP_SLICE_THREADS. 2011-07-13 12:41:45 -07: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
Mans Rullgard add41decd9 Remove return statements following infinite loops without break
These statements cannot be reached and are thus not needed.
This removes a number of compiler warnings.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:39:07 +01:00
Michael Niedermayer d8999306e5 mpeg12: more advanced ffmpeg mpeg2 aspect guessing code.
Fixes issue1613, 621, 562 simultaneously

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-06-10 09:06:02 +02:00
Mans Rullgard e65ab9d94f Remove unused variables 2011-06-02 20:06:00 +01:00
Alexander Strange 6a9c859444 H264/MPEG frame-level multi-threading.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-06-02 10:16:20 -07:00
Ronald S. Bultje 508a24f8dc mpeg12: add slice-threading checks to slice-threading initializers.
Fixes "make THREADS=2 THREAD_TYPE=1 fate-mpeg2-field-enc".
2011-05-18 06:54:15 -04: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 62d33dbc17 mpeg12: terminate mpeg2_video_profiles arrays
Make av_get_profile_name() return NULL if no profile is detected.

Fix trac issue #130, fix crash reading file tek3.m2v.
(cherry picked from commit e5d80c7b2d)

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-04-28 11:07:31 +02:00