1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-12 19:18:44 +02:00
Commit Graph

106753 Commits

Author SHA1 Message Date
Anton Khirnov
15975881ae lavc/encode: factor audio/video-specific parts out of ff_encode_preinit() 2022-04-13 12:45:47 +02:00
Anton Khirnov
ce3c20f2aa lavc: move default get_buffer2() to its own file
It is also used by some encoders, so decode.c is not the right place for
it.
2022-04-13 12:15:02 +02:00
Anton Khirnov
32413600e8 lavc/encode: drop EncodeSimpleContext
It has only a single member.
2022-04-13 12:14:30 +02:00
Anton Khirnov
1c01dca144 lavc/avcodec: only allocate the encoding frame for encoders
And only when needed, i.e. for encoders using the simple API.
2022-04-13 12:14:08 +02:00
Anton Khirnov
7efa6418b8 lavc/avcodec: simplify codec id/type validity checking
On entry to avcodec_open2(), the AVCodecContext type and id either have
to be UNKNOWN/NONE or have to match the codec to be used.
2022-04-13 12:13:15 +02:00
Anton Khirnov
4a7c8bb3d8 fftools/ffmpeg: store output format separately from the muxer context
Allows accessing it without going through the muxer context. This will
be useful in the following commits, where the muxer context will be
hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov
5c66ee6351 fftools/ffmpeg: move freeing the output file to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov
5bc644ea8a fftools/ffmpeg: move writing the trailer to ffmpeg_mux.c 2022-04-13 12:07:54 +02:00
Anton Khirnov
288aa37387 fftools/ffmpeg: move some muxing-related code into a separate file
This is a first step towards making muxers more independent from the
rest of the code.
2022-04-13 12:07:54 +02:00
Anton Khirnov
b1a984cb49 fftools/ffmpeg: store the output file index in OutputFile
Use it to simplify check_init_output_file(). Will allow further
simplifications in the following commits.
2022-04-13 12:07:54 +02:00
Anton Khirnov
16aea9a38b fftools/ffmpeg: pass the muxer context explicitly to some functions
Stop accessing OutputFile.ctx. This will be useful in the following
commits, where it will become hidden.
2022-04-13 12:07:54 +02:00
Anton Khirnov
662364b2ef fftools/ffmpeg: stop using OutputStream.frame_number for streamcopy
This field is currently used by checks
- skipping packets before the first keyframe
- skipping packets before start time
to test whether any packets have been output already. But since
frame_number is incremented after the bitstream filters are applied
(which may involve delay), this use is incorrect. The keyframe check
works around this by adding an extra flag, the start-time check does
not.

Simplify both checks by replacing the seen_kf flag with a flag tracking
whether any packets have been output by do_streamcopy().
2022-04-13 12:07:54 +02:00
Anton Khirnov
86e1c0303c fftools/ffmpeg: move a comment to a more appropriate place 2022-04-13 12:07:54 +02:00
Anton Khirnov
a8c95e1feb fftools/ffmpeg: drop an obsolete hack
Introduced in 05741d70c7. All encoders should set the timestamps
properly now, so it should never be necessary.
2022-04-13 12:07:54 +02:00
Paul B Mahol
9a22c6508a avfilter/vf_deblock: fix posible overreads 2022-04-13 10:25:08 +02:00
Paul B Mahol
b74f212b7a avfilter/vf_xmedian: simplify changing index variable 2022-04-13 09:54:20 +02:00
Paul B Mahol
9d40fe20c9 avfilter/af_crystalizer: remove no longer needed wrapper function 2022-04-13 09:41:14 +02:00
Paul B Mahol
63d12a48b5 avfilter/vf_chromashift: simplify handling of commands 2022-04-13 09:30:36 +02:00
Wenbin Chen
7e7b3a4c28 libavutil/hwcontext_qsv: Align width and heigh when download qsv frame
The width and height for qsv frame to download need to be
aligned with 16. Add the alignment operation.
Now the following command works:
ffmpeg -hwaccel qsv -f rawvideo -s 1920x1080 -pix_fmt yuv420p -i \
input.yuv -vf "hwupload=extra_hw_frames=16,format=qsv,hwdownload, \
format=nv12" -f null -

