Commit Graph

288 Commits

Author SHA1 Message Date
Michael Niedermayer
2a06c2a03e mpegvideo_enc: Draw edges on input for non-multiple of 16 resolutions
This improves motion estimation and avoids using uninitialized data
for resolutions that aren't a multiple of 16.

Prior to d2a25c40, the edges used to be initialized so that encoding
was deterministic, but after that commit it started using uninitialized
data (for non multiple of 16 resolutions).

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-01-23 15:05:49 +02:00
Vittorio Giovara
1c6183233d msmpeg4: check memory allocations and propagate errors
Bug-Id: CID 1257781
2015-01-06 16:43:54 +01:00
Martin Storsjö
91bfac759d h261enc: Disallow sliced encoding
This avoids trying to do sliced encoding, even if a slice/packet
size is requested (via the -ps option or the rtp_payload_size
field), since the encoder currently doesn't support it (or at least
our decoder can't decode it, even if the h261_encode_gob_header
function is hooked up to be called from the slicing part in
mpegvideo_enc.c).

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-12-18 12:00:01 +02:00
Vittorio Giovara
0a66647061 mpegvideo_enc: factor out denominator and explicitly cast operands
CC: libav-stable@libav.org
Bug-Id: CID 608053
2014-11-06 10:44:46 -05:00
Vittorio Giovara
e0a1d0a2b0 mpegvideo_enc: rework direct mode check
Remove stray semicolon and share codepaths.

CC: libav-stable@libav.org
Bug-Id: CID 991857
2014-11-06 10:44:46 -05:00
Anton Khirnov
530c1441fd lavc: make lmax/lmin into private options of mpegvideo encoders 2014-10-18 05:29:14 +02:00
Anton Khirnov
15ec053c4c lavc: make border_masking into private options of mpegvideo encoders 2014-10-18 05:28:40 +02:00
Anton Khirnov
c4f7bee087 lavc: deprecate unused mb_threshold field 2014-10-18 05:28:29 +02:00
Anton Khirnov
66a68ddd1a lavc: make rc_buffer_aggressivity/rc_initial_cplx into private options of mpegvideo encoders 2014-10-18 05:26:29 +02:00
Anton Khirnov
a75c2eb25a lavc: make rc_eq into private options of mpegvideo encoders 2014-10-18 05:23:51 +02:00
Anton Khirnov
946f95354b lavc: make rc_qmod_* into private options of mpegvideo encoders 2014-10-18 05:23:05 +02:00
Anton Khirnov
a6e4ce9fd5 lavc: make rc_qsquish a private option of mpegvideo encoders 2014-10-18 05:21:50 +02:00
Diego Biurrun
1274ea8dba Split off floating point AAN (I)DCT into separate components 2014-09-07 13:36:26 -07:00
Gabriel Dume
f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Diego Biurrun
835f798c7d mpegvideo: cosmetics: Lowercase ugly uppercase MPV_ function name prefixes 2014-08-15 01:26:33 -07:00
John Stebbins
998c9f15d1 idct: remove call to ff_idctdsp_init from ff_MPV_common_init
One step in untangling the mpegvideo code and fixing some problems in
the order that initialization is being done in h263dec and h261dec.
2014-08-14 07:58:49 -07:00
Diego Biurrun
d8520d3ee0 mpegvideo: Move QMAT_SHIFT* defines to the only place they are used 2014-07-25 12:00:53 -07:00
Diego Biurrun
2b6ab3a2bd mpegvideo: Move QUANT_BIAS_SHIFT define to the only place it is used 2014-07-23 03:16:55 -07:00
Diego Biurrun
b4987f7219 idct: Convert IDCT permutation #defines to an enum
Also rename the enum values to be consistent with other DCT permutations.
2014-07-18 07:51:03 -07:00
Diego Biurrun
2d60444331 dsputil: Split motion estimation compare bits off into their own context 2014-07-17 09:07:10 -07:00
Diego Biurrun
f46bb608d9 dsputil: Split off pixel block routines into their own context 2014-07-09 08:05:26 -07:00
Diego Biurrun
a9aee08d90 dsputil: Split off FDCT bits into their own context 2014-07-07 12:28:45 -07:00
Diego Biurrun
3c650efb81 dsputil: Move draw_edges() to mpegvideoencdsp 2014-07-06 14:48:50 -07:00
Diego Biurrun
c166148409 dsputil: Move pix_sum, pix_norm1, shrink function pointers to mpegvideoenc 2014-07-06 14:26:53 -07:00
Diego Biurrun
8d686ca59d dsputil: Split off *_8x8basis to a separate context 2014-07-06 13:09:24 -07:00
Diego Biurrun
e3fcb14347 dsputil: Split off IDCT bits into their own context 2014-06-30 07:58:46 -07:00
Diego Biurrun
adcb8392c9 mjpeg: Split off bits shared by MJPEG and LJPEG encoders
This obviates a dependency of the LJPEG encoder on mpegvideo.
2014-06-30 07:53:40 -07:00
Diego Biurrun
5dd8c08fd5 mpeg: Change ff_convert_matrix() to take an MpegEncContext parameter
This will come in handy during dsputil splitting.
2014-06-27 05:17:11 -07:00
Vittorio Giovara
d7705be961 mpegvideoenc: check color_range
Rework the comparison into something simpler to understand.
2014-06-10 19:41:59 -04:00
Diego Biurrun
368f50359e dsputil: Split off quarterpel bits into their own context 2014-05-29 06:48:31 -07:00
Anton Khirnov
a2941c8cb2 lavc: move CODEC_FLAG_MV0 to mpegvideo 2014-05-01 09:24:18 +02:00
Anton Khirnov
b2c31710c9 lavc: move CODEC_FLAG_NORMALIZE_AQP to mpegvideo 2014-05-01 09:23:19 +02:00
Anton Khirnov
5fccedaa67 lavc: deprecate CODEC_FLAG_INPUT_PRESERVED
The addition of reference-counted frames makes it pointless.
2014-05-01 09:22:47 +02:00
Michael Niedermayer
1c7b71a5bd mpegvideo: Use the current_picture pts
The picture slot can be recycled by select_input_picture and
only current_picture is populated with the valid pts.