Signed-off-by: Wenbin Chen <wenbin.chen@intel.com>
Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
2022-04-13 13:41:27 +08:00
Andreas Rheinhardt
7427b87e44 avcodec/mss12: Constify slice context->parent context pointer
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:37:13 +02:00
Andreas Rheinhardt
77ed56f0ec avcodec/vbnenc: Add AV_CODEC_CAP_DR1
This encoder uses ff_get_encode_buffer().

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:37:06 +02:00
Andreas Rheinhardt
cc0a4fa630 avcodec/vbn(dec|enc): Avoid always-false checks
Do this by switching to bytestream2_(get|put)_le32u() from
bytestream2_(get|put)_le32(); it has after all already been checked
that the packet contains at least a full header, making all
the implicit checks in bytestream2_(get|put)_le32() dead code.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:36:57 +02:00
Andreas Rheinhardt
300dd79c3d avcodec/vbn(dec|enc): Avoid leaving stale pointers in context
Therefore move the (Get|Put)ByteContext from the context to the stack.
It is transient anyway.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:36:39 +02:00
Andreas Rheinhardt
81b6a10937 avcodec/vbn(dec|enc): Remove empty close function
Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-13 00:25:36 +02:00
Mark Gaiser
f889837e00 avformat: Add IPFS protocol support.
This patch adds support for:
- ffplay ipfs://<cid>
- ffplay ipns://<cid>

IPFS data can be played from so called "ipfs gateways".
A gateway is essentially a webserver that gives access to the
distributed IPFS network.

This protocol support (ipfs and ipns) therefore translates
ipfs:// and ipns:// to a http:// url. This resulting url is
then handled by the http protocol. It could also be https
depending on the gateway provided.

To use this protocol, a gateway must be provided.
If you do nothing it will try to find it in your
$HOME/.ipfs/gateway file. The ways to set it manually are:
1. Define a -gateway <url> to the gateway.
2. Define $IPFS_GATEWAY with the full http link to the gateway.
3. Define $IPFS_PATH and point it to the IPFS data path.
4. Have IPFS running in your local user folder (under $HOME/.ipfs).

Signed-off-by: Mark Gaiser <markg85@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-04-12 19:58:33 +02:00
Paul B Mahol
c2351d5a53 avcodec/mlpenc: simplify calling function 2022-04-12 19:30:58 +02:00
Paul B Mahol
dc068a7265 avcodec/mlpenc: use FFMAX() 2022-04-12 19:30:58 +02:00
Paul B Mahol
cbad385f04 avcodec/mlpenc: improve handling of last samples 2022-04-12 19:30:58 +02:00
Paul B Mahol
25cd1845ab avfilter/af_asetnsamples: fix excessive frames queueing at start 2022-04-12 19:30:58 +02:00
James Almer
b64043a83d avfilter/vf_drawbox: remove redefinition of DrawBoxContext typedef
It's forbidden in C99.

Should fix compilation with old non C11 compilers.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-04-12 11:09:59 -03:00
Gyan Doshi
1405b65d22 avfilter/lensfun: add option db_path
The lensfun filter, at present, loads its database from a path hardcoded
at build time. This may not be known or available to end users.

Added option db_path allows custom path.
2022-04-12 15:20:10 +05:30
Paul B Mahol
1047fedd0f avfilter: add Audio Video Sync Test filter
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2022-04-12 10:51:46 +02:00
Martin Storsjö
74439b67f2 tests: Fix the dependencies for the fate-jpg-icc test
The test also requires a png decoder, which often can be disabled in
cross building setups, where zlib might be missing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2022-04-12 09:06:07 +03:00
Paul B Mahol
13fe148c31 avfilter/f_ebur128: fix typos for swr chlayouts 2022-04-11 23:14:54 +02:00
Andreas Rheinhardt
3bbbb09a53 avcodec/hevc_sei: Don't use GetBit-API for byte-aligned reads
Instead use the bytestream2-API.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-11 19:19:50 +02:00
Andreas Rheinhardt
cf3f8ab9e6 avcodec/hevc_sei: Fix parsing SEI messages
SEI messages are naturally byte-aligned by adding padding bits
to achieve byte-alignment. The parsing code in libavcodec/hevc_sei.c
nevertheless uses a GetBitContext to read it. When doing so, parsing
the next SEI message starts exactly at the position where reading
the last message (if any) ended.

This means that one would have to handle both the payload extension data
(which makes most SEI messages extensible structs) as well as the
padding bits for byte-alignment. Yet our SEI parsing code in
libavcodec/hevc_sei.c does not read these at all. Instead several of
the functions used for parsing specific SEI messages use
skip_bits_long(); some don't use it at all, in which case it is possible
for the GetBitContext to not be byte-aligned at the start of the next
SEI message (the parsing code for several types of SEI messages relies
on byte-alignment).

Fix this by always using a dedicated GetBitContext per SEI message;
skipping the necessary amount of bytes in the NALU context
is done at a higher level. This also allows to remove unnecessary
parsing code that only existed in order to skip enough bytes.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-04-11 19:19:50 +02:00
Niklas Haas
e254af3154 avcodec/mjpegenc: support writing ICC profiles
This is mostly straightforward. The major complication is that, as a
result of the 16-bit chunk size limitation, ICC profiles may need to be
split up into multiple chunks.

We also need to make sure to allocate enough extra space in the packet
to fit the ICC profile, so modify both mpegvideo_enc.c and ljpegenc.c to
take into account this extra overhead, failing cleanly if necessary.

Also add a FATE transcode test to ensure that the ICC profile gets
written (and read) correctly. Note that this ICC profile is smaller than
64 kB, so this doesn't test the APP2 chunk re-arranging code at all.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-04-11 17:29:57 +02:00
Niklas Haas
4a580975d4 avcodec/pngenc: support writing iCCP chunks
We re-use the PNGEncContext.zstream for deflate-related operations.
Other than that, the code is pretty straightforward. Special care needs
to be taken to avoid writing more than 79 characters of the profile
description (the maximum supported).

To write the (dynamically sized) deflate-encoded data, we allocate extra
space in the packet and use that directly as a scratch buffer. Modify
png_write_chunk slightly to allow pre-writing the chunk contents like
this.

Also add a FATE transcode test to ensure that the ICC profile gets
encoded correctly.

Signed-off-by: Niklas Haas <git@haasn.dev>
2022-04-11 17:29:57 +02:00
Gyan Doshi
d6d46a2c50 doc/filters: guide to list lensfun db emtries 2022-04-11 16:15:22 +05:30
Mark Thompson
9f02e03387 vaapi_encode_h265: Query encoding block sizes and features
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2022-04-11 11:38:43 +08:00
Mark Thompson
77fd2f9c7c vaapi_encode_h265: Explicitly set and correct some flags
max_14bit_constraint_flag should be set if the bit depth is not greater than
14 (currently always true).

one_picture_only_flag should not be set because we don't support the still
picture profiles.

general_profile_compatibility_flag should be set according to general_profile_idc
instead of bit depth.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2022-04-11 11:38:43 +08:00
Mark Thompson
99b333e5ff vaapi_encode: Move block size calculation after entrypoint selection
The block size can be dependent on the profile and entrypoint selected.
It defaults to 16x16, with codecs able to override this choice with their
own function.

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2022-04-11 11:38:43 +08:00
Linjie Fu
a285968a0b lavc/vaapi_encode_h265: Add GPB frame support for hevc_vaapi
Use GPB frames to replace regular P/B frames if backend driver does not
support it.

- GPB:
    Generalized P and B picture. Regular P/B frames replaced by B
    frames with previous-predict only, L0 == L1. Normal B frames
    still have 2 different ref_lists and allow bi-prediction

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
Signed-off-by: Fei Wang <fei.w.wang@intel.com>
2022-04-11 11:38:43 +08:00
Paul B Mahol
6e45acd23b avfilter: let single output frame A->V filters set reasonable frame rate 2022-04-10 22:41:26 +02:00
Marton Balint
7ac559b819 fate: add fate tests for VBN encoder and decoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint
ee50cc18b3 avcodec/vbnenc: add VBN encoder
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint
013d774e22 avcodec/vbndec: add VBN decoder
Add support for decoding Vizrt Binary Image (VBN) files.

LZW-compressed data is not supported yet.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint
a4570d7a66 avcodec/hapenc: use the common texturedsp encode function
And add slice thread capabilities.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint
b3074ac9f4 avcodec/hapdec: use the common texturedsp decode function
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00
Marton Balint
30fdcd2e12 avcodec/dds: use the common texture dsp decode function
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-04-10 20:12:23 +02:00