Unbreak timestamps when in cbr mode.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-04-21 21:58:58 +02:00
wm4
f6774f905f mpegvideo: operate with pointers to AVFrames instead of whole structs
The most interesting parts are initialization in ff_MPV_common_init() and
uninitialization in ff_MPV_common_end().

ff_mpeg_unref_picture and ff_thread_release_buffer have additional NULL
checks for Picture.f, because these functions can be called on
uninitialized or partially initialized Pictures.

NULL pointer checks are added to ff_thread_release_buffer() stub function.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-04-09 02:12:19 +02:00
Vittorio Giovara
e0c16e4e32 mpegvideo: move mpegvideo formats-related defines to mpegutils.h 2014-03-16 23:04:41 +01:00
Diego Biurrun
05563ccacc dsputil: cosmetics: Lose camelCase on ff_cropTbl and ff_squareTbl names
Also switch from "tbl" to "tab" name suffixes.
2014-03-13 08:12:44 -07:00
Diego Biurrun
9103185bd1 dsputil: Drop ff_check_alignment() function
The function is supposed to confirm that the compiler provided enough
alignment, but in practice it is only run in certain code paths and
insufficient alignment problems are restricted to legacy compilers.
2014-03-13 05:50:28 -07:00
Janne Grunau
fb0c9d41d6 avutil: remove timer.h include from internal.h
Added libavutil/timer.h include to all files with {START,STOP}_TIMER.
2014-01-25 21:50:20 +01:00
Martin Storsjö
cff480e49d mpegvideo_enc: Don't call ff_h263dsp_init unconditionally
This fixes builds with e.g. --disable-decoders --disable-encoders
--enable-encoder=mjpeg.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-01-22 18:42:38 +02:00
Anton Khirnov
ebfe622bb1 mpegvideo: drop support for real (non-emulated) edges
Several decoders disable those anyway and they are not measurably faster
on x86. They might be somewhat faster on other platforms due to missing
emu edge SIMD, but the gain is not large enough (and those decoders
relevant enough) to justify the added complexity.
2014-01-09 09:41:19 +01:00
Anton Khirnov
aec25b1c46 mpegvideo: split the encoding-only parts of frame_start() into a separate function
This introduces some code duplication. However, much of it should go
away once the decoders stop using MpegEncContext.
2014-01-03 16:52:49 +01:00
Anton Khirnov
24abd806ea ljpegenc: deMpegEncContextize
The encoder uses almost none of the mpegvideo infrastructure, only some
fields from MpegEncContext.

The FATE results change because now an all-zero quant matrix is written
into the file. Since it is not used for anything for ljpeg, this should
not be a problem.
2013-12-05 13:35:55 +01:00
Anton Khirnov
3360ad9955 mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_picture_trailer()
This will allow deMpegEncContextizing the LJPEG encoder.
2013-12-05 13:35:15 +01:00
Anton Khirnov
058d5f2feb mjpegenc: do not pass MpegEncContext to ff_mjpeg_encode_picture_header()
This will allow deMpegEncContextizing the LJPEG encoder.
2013-12-05 13:34:26 +01:00
Anton Khirnov
0b0a7a751d mpegvideo: move encode-only parts of common_end() to encode_end() 2013-12-05 13:25:26 +01:00
Anton Khirnov
381a722562 mpegvideo: split the encoding-only parts of ff_MPV_frame_end() into a separate function 2013-12-05 13:23:55 +01:00
Anton Khirnov
1f8eb69079 mpegvideo: move encoding-only initialization from common_init() to encode_init() 2013-12-05 13:23:03 +01:00
Anton Khirnov
bedf952bb8 mpegvideo: move setting encoding-only vars from common_defaults() to encode_defaults() 2013-12-05 13:22:55 +01:00
Diego Biurrun
8f8bc92365 Add missing #includes for *INT64_MAX and *INT64_C 2013-11-23 21:55:52 +01:00
Anton Khirnov
1c01b0253e mpegvideo_enc: use the AVFrame API properly. 2013-11-16 17:51:10 +01:00
Ronald S. Bultje
458446acfa lavc: Edge emulation with dst/src linesize
Allow supporting files for which the image stride is smaller than
the maximum block size + number of subpel mc taps, e.g. a 64x64 VP9
file or a 16x16 VP8 file with -fflags +emu_edge.
2013-11-15 10:16:27 +01:00
Anton Khirnov
aa24122989 lavc: deprecate FF_MAX_B_FRAMES
We should not arbitrarily decide the maximum B-frame number for all
encoders supported by Libav, each encoder should be able to set its own
limits.
2013-11-14 09:41:03 +01:00
Anton Khirnov
8941971a8f lavc: make error_rate a private option of mpegvideo encoders 2013-11-14 09:39:43 +01:00
Diego Biurrun
0338c39698 dsputil: Split off H.263 bits into their own H263DSPContext 2013-11-08 12:40:47 +01:00
Ronald S. Bultje
93f305473f lavc: Convert some remaining strides to ptrdiff_t 2013-10-15 23:58:20 +02:00
Diego Biurrun
b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Vittorio Giovara
22c879057e mpegvideo_enc: drop outdated copy_picture_attributes() in favour of a modern av_frame_copy_props()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-07 20:48:15 +02:00
Diego Biurrun
2832ea26f3 Remove commented-out debug #define cruft 2013-05-16 00:23:30 +02:00
Diego Biurrun
004b81c465 mpegvideo: Remove commented-out PARANOID debug cruft 2013-05-15 23:53:42 +02:00
Ronald S. Bultje
f4fed5a2f9 mpegvideo: Use hpeldsp instead of dsputil for half-pel functions
This also converts vc1, since that is mpegvideo-based.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-04-19 23:18:21 +03:00
Diego Biurrun
66ac3dbf1e h261: Move function declarations to h261.h 2013-04-05 12:25:12 +02:00
Diego Biurrun
eee2000b41 mpeg12: Move some ff_mpeg1_* function declarations to a more suitable place 2013-03-27 14:21:45 +01:00
Anton Khirnov
07054015cf mpegvideo: remove FMT_H264 2013-03-11 18:24:25 +01:00
Anton Khirnov
3b0f586f07 lavc: remove disabled FF_API_MPV_GLOBAL_OPTS cruft 2013-03-09 08:36:40 +01:00
Anton Khirnov
759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Anton Khirnov
6e7b50b427 mpegvideo_enc: drop support for reusing the input motion vectors.
This misfeature is most likely completely useless and conflicts with
removing the mpegvideo-specific fields from AVFrame. In the improbable
case it is actually useful, it should be reimplemented in a better way.
2013-03-08 07:37:45 +01:00
Anton Khirnov
54974c6298 error_resilience: decouple ER from MpegEncContext 2013-02-15 16:10:11 +01:00
Diego Biurrun
5d3d39c72e dsputil: Move fdct function declarations to dct.h 2013-02-09 00:08:28 +01:00
Diego Biurrun
218aefce44 dsputil: Move LOCAL_ALIGNED macros to libavutil 2013-02-08 23:13:37 +01:00
Anton Khirnov
04f4dbc2fa mpegvideo_enc: fix indentation in load_input_picture() 2013-01-26 13:08:38 +01:00
Anton Khirnov
3f47d316cd mpegvideo_enc: do not modify the input frame. 2013-01-26 13:08:32 +01:00
Diego Biurrun
88bd7fdc82 Drop DCTELEM typedef
It does not help as an abstraction and adds dsputil dependencies.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2013-01-22 18:32:56 -08:00
Ronald S. Bultje
8c53d39e7f lavc: introduce VideoDSPContext
Move some functions from dsputil. The idea is that videodsp contains
functions that are useful for a large and varied set of video decoders.
Currently, it contains emulated_edge_mc() and prefetch().

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2012-12-20 13:40:45 +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
Luca Barbato
c1a02e884a pixdesc: add av_pix_fmt_get_chroma_sub_sample
Deprecate avcodec_get_chroma_sub_sample.
2012-11-13 16:14:55 +01:00
Diego Biurrun
9734b8ba56 Move avutil tables only used in libavcodec to libavcodec. 2012-10-11 18:29:36 +02: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
Diego Biurrun
9c6cf7f2c9 avcodec: Drop silly and/or broken printf debug output 2012-10-01 10:24:28 +02:00
Diego Biurrun
6f6b0311a3 avcodec: Drop some silly commented-out av_log() invocations 2012-10-01 10:24:28 +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
Michael Niedermayer
19000122a4 mpegvideo_enc: remove assert that has become obsolete with the new API
It now just checks uninitialized and unused data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-09-04 18:37:58 +03:00
Diego Biurrun
d211547ddd x86: mpegvideoenc: Split optimizations off into a separate file 2012-08-24 02:23:16 +02:00
Anton Khirnov
677e763a55 mpegvideo_enc: remove stray duplicate line from 7f9aaa4 2012-08-20 10:05:49 +02:00
Anton Khirnov
7f9aaa499b mpegvideo_enc: don't use deprecated avcodec_encode_video(). 2012-08-18 08:48:30 +02:00
Mans Rullgard
7a851153d3 mpegvideo: convert mpegvideo_common.h to a .c file
This file defines a single, huge function, MPV_motion(), which
although being declared inline is not actually inlined by the
compiler (for good reason).  There is thus no sense in defining
this function in a header file, resulting in multiple copies of
it in the final library.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-08-09 01:31:37 +01:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02: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
Diego Biurrun
856c8e0a04 faandct: Remove FAAN_POSTSCALE define and related code.
It is not a user-accessible option and unlikely to ever be changed.
2012-03-28 09:38:31 +02:00
Diego Biurrun
47c0ac96aa Replace AVFrame pointer casts by proper struct member accesses. 2012-03-01 23:11:11 +01:00
Martin Storsjö
bdc1220eeb h263enc: Add an option for outputting info about MBs as side data
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-01 16:08:31 +02:00
Anton Khirnov
23bfcc066d mpegvideo_enc: add quantizer_noise_shaping private option.
Deprecate corresponding AVCodecContext field.
2012-02-29 07:26:24 +01:00
Anton Khirnov
63efd83ae1 mpegvideo_enc: add chroma/luma_elim_threshold private options.
Deprecate corresponding AVCodecContext fields.
2012-02-29 07:23:31 +01:00
Anton Khirnov
af3d804f9f mpegvideo_enc: add cbp_rd flag to mpv_flags.
Deprecate CODEC_FLAG_CBP_RD.
2012-02-29 07:13:58 +01:00
Anton Khirnov
ff71a383ac mpegvideo_enc: add qp_rd flag to mpv_flags.
Deprecate CODEC_FLAG_QP_RD.
2012-02-29 07:12:10 +01:00
Anton Khirnov
a249f0cc23 mpegvideo_enc: add strict_gop flag to mpv_flags.
Deprecate CODEC_FLAG2_STRICT_GOP.
2012-02-29 07:11:02 +01:00
Anton Khirnov
ed019b8e5b lavc: add -mpv_flags to mpegvideo_enc-based encoders.
Deprecate CODEC_FLAG2_SKIP_RD in favor of the corresponding mpv_flags
flag.
2012-02-29 07:09:29 +01:00
Anton Khirnov
5d42ac7ffb mpegvideo_enc: only allocate output packet when we know there will be output
Fixes a memleak.
2012-02-21 22:47:01 +01:00
Anton Khirnov
445a7d48b1 mpegvideo_enc: switch to encode2(). 2012-02-19 08:26:30 +01:00