[FFmpeg-devel] [PATCH v8 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper
Signed-off-by: hwren --- Changelog | 1 + configure | 4 + doc/encoders.texi | 49 doc/general.texi | 14 +++ libavcodec/Makefile| 1 + libavcodec/allcodecs.c | 1 + libavcodec/libxavs2.c | 300 + libavcodec/version.h | 4 +- 8 files changed, 372 insertions(+), 2 deletions(-) create mode 100644 libavcodec/libxavs2.c diff --git a/Changelog b/Changelog index 0975fee..8377956 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,7 @@ version : - Brooktree ProSumer video decoder - MatchWare Screen Capture Codec decoder - WinCam Motion Video decoder +- AVS2 video encoder via libxavs2 version 4.0: diff --git a/configure b/configure index 0d6ee0a..c8dc1a8 100755 --- a/configure +++ b/configure @@ -280,6 +280,7 @@ External library support: --enable-libx264 enable H.264 encoding via x264 [no] --enable-libx265 enable HEVC encoding via x265 [no] --enable-libxavs enable AVS encoding via xavs [no] + --enable-libxavs2enable AVS2 encoding via xavs2 [no] --enable-libxcb enable X11 grabbing using XCB [autodetect] --enable-libxcb-shm enable X11 grabbing shm communication [autodetect] --enable-libxcb-xfixes enable X11 grabbing mouse rendering [autodetect] @@ -1666,6 +1667,7 @@ EXTERNAL_LIBRARY_GPL_LIST=" libx264 libx265 libxavs +libxavs2 libxvid " @@ -3131,6 +3133,7 @@ libx264rgb_encoder_deps="libx264 x264_csp_bgr" libx264rgb_encoder_select="libx264_encoder" libx265_encoder_deps="libx265" libxavs_encoder_deps="libxavs" +libxavs2_encoder_deps="libxavs2" libxvid_encoder_deps="libxvid" libzvbi_teletext_decoder_deps="libzvbi" vapoursynth_demuxer_deps="vapoursynth" @@ -6165,6 +6168,7 @@ enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && require_cpp_condition libx265 x265.h "X265_BUILD >= 68" enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs" +enabled libxavs2 && require_pkg_config libxavs2 "xavs2 >= 1.2.77" "stdint.h xavs2.h" xavs2_api_get enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore enabled libzimg && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version enabled libzmq&& require_pkg_config libzmq libzmq zmq.h zmq_ctx_new diff --git a/doc/encoders.texi b/doc/encoders.texi index 7b09575..4623f38 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -2726,6 +2726,55 @@ Reduces detail but attempts to preserve color at extremely low bitrates. @end table +@section libxavs2 + +xavs2 AVS2-P2/IEEE1857.4 encoder wrapper. + +This encoder requires the presence of the libxavs2 headers and library +during configuration. You need to explicitly configure the build with +@option{--enable-libxavs2}. + +@subsection Options + +@table @option +@item lcu_row_threads +Set the number of parallel threads for rows from 1 to 8 (default 5). + +@item initial_qp +Set the xavs2 quantization parameter from 1 to 63 (default 34). This is +used to set the initial qp for the first frame. + +@item qp +Set the xavs2 quantization parameter from 1 to 63 (default 34). This is +used to set the qp value under constant-QP mode. + +@item max_qp +Set the max qp for rate control from 1 to 63 (default 55). + +@item min_qp +Set the min qp for rate control from 1 to 63 (default 20). + +@item speed_level +Set the Speed level from 0 to 9 (default 0). Higher is better but slower. + +@item log_level +Set the log level from -1 to 3 (default 0). -1: none, 0: error, +1: warning, 2: info, 3: debug. + +@item hierarchical_ref +Set the hierarchical reference or not (default true). + +@item xavs2-params +Set xavs2 options using a list of @var{key}=@var{value} couples separated +by ":". + +For example to specify libxavs2 encoding options with @option{-xavs2-params}: + +@example +ffmpeg -i input -c:v libxavs2 -xavs2-params preset_level=5 output.avs2 +@end example +@end table + @c man end VIDEO ENCODERS @chapter Subtitles Encoders diff --git a/doc/general.texi b/doc/general.texi index 06f7a78..05f7bcd9 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -17,6 +17,20 @@ for more formats. None of them are used by default, their use has to be explicitly requested by passing the appropriate flags to @command{./configure}. +@section libxavs2 + +FFmpeg can make use of the xavs2 library for AVS2-P2/IEEE1857.4 video encoding. + +Go to @url{https://github.com/pkuvcl/xavs2} and follow the instructions for +installing the library. Then pass @code{--enable-libxavs2} to configure to +enable it. + +@float NOTE +libxavs2 is under the GNU Public License Version 2 or later +(see @url{http://www.gnu.org/licenses/old-licenses/gpl-2.0.html} for +details), you must up
[FFmpeg-devel] [PATCH v8 2/2] lavf: add raw avs2 muxer
Signed-off-by: hwren --- libavformat/allformats.c | 1 + libavformat/rawenc.c | 13 + 2 files changed, 14 insertions(+) diff --git a/libavformat/allformats.c b/libavformat/allformats.c index adcc8d9..c17cdc2 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -76,6 +76,7 @@ extern AVInputFormat ff_avisynth_demuxer; extern AVOutputFormat ff_avm2_muxer; extern AVInputFormat ff_avr_demuxer; extern AVInputFormat ff_avs_demuxer; +extern AVOutputFormat ff_avs2_muxer; extern AVInputFormat ff_bethsoftvid_demuxer; extern AVInputFormat ff_bfi_demuxer; extern AVInputFormat ff_bintext_demuxer; diff --git a/libavformat/rawenc.c b/libavformat/rawenc.c index 809ca23..993d232 100644 --- a/libavformat/rawenc.c +++ b/libavformat/rawenc.c @@ -117,6 +117,19 @@ AVOutputFormat ff_aptx_hd_muxer = { }; #endif +#if CONFIG_AVS2_MUXER +AVOutputFormat ff_avs2_muxer = { +.name = "avs2", +.long_name = NULL_IF_CONFIG_SMALL("raw AVS2-P2/IEEE1857.4 video"), +.extensions= "avs,avs2", +.audio_codec = AV_CODEC_ID_NONE, +.video_codec = AV_CODEC_ID_AVS2, +.write_header = force_one_stream, +.write_packet = ff_raw_write_packet, +.flags = AVFMT_NOTIMESTAMPS, +}; +#endif + #if CONFIG_CAVSVIDEO_MUXER AVOutputFormat ff_cavsvideo_muxer = { .name = "cavsvideo", -- 2.7.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v7 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper
At 2018-09-10 02:01:32, "Mark Thompson" wrote: >On 06/09/18 14:58, hwren wrote: >> Signed-off-by: hwren >> --- >> Changelog | 1 + >> configure | 4 + >> doc/encoders.texi | 41 +++ >> doc/general.texi | 14 +++ >> libavcodec/Makefile| 1 + >> libavcodec/allcodecs.c | 1 + >> libavcodec/libxavs2.c | 303 >> + >> libavcodec/version.h | 4 +- >> 8 files changed, 367 insertions(+), 2 deletions(-) >> create mode 100644 libavcodec/libxavs2.c >> >> ... >> diff --git a/doc/encoders.texi b/doc/encoders.texi >> index 7b09575..2547acd 100644 >> --- a/doc/encoders.texi >> +++ b/doc/encoders.texi >> @@ -2726,6 +2726,47 @@ Reduces detail but attempts to preserve color at >> extremely low bitrates. >> >> @end table >> >> +@section libxavs2 >> + >> +xavs2 AVS2-P2/IEEE1857.4 encoder wrapper. >> + >> +This encoder requires the presence of the libxavs2 headers and library >> +during configuration. You need to explicitly configure the build with >> +@option{--enable-libxavs2}. >> + >> +@subsection Options >> + >> +@table @option >> +@item lcu_row_threads >> +Set the number of parallel threads for rows from 1 to 8 (default 5). >> + >> +@item initial_qp >> +Set the xavs2 quantization parameter from 1 to 63 (default 34). This is >> +used to set the initial qp for the first frame. >> + >> +@item max_qp >> +Set the max qp for rate control from 1 to 63 (default 55). >> + >> +@item min_qp >> +Set the min qp for rate control from 1 to 63 (default 20). >> + >> +@item speed_level >> +Set the Speed level from 0 to 9 (default 0). Higer is better but slower. > >Typo: higher. Fixed, thanks. ... >> diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c >> new file mode 100644 >> index 000..3b0244d >> --- /dev/null >> +++ b/libavcodec/libxavs2.c >> @@ -0,0 +1,303 @@ ... >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with FFmpeg; if not, write to the Free Software >> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 >> USA >> + */ >> + >> +#include > >This header is never used. Cleaned, thanks. > >> + >> +#include "xavs2.h" >> +#include "avcodec.h" >> +#include "mpeg12.h" >> +#include "internal.h" >> +#include "libavutil/internal.h" >> +#include "libavutil/mem.h" >> +#include "libavutil/opt.h" >> +#include "libavutil/imgutils.h" >> +#include "libavutil/avassert.h" >> +#include "libavutil/avstring.h" >> +#include "libavutil/common.h" >> +#include "libavutil/avutil.h" > >And some of these? At least avassert and imgutils aren't used, possibly some >others. Cleaned, thanks. ... >> + >> +/* Rate control */ >> +if (avctx->bit_rate > 0) { >> +xavs2_opt_set2("RateControl", "%d", 1); >> +xavs2_opt_set2("max_qp","%d", cae->max_qp); >> +xavs2_opt_set2("min_qp","%d", cae->min_qp); >> +xavs2_opt_set2("TargetBitRate", "%d", avctx->bit_rate); > >bit_rate is an int64_t, use "%"PRId64. Fixed, thanks. > >> +} >> + >> + >> +ff_mpeg12_find_best_frame_rate(avctx->framerate, &code, NULL, NULL, 0); >> + >> +xavs2_opt_set2("FrameRate", "%d", code); >> + >> +cae->encoder = cae->api->encoder_create(cae->param); >> + >> +if (!cae->encoder) { >> +av_log(avctx,AV_LOG_ERROR, "Can not create encoder. Null pointer >> returned\n"); >> +return AVERROR(EINVAL); >> +} >> + >> +return 0; >> +} >> + >> +static void xavs2_copy_frame_with_shift(xavs2_picture_t *pic, AVFrame >> *frame, const int shift_in) > >The AVFrame needs to be const, because that's what the encode function >received from the caller. Fixed, thanks. > >> +{ >> +int j, k; >> +for (k = 0; k < 3; k++) { >> +int i_stride = pic->img.i_stride[k]; >> +for (j = 0; j < pic->img.i_lines[k]; j++) { >> +uint16_t *p_plane = (uint16_t *)&pic->img.img_planes[k][j * >> i_stride]; >> +int i; >> +uint8_t *p_buffer = frame->data[k] + frame->linesize[k] * j; >> +memset(p_plane, 0, i_stride); >> +for (i = 0; i < pic->img.i_width[k]; i++) { >> +p_plane[i] = p_buffer[i] << shift_in; >> +} >> +} >> +} >> +} >> + >> +static void xavs2_copy_frame(xavs2_picture_t *pic, AVFrame *frame) > >Also here. Fixed, thanks. > >> +{ >> +int j, k; >> +for (k = 0; k < 3; k++) { >> +for (j = 0; j < pic->img.i_lines[k]; j++) { >> +memcpy( pic->img.img_planes[k] + pic->img.i_stride[k] * j, >> +frame->data[k]+frame->linesize[k] * j, >> +pic->img.i_width[k] * pic->img.in_sample_size); >> +} >> +} >> +} >> + >> ... >> + >> +static const AVOption options[] = { >> +{ "lcu_row_threads" , "number of parallel threads for rows" , >> OFFSET(lcu_row_threads) , AV_OPT_TYPE_INT, {.i64 = 5 }, 0, INT_MAX, VE }, > >Did you
Re: [FFmpeg-devel] [PATCH] frame: Simplify the video allocation
On Thu, Sep 06, 2018 at 08:04:02PM -0300, James Almer wrote: > On 9/6/2018 7:26 PM, Michael Niedermayer wrote: > > On Thu, Sep 06, 2018 at 01:10:31PM -0300, James Almer wrote: > >> On 9/4/2018 5:09 PM, Michael Niedermayer wrote: > >>> On Mon, Sep 03, 2018 at 10:29:13AM -0300, James Almer wrote: > On 9/3/2018 5:17 AM, Michael Niedermayer wrote: > > On Sun, Sep 02, 2018 at 09:34:23PM -0300, James Almer wrote: > >> From: Luca Barbato > >> > >> Merged-by: James Almer > >> --- > >> This is the next merge in the queue. It's a critical part of the > >> AVFrame API, > >> so even if FATE passes I'd rather have others look at it and test in > >> case > >> something breaks. > >> > >> The only difference compared to the libav commit is the "32 - 1" > >> padding per > >> plane when allocating the buffer, which was only in our tree. > > > > why is the STRIDE_ALIGN (which is a thing in units of bytes along the > > horizontal axis) added to padded_height which is vertical axis ? > > This is not done prior to the change > > The only way to keep this padding we currently have in the tree applied > to the buffer allocation for each plane like it was before the change > (Except it'll now be one continuous buffer instead of one per plane) is > by passing it alongside the height parameter to > av_image_fill_pointers(). The result is essentially the same. > > Do you want me to change the name of the variable, or remove it and pass > 32 - 1 to both av_image_fill_pointers() calls directly? Removing the > padding will probably just make whatever overreads prompted its addition > to resurface. > Alternatively, i can just no-op this merge and move on. > >>> > >>> allocating one plane instead of 3 is better obviously so i dont think this > >>> should be no-oped unless someone implements this differently > >>> > >>> i dont think the padding can be removed saftely but i might be missing > >>> something > >>> also i do not remember this 100% > >>> > >>> what i see and i may have misunderstood your reply but the code before > >>> places > >>> a few bytes between planes, the new code places a few lines, that is alot > >>> more > >>> space. Its not even the best that can be done with the current API. For > >>> example > >>> the number of extra lines would generally be 1 to provide sufficient > >>> padding > >>> at most reaslistic resolutions. > >>> > >>> also there is the independant question on the API, do we want/need to > >>> make > >>> adding padding between planes easier?> > >>> actually i think that if we change from 31 bytes to X lines padding then > >>> this > >>> should be a commit seperate of the 3->1 change. This would make bisect > >>> much > >>> more meaningfull and its rather trivial to split this. > >> > >> Do you have a suggestion on how to choose how many lines of padding to > >> add? > > > > something like (with rounding up) > > bytes * horizontal_chroma_subsampling / width * vertical_chroma_subsampling > > Isn't a calculation like this already being done? not sure i understand what you refer to > > > > > > >> And how would it be done? Just passing (h + padding_lines) to > >> av_buffer_alloc() pre merge, and to av_image_fill_pointers() post merge? > > > > possible > > > > > >> > >> It would also be faster if you could commit that change instead. > > > > thinking of this, its maybe simpler to adjust data[*] by these to get > > exactly teh same effect as before > > Is this before or after the merge? Because after the merge it's > av_image_fill_pointers() who does all the work, and get_video_buffer() > has no control over the pointers. i meant after but maybe i miss something why the caller couldnt adjust the pointers > > Nothing about this is obvious to me, so i ask again if you could > implement this instead. Otherwise I'll just no-op the merge and add it > to the list of skipped changes in case someone else wants to give it a > try at some other time. ill take a look tomorrow, ping me in case i forget [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Let us carefully observe those good qualities wherein our enemies excel us and endeavor to excel them, by avoiding what is faulty, and imitating what is excellent in them. -- Plutarch signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] tools: add target_dec_fate.sh
Script to download and test ossfuzz testcases This also includes a list of such testcases. I intend to subsequently fill this list with the cases we have fixed in the past Signed-off-by: Michael Niedermayer --- tools/target_dec_fate.list | 6 tools/target_dec_fate.sh | 62 ++ 2 files changed, 68 insertions(+) create mode 100644 tools/target_dec_fate.list create mode 100755 tools/target_dec_fate.sh diff --git a/tools/target_dec_fate.list b/tools/target_dec_fate.list new file mode 100644 index 00..e0509aaa64 --- /dev/null +++ b/tools/target_dec_fate.list @@ -0,0 +1,6 @@ +544/clusterfuzz-testcase-5936536407244800.f8bd9b24_8ba77916_70c2c7be_3df6a2ea_96cd9f14 target_dec_interplay_video_fuzzer +724/clusterfuzz-testcase-6738249571631104 target_dec_pictor_fuzzer +1214/clusterfuzz-testcase-minimized-6130606599569408 target_dec_h264_fuzzer +5264/clusterfuzz-testcase-minimized-4621956621008896 target_dec_indeo5_fuzzer +7279/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5977332473921536 target_dec_g2m_fuzzer +10053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5636993883570176 target_dec_prosumer_fuzzer diff --git a/tools/target_dec_fate.sh b/tools/target_dec_fate.sh new file mode 100755 index 00..d4e11955ac --- /dev/null +++ b/tools/target_dec_fate.sh @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Copyleft (c) Michael Niedermayer + +set -e + +LC_ALL=C +export LC_ALL + +LIST=target_dec_fate.list + +show_help(){ +cat < [] + +directory the directory into which sample files will be downloaded +test to run the number of the issue to test +Note, some test samples may not yet be available to the public, also this +script will not download samples which are already in the directory. So you +may want to preserve its content between runs. +EOF +exit 0 +} + +test -z "$1" && show_help +test ! -d "$1" && echo $1 is not an accessable directory && show_help +test ! -f target_dec_fate.sh && echo $0 Must be run from its location && show_help +grep 'CONFIG_OSSFUZZ 0' ../config.h && echo not configured for ossfuzz && show_help + +#Download testcases +while read -r LINE; do +ISSUE_NUM=`echo $LINE | sed 's#/.*##'` +FILE_ID=`echo $LINE | sed 's#.*/clusterfuzz-testcase[a-zA-Z0-9_-]*-\([0-9]*\).*#\1#'` +FILE=`echo $LINE | sed 's# .*##'` +if test -f "$1/$FILE" ; then +echo exists $FILE +else +echo downloading $FILE +mkdir -p "$1/$ISSUE_NUM" +wget -O "$1/$FILE" "https://oss-fuzz.com/download?testcase_id=$FILE_ID"; || rm "$1/$FILE" +fi +done < "$LIST" + +#Find which fuzzers we need to build +TOOLS= +while read -r LINE; do +TOOL_ID=`echo $LINE | sed 's#[^ ]* ##'` +TOOLS="$TOOLS tools/$TOOL_ID" +done < "$LIST" + +cd .. +#Build fuzzers +make -j4 $TOOLS + +#Run testcases +while read -r LINE; do +TOOL_ID=`echo $LINE | sed 's#[^ ]* ##'` +FILE=`echo $LINE | sed 's# .*##'` +tools/$TOOL_ID $1/$FILE +done < "tools/$LIST" + +echo OK \ No newline at end of file -- 2.18.0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Support for Decklink output of EIA-708 and AFD
Hi James, > Shouldn't this new packet side data be handled in libavcodec/decode.c > ff_decode_frame_props() as well? I have a patch which does this as part of a patch series which adds AFD parsing to decklink capture, ensures it gets preserved in ff_decode_frame_props, and encodes the resulting AFD in the libx264 encoder. I didn't want to submit just the patch for ff_decode_frame_props() since nothing is presently able to exercise the functionality other than a patch series I haven't yet submitted for upstream. So to answer your question, yes, we definitely need that as soon as there is something which can actually act on it. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Support for Decklink output of EIA-708 and AFD
On Sun, Sep 9, 2018 at 4:59 PM, Marton Balint wrote: > Thanks, I applied patches 1-4. > >> decklink: Add support for output of Active Format Description (AFD) > > > Regarding this one, I noticed you always set the AFD in line 12. Are you > sure that it is OK to use line 12 for all resolutions? 12 should be fine at all resolutions, as it just needs to be at least after the first line for switching (see ST 2016-3-2009 Sec 5). I already have a subsequent patch which makes the line configurable (as well as for 708 and SCTE-104), but I am trying to avoid overloading you with patches (which tends to result in *nothing* getting merged). > Also, I think for > interlaced formats you should set AFD for both fields, otherwise some > equipment might scale/crop the two fields of a picture differently... I've never seen a piece of equipment do such an incorrect scale/crop, but I guess it's possible. Part of the issue is that there are a few different conditions in which it can vary between the two fields and the way the underlying side-data is managed needs to be overhauled in order to properly handle that case (e.g. the SEI can be on a field basis in H.264, and we don't presently handle providing both values as side data for the frame). I think this patch handles the 99% use case (especially as PAFF becomes less and less common), Putting the same value on both lines for interlaced formats is probably not a bad idea, although I suspect in practice you're unlikely to run into equipment that has a problem with it only appearing once. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/3] lavc: Add coded bitstream read/write support for AV1
On 9/9/2018 7:08 PM, Mark Thompson wrote: > --- > Against versions which people might have seen before: > * Removed all of the vestigial annex B support (not useful, we are going to > ensure that AVPackets in FFmpeg never hold annex B data). > * gm_params subexp parsing made sensible - it doesn't compute the actual > gm_params values any more, but the code actually makes sense rather than > being opaque pasta from the standard. > * Metadata support added. > * Tile-group / tile-info / frame-with-tiles OBUs are combined in a hopefully > better way. > * Miscellaneous small fixes. > > Thanks to James Almer for testing and various fixes incorporated into this. > > > configure|2 + > libavcodec/Makefile |1 + > libavcodec/av1.h | 88 ++ > libavcodec/cbs.c |6 + > libavcodec/cbs_av1.c | 1293 > libavcodec/cbs_av1.h | 429 +++ > libavcodec/cbs_av1_syntax_template.c | 1676 ++ > libavcodec/cbs_internal.h|1 + > 8 files changed, 3496 insertions(+) > create mode 100644 libavcodec/cbs_av1.c > create mode 100644 libavcodec/cbs_av1.h > create mode 100644 libavcodec/cbs_av1_syntax_template.c [...] > +static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, > + CodedBitstreamFragment *frag, > + int header) > +{ > +GetBitContext gbc; > +uint8_t *data; > +size_t size; > +uint64_t obu_length; > +int pos, err; > + > +data = frag->data; > +size = frag->data_size; > + > +while (size > 0) { > +AV1RawOBUHeader header; > +uint64_t obu_size; > + > +init_get_bits(&gbc, data, 8 * size); > + > +err = cbs_av1_read_obu_header(ctx, &gbc, &header); This is generating a lot of noise when using the trace_headers bsf. Basically printing the header fields twice per OBU, first when splitting, then again when decomposing. You can get rid of that and simplify this function a lot if you use the ff_av1_packet_split() API from av1_parse.h doing more or less the same to what you're doing for h2645: static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header) { CodedBitstreamAV1Context *priv = ctx->priv_data; int err; err = ff_av1_packet_split(&priv->read_packet, frag->data, frag->data_size, ctx->log_ctx); if (err < 0) return err; for (int i = 0; i < priv->read_packet.nb_obus; i++) { const AV1OBU *obu = &priv->read_packet.obus[i]; uint8_t *data = (uint8_t *)obu->raw_data; size_t size = obu->raw_size; err = ff_cbs_insert_unit_data(ctx, frag, -1, obu->type, data, size, frag->data_ref); if (err < 0) return err; } return 0; } [...] > +static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext > *rw, > + AV1RawFrameHeader *current) > +{ > +CodedBitstreamAV1Context *priv = ctx->priv_data; > +const AV1RawSequenceHeader *seq; > +int id_len, all_frames, frame_is_intra, order_hint_bits; > +int i, err; > + > +if (!priv->sequence_header) { > +av_log(ctx->log_ctx, AV_LOG_ERROR, "No sequence header available: " > + "unable to decode frame header.\n"); > +return AVERROR_INVALIDDATA; > +} > +seq = priv->sequence_header; > + > +id_len = seq->additional_frame_id_length_minus_1 + > + seq->delta_frame_id_length_minus_2 + 3; > +all_frames = (1 << AV1_NUM_REF_FRAMES) - 1; > + > +if (seq->reduced_still_picture_header) { > +infer(show_existing_frame, 0); > +infer(frame_type, AV1_FRAME_KEY); > +infer(show_frame, 1); > +infer(showable_frame, 0); > +frame_is_intra = 1; > + > +} else { > +flag(show_existing_frame); > + > +if (current->show_existing_frame) { > +AV1ReferenceFrameState *frame; > + > +fb(3, frame_to_show_map_idx); > +frame = &priv->ref[current->frame_to_show_map_idx]; > + > +if (seq->decoder_model_info_present_flag && > +!seq->timing_info.equal_picture_interval) { > + > fb(seq->decoder_model_info.frame_presentation_time_length_minus_1 + 1, > + frame_presentation_time); > +} > + > +if (seq->frame_id_numbers_present_flag) > +fb(id_len, display_frame_id); > + > +if (frame->frame_type == AV1_FRAME_KEY) > +infer(refresh_frame_flags, all_frames); > +else > +infer(refresh_frame_flags, 0); > + > +return 0; > +} > + > +
Re: [FFmpeg-devel] [PATCH 1/3] libaomenc: Add support for tiles
On 09/09/18 23:08, Mark Thompson wrote: > Adds an option to specify the number of tile rows and columns, then uses > equal-sized tiles to fill the frame. > --- > Useful for testing to make arbitrary arrangements of tiles, though the > requirement to set the superblock size for the whole stream at the top level > rather than letting it be set dynamically is slightly unfortunate. > > The rounding error is placed at the left/top here, it might be better to > place it around the sides instead? (The most important detail is likely to > be in the centre of the frame, so make the tiles there smaller? I'm not sure > whether this argument is actually valid, though.) > > > libavcodec/libaomenc.c | 55 ++ > 1 file changed, 55 insertions(+) > > diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c > index 9431179886..0b4fa71fc7 100644 > --- a/libavcodec/libaomenc.c > +++ b/libavcodec/libaomenc.c > ... > @@ -431,6 +438,51 @@ static av_cold int aom_init(AVCodecContext *avctx, > > enccfg.g_error_resilient = ctx->error_resilient; > > +if (ctx->tile_cols && ctx->tile_rows) { > +int sb_size, sb_width, sb_height; > +int cols_per_tile, cols_step, rows_per_tile, rows_step, i; > + > +if (avctx->width / ctx->tile_cols < 128 || > +avctx->width / ctx->tile_rows < 128) { avctx->height for the second test, of course. There could be some rounding here too, though I'm not sure what the 128x128 vs. 64x64 tradeoff actually involves - if the frame is very small do we want the largest superblock size? > +// User has requested more tiles than would fit with 128x128 > +// superblocks, so assume they want 64x64. > +sb_size = 64; > +superblock_size = AOM_SUPERBLOCK_SIZE_64X64; > +} else { > +sb_size = 128; > +superblock_size = AOM_SUPERBLOCK_SIZE_128X128; > +} > + > +if (avctx->width / ctx->tile_cols < sb_size || > +avctx->height / ctx->tile_rows < sb_size) { This should probably be rounded with the test the other way: +if ((avctx->width + sb_size - 1) / sb_size < ctx->tile_cols || +(avctx->height + sb_size - 1) / sb_size < ctx->tile_rows) { > +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: tiles must be " > + "at least one superblock wide and high.\n"); > +return AVERROR(EINVAL); > +} > +if (ctx->tile_cols > MAX_TILE_WIDTHS || > +ctx->tile_rows > MAX_TILE_HEIGHTS) { > +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: at most %dx%d " > + "tiles allowed.\n", MAX_TILE_WIDTHS, MAX_TILE_HEIGHTS); > +return AVERROR(EINVAL); > +} > + > +enccfg.tile_width_count = ctx->tile_cols; > +enccfg.tile_height_count = ctx->tile_rows; > + > +sb_width = (avctx->width + sb_size - 1) / sb_size; > +sb_height = (avctx->height + sb_size - 1) / sb_size; > + > +cols_per_tile = sb_width / ctx->tile_cols; > +cols_step = sb_width % ctx->tile_cols; > +for (i = 0; i < ctx->tile_cols; i++) > +enccfg.tile_widths[i] = cols_per_tile + (i < cols_step); > + > +rows_per_tile = sb_height / ctx->tile_rows; > +rows_step = sb_height % ctx->tile_rows; > +for (i = 0; i < ctx->tile_rows; i++) > +enccfg.tile_heights[i] = rows_per_tile + (i < rows_step); > +} > ... ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 3/3] lavc: Add AV1 metadata bitstream filter
Can adjust colour and timing information. --- A simple start to the bsf - metadata support still todo. configure | 1 + libavcodec/Makefile| 1 + libavcodec/av1_metadata_bsf.c | 267 + libavcodec/bitstream_filters.c | 1 + 4 files changed, 270 insertions(+) create mode 100644 libavcodec/av1_metadata_bsf.c diff --git a/configure b/configure index 62a96c7b32..ae8157cfab 100755 --- a/configure +++ b/configure @@ -3023,6 +3023,7 @@ vc1_parser_select="vc1dsp" # bitstream_filters aac_adtstoasc_bsf_select="adts_header" +av1_metadata_bsf_select="cbs_av1" eac3_core_bsf_select="ac3_parser" filter_units_bsf_select="cbs" h264_metadata_bsf_deps="const_nan" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 9c2aab3fe3..3b2daf1364 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -1050,6 +1050,7 @@ OBJS-$(CONFIG_XMA_PARSER) += xma_parser.o # bitstream filters OBJS-$(CONFIG_AAC_ADTSTOASC_BSF) += aac_adtstoasc_bsf.o mpeg4audio.o +OBJS-$(CONFIG_AV1_METADATA_BSF) += av1_metadata_bsf.o OBJS-$(CONFIG_CHOMP_BSF) += chomp_bsf.o OBJS-$(CONFIG_DUMP_EXTRADATA_BSF) += dump_extradata_bsf.o OBJS-$(CONFIG_DCA_CORE_BSF) += dca_core_bsf.o diff --git a/libavcodec/av1_metadata_bsf.c b/libavcodec/av1_metadata_bsf.c new file mode 100644 index 00..4548c48235 --- /dev/null +++ b/libavcodec/av1_metadata_bsf.c @@ -0,0 +1,267 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/common.h" +#include "libavutil/opt.h" + +#include "bsf.h" +#include "cbs.h" +#include "cbs_av1.h" + +typedef struct AV1MetadataContext { +const AVClass *class; + +CodedBitstreamContext *cbc; +CodedBitstreamFragment access_unit; + +int color_primaries; +int transfer_characteristics; +int matrix_coefficients; + +int color_range; +int chroma_sample_position; + +AVRational tick_rate; +int num_ticks_per_picture; +} AV1MetadataContext; + + +static int av1_metadata_update_sequence_header(AVBSFContext *bsf, + AV1RawSequenceHeader *seq) +{ +AV1MetadataContext *ctx = bsf->priv_data; +AV1RawColorConfig *clc = &seq->color_config; +AV1RawTimingInfo *tim = &seq->timing_info; + +if (ctx->color_primaries >= 0 || +ctx->transfer_characteristics >= 0 || +ctx->matrix_coefficients >= 0) { +if (!clc->color_description_present_flag) { +clc->color_description_present_flag = 1; +clc->color_primaries = AVCOL_PRI_UNSPECIFIED; +clc->transfer_characteristics = AVCOL_TRC_UNSPECIFIED; +clc->matrix_coefficients = AVCOL_SPC_UNSPECIFIED; +} + +if (ctx->color_primaries >= 0) +clc->color_primaries = ctx->color_primaries; +if (ctx->transfer_characteristics >= 0) +clc->transfer_characteristics = ctx->transfer_characteristics; +if (ctx->matrix_coefficients >= 0) +clc->matrix_coefficients = ctx->matrix_coefficients; +} + +if (ctx->color_range >= 0) { +if (clc->color_primaries == AVCOL_PRI_BT709&& +clc->transfer_characteristics == AVCOL_TRC_IEC61966_2_1 && +clc->matrix_coefficients == AVCOL_SPC_RGB) { +av_log(bsf, AV_LOG_WARNING, "Warning: color_range cannot be set " + "on RGB streams encoded in BT.709 sRGB.\n"); +} else { +clc->color_range = ctx->color_range; +} +} + +if (ctx->chroma_sample_position >= 0) { +if (clc->mono_chrome) { +av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position " + "is not meaningful for monochrome streams.\n"); +} else if (clc->subsampling_x == 0 && + clc->subsampling_y == 0) { +av_log(bsf, AV_LOG_WARNING, "Warning: chroma_sample_position " + "is not meaningful for non-chroma-subsampled streams.\n"); +} else { +clc->chroma_sample_position = ctx->chroma_sample_position; +} +} + +if (ctx->tick_rate.num && ctx->tick_rate.den) { +int
[FFmpeg-devel] [PATCH 1/3] libaomenc: Add support for tiles
Adds an option to specify the number of tile rows and columns, then uses equal-sized tiles to fill the frame. --- Useful for testing to make arbitrary arrangements of tiles, though the requirement to set the superblock size for the whole stream at the top level rather than letting it be set dynamically is slightly unfortunate. The rounding error is placed at the left/top here, it might be better to place it around the sides instead? (The most important detail is likely to be in the centre of the frame, so make the tiles there smaller? I'm not sure whether this argument is actually valid, though.) libavcodec/libaomenc.c | 55 ++ 1 file changed, 55 insertions(+) diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 9431179886..0b4fa71fc7 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -68,6 +68,7 @@ typedef struct AOMEncoderContext { int static_thresh; int drop_threshold; int noise_sensitivity; +int tile_cols, tile_rows; } AOMContext; static const char *const ctlidstr[] = { @@ -79,6 +80,7 @@ static const char *const ctlidstr[] = { [AV1E_SET_COLOR_PRIMARIES] = "AV1E_SET_COLOR_PRIMARIES", [AV1E_SET_MATRIX_COEFFICIENTS] = "AV1E_SET_MATRIX_COEFFICIENTS", [AV1E_SET_TRANSFER_CHARACTERISTICS] = "AV1E_SET_TRANSFER_CHARACTERISTICS", +[AV1E_SET_SUPERBLOCK_SIZE] = "AV1E_SET_SUPERBLOCK_SIZE", }; static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) @@ -143,6 +145,10 @@ static av_cold void dump_enc_cfg(AVCodecContext *avctx, width, "kf_mode:", cfg->kf_mode, width, "kf_min_dist:", cfg->kf_min_dist, width, "kf_max_dist:", cfg->kf_max_dist); +av_log(avctx, level, "tile settings\n" + " %*s%d\n %*s%d\n", + width, "tile_width_count:", cfg->tile_width_count, + width, "tile_height_count:", cfg->tile_height_count); av_log(avctx, level, "\n"); } @@ -294,6 +300,7 @@ static av_cold int aom_init(AVCodecContext *avctx, int res; aom_img_fmt_t img_fmt; aom_codec_caps_t codec_caps = aom_codec_get_caps(iface); +aom_superblock_size_t superblock_size = AOM_SUPERBLOCK_SIZE_DYNAMIC; av_log(avctx, AV_LOG_INFO, "%s\n", aom_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", aom_codec_build_config()); @@ -431,6 +438,51 @@ static av_cold int aom_init(AVCodecContext *avctx, enccfg.g_error_resilient = ctx->error_resilient; +if (ctx->tile_cols && ctx->tile_rows) { +int sb_size, sb_width, sb_height; +int cols_per_tile, cols_step, rows_per_tile, rows_step, i; + +if (avctx->width / ctx->tile_cols < 128 || +avctx->width / ctx->tile_rows < 128) { +// User has requested more tiles than would fit with 128x128 +// superblocks, so assume they want 64x64. +sb_size = 64; +superblock_size = AOM_SUPERBLOCK_SIZE_64X64; +} else { +sb_size = 128; +superblock_size = AOM_SUPERBLOCK_SIZE_128X128; +} + +if (avctx->width / ctx->tile_cols < sb_size || +avctx->height / ctx->tile_rows < sb_size) { +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: tiles must be " + "at least one superblock wide and high.\n"); +return AVERROR(EINVAL); +} +if (ctx->tile_cols > MAX_TILE_WIDTHS || +ctx->tile_rows > MAX_TILE_HEIGHTS) { +av_log(avctx, AV_LOG_ERROR, "Invalid tile sizing: at most %dx%d " + "tiles allowed.\n", MAX_TILE_WIDTHS, MAX_TILE_HEIGHTS); +return AVERROR(EINVAL); +} + +enccfg.tile_width_count = ctx->tile_cols; +enccfg.tile_height_count = ctx->tile_rows; + +sb_width = (avctx->width + sb_size - 1) / sb_size; +sb_height = (avctx->height + sb_size - 1) / sb_size; + +cols_per_tile = sb_width / ctx->tile_cols; +cols_step = sb_width % ctx->tile_cols; +for (i = 0; i < ctx->tile_cols; i++) +enccfg.tile_widths[i] = cols_per_tile + (i < cols_step); + +rows_per_tile = sb_height / ctx->tile_rows; +rows_step = sb_height % ctx->tile_rows; +for (i = 0; i < ctx->tile_rows; i++) +enccfg.tile_heights[i] = rows_per_tile + (i < rows_step); +} + dump_enc_cfg(avctx, &enccfg); /* Construct Encoder Context */ res = aom_codec_enc_init(&ctx->encoder, iface, &enccfg, flags); @@ -454,6 +506,8 @@ static av_cold int aom_init(AVCodecContext *avctx, codecctl_int(avctx, AV1E_SET_TRANSFER_CHARACTERISTICS, avctx->color_trc); set_color_range(avctx); +codecctl_int(avctx, AV1E_SET_SUPERBLOCK_SIZE, superblock_size); + // provide dummy value to initialize wrapper, values will be updated each _encode() aom_img_wrap(&ctx->rawimg, img_fmt, avctx->width, avctx->height, 1, (unsig
Re: [FFmpeg-devel] [PATCH 0/5] Support for Decklink output of EIA-708 and AFD
On 9/9/2018 5:59 PM, Marton Balint wrote: > > > On Fri, 7 Sep 2018, Devin Heitmueller wrote: > >> The following patches add support for output of 708 and AFD over >> the Decklink SDI interface. This series is a subset of a series >> submitted in early January, with the hope of getting the less >> controversial parts merged upstream. >> >> Note compared to the previous series this includes a bit of >> refactoring to separate out the generation of AFD and CC lines from >> the actual output. This makes the exception handling more >> straightforward as well as ensuring that one VANC type being >> invalid for some reason doesn't cause all the other types to >> not be output (in the previous series, the function would bail >> out if there was a problem with any VANC data, even if all the >> other VANC data was perfectly valid). >> >> Devin Heitmueller (5): >> v210enc: Pass through A53 CC data >> libavdevice/decklink: Add support for EIA-708 output over SDI >> Allow AFD data to be embedded in AVPacket >> v210enc: Pass through Active Format Description (AFD) data > > Thanks, I applied patches 1-4. Shouldn't this new packet side data be handled in libavcodec/decode.c ff_decode_frame_props() as well? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters
On Sun, 9 Sep 2018, Nicolas George wrote: Marton Balint (2018-09-09): And finally applied. If Nicolas or anybody can provide some pointers on how to get rid of the extra frame queue, then I will be more than happy to work on it. I am sorry, I am currently having a very annoying trouble with my eye which makes it easy to miss important mails and consumes a lot of time and energy. You should not have added a queue in your context at all, you should have used the one already present using the API in filters.h. As far as I see there is only API to get the first frame in the fifo, and to check if there is at least one frame in the fifo. What I need is to get the frame->pts of the frames (first and last) in the fifo. Paul suggested to #define FF_INTERNAL_FIELDS, this way I can access inlink->fifo directly, and I can use the framequeue.h functions on the inlink fifo. Is this what you are suggesting? Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter
On Sun, Sep 09, 2018 at 01:07:57PM +0200, Timo Rothenpieler wrote: > From: Roman Arzumanyan > > Signed-off-by: Timo Rothenpieler > --- > configure | 5 +- > doc/filters.texi | 42 +++ > libavfilter/Makefile | 1 + > libavfilter/allfilters.c | 1 + > libavfilter/version.h | 2 +- > libavfilter/vf_transpose_npp.c | 487 + > 6 files changed, 535 insertions(+), 3 deletions(-) > create mode 100644 libavfilter/vf_transpose_npp.c build issues fixed, thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 0/5] Support for Decklink output of EIA-708 and AFD
On Fri, 7 Sep 2018, Devin Heitmueller wrote: The following patches add support for output of 708 and AFD over the Decklink SDI interface. This series is a subset of a series submitted in early January, with the hope of getting the less controversial parts merged upstream. Note compared to the previous series this includes a bit of refactoring to separate out the generation of AFD and CC lines from the actual output. This makes the exception handling more straightforward as well as ensuring that one VANC type being invalid for some reason doesn't cause all the other types to not be output (in the previous series, the function would bail out if there was a problem with any VANC data, even if all the other VANC data was perfectly valid). Devin Heitmueller (5): v210enc: Pass through A53 CC data libavdevice/decklink: Add support for EIA-708 output over SDI Allow AFD data to be embedded in AVPacket v210enc: Pass through Active Format Description (AFD) data Thanks, I applied patches 1-4. decklink: Add support for output of Active Format Description (AFD) Regarding this one, I noticed you always set the AFD in line 12. Are you sure that it is OK to use line 12 for all resolutions? Also, I think for interlaced formats you should set AFD for both fields, otherwise some equipment might scale/crop the two fields of a picture differently... Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters
Marton Balint (2018-09-09): > And finally applied. If Nicolas or anybody can provide some pointers on how > to get rid of the extra frame queue, then I will be more than happy to work > on it. I am sorry, I am currently having a very annoying trouble with my eye which makes it easy to miss important mails and consumes a lot of time and energy. You should not have added a queue in your context at all, you should have used the one already present using the API in filters.h. Regards, -- Nicolas George signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters
On 9/9/18, Marton Balint wrote: > > 2018.08.25. 20:35 keltezessel, Marton Balint irta: >> To delay filtering until a given wallclock timestamp. >> >> Signed-off-by: Marton Balint >> --- >> doc/filters.texi | 36 ++ >> libavfilter/Makefile | 2 + >> libavfilter/allfilters.c | 2 + >> libavfilter/f_cue.c | 182 >> +++ >> libavfilter/version.h| 2 +- >> 5 files changed, 223 insertions(+), 1 deletion(-) >> create mode 100644 libavfilter/f_cue.c >> > > And finally applied. If Nicolas or anybody can provide some pointers on > how to get rid of the extra frame queue, then I will be more than happy > to work on it. Perhaps you need #define FF_INTERNAL_FIELDS 1 ? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/f_cue: add cue and acue filters
2018.08.25. 20:35 keltezéssel, Marton Balint írta: To delay filtering until a given wallclock timestamp. Signed-off-by: Marton Balint --- doc/filters.texi | 36 ++ libavfilter/Makefile | 2 + libavfilter/allfilters.c | 2 + libavfilter/f_cue.c | 182 +++ libavfilter/version.h | 2 +- 5 files changed, 223 insertions(+), 1 deletion(-) create mode 100644 libavfilter/f_cue.c And finally applied. If Nicolas or anybody can provide some pointers on how to get rid of the extra frame queue, then I will be more than happy to work on it. Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter/vf_framerate: switch to activate
On Wed, 5 Sep 2018, Marton Balint wrote: On Tue, 28 Aug 2018, Marton Balint wrote: Signed-off-by: Marton Balint --- libavfilter/vf_framerate.c | 119 - 1 file changed, 63 insertions(+), 56 deletions(-) Ping, will push soon. Pushed. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avutil/file: allow mapping 0 byte files with av_file_map
On Fri, 7 Sep 2018, Michael Niedermayer wrote: On Thu, Sep 06, 2018 at 08:58:37PM +0200, Marton Balint wrote: Signed-off-by: Marton Balint --- libavutil/file.c | 8 libavutil/file.h | 2 ++ 2 files changed, 10 insertions(+) probably ok Thanks, applied. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avdevice/decklink_enc: add support for setting duplex mode
On Thu, 6 Sep 2018, Marton Balint wrote: Signed-off-by: Marton Balint --- doc/outdevs.texi | 4 libavdevice/decklink_enc.cpp | 1 + libavdevice/decklink_enc_c.c | 4 libavdevice/version.h| 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) Applied. Regards, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] Add FATE test for QT format audio descriptors in MP4
On 07/09/2018 17:09, Michael Niedermayer wrote: > tested on linux x86-32/64, mingw32/64, and qemu arm/mips > all work fine Pushed, thanks. - Derek ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH v7 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper
On 06/09/18 14:58, hwren wrote: > Signed-off-by: hwren > --- > Changelog | 1 + > configure | 4 + > doc/encoders.texi | 41 +++ > doc/general.texi | 14 +++ > libavcodec/Makefile| 1 + > libavcodec/allcodecs.c | 1 + > libavcodec/libxavs2.c | 303 > + > libavcodec/version.h | 4 +- > 8 files changed, 367 insertions(+), 2 deletions(-) > create mode 100644 libavcodec/libxavs2.c > > ... > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 7b09575..2547acd 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -2726,6 +2726,47 @@ Reduces detail but attempts to preserve color at > extremely low bitrates. > > @end table > > +@section libxavs2 > + > +xavs2 AVS2-P2/IEEE1857.4 encoder wrapper. > + > +This encoder requires the presence of the libxavs2 headers and library > +during configuration. You need to explicitly configure the build with > +@option{--enable-libxavs2}. > + > +@subsection Options > + > +@table @option > +@item lcu_row_threads > +Set the number of parallel threads for rows from 1 to 8 (default 5). > + > +@item initial_qp > +Set the xavs2 quantization parameter from 1 to 63 (default 34). This is > +used to set the initial qp for the first frame. > + > +@item max_qp > +Set the max qp for rate control from 1 to 63 (default 55). > + > +@item min_qp > +Set the min qp for rate control from 1 to 63 (default 20). > + > +@item speed_level > +Set the Speed level from 0 to 9 (default 0). Higer is better but slower. Typo: higher. > + > +@item hierarchical_ref > +Set the hierarchical reference or not (default true). > + > +@item xavs2-params > +Set xavs2 options using a list of @var{key}=@var{value} couples separated > +by ":". > + > +For example to specify libxavs2 encoding options with @option{-xavs2-params}: > + > +@example > +ffmpeg -i input -c:v libxavs2 -xavs2-params speed_level=5 output.avs2 > +@end example > +@end table > + > @c man end VIDEO ENCODERS > > @chapter Subtitles Encoders > ... > diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c > new file mode 100644 > index 000..3b0244d > --- /dev/null > +++ b/libavcodec/libxavs2.c > @@ -0,0 +1,303 @@ > +/* > + * AVS2 encoding using the xavs2 library > + * > + * Copyright (C) 2018 Yiqun Xu, > + *Falei Luo, > + *Huiwen Ren, > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +#include This header is never used. > + > +#include "xavs2.h" > +#include "avcodec.h" > +#include "mpeg12.h" > +#include "internal.h" > +#include "libavutil/internal.h" > +#include "libavutil/mem.h" > +#include "libavutil/opt.h" > +#include "libavutil/imgutils.h" > +#include "libavutil/avassert.h" > +#include "libavutil/avstring.h" > +#include "libavutil/common.h" > +#include "libavutil/avutil.h" And some of these? At least avassert and imgutils aren't used, possibly some others. > + > ... > + > +static av_cold int xavs2_init(AVCodecContext *avctx) > +{ > +XAVS2EContext *cae= avctx->priv_data; > +int bit_depth, code; > + > +bit_depth = avctx->pix_fmt == AV_PIX_FMT_YUV420P ? 8 : 10; > + > +/* get API handler */ > +cae->api = xavs2_api_get(bit_depth); > + > +if (!cae->api) { > +av_log(avctx, AV_LOG_ERROR, "api get failed\n"); > +return AVERROR_EXTERNAL; > +} > + > +cae->param = cae->api->opt_alloc(); > + > +if (!cae->param) { > +av_log(avctx, AV_LOG_ERROR, "param alloc failed\n"); > +return AVERROR(ENOMEM); > +} > + > +xavs2_opt_set2("rec", "%d", 0); > +xavs2_opt_set2("log", "%d", 0); > + > +xavs2_opt_set2("width", "%d", avctx->width); > +xavs2_opt_set2("height","%d", avctx->height); > +xavs2_opt_set2("bframes", "%d", avctx->max_b_frames); > +xavs2_opt_set2("bitdepth", "%d", bit_depth); > +xavs2_opt_set2("preset","%d", cae->preset_level); > + > +/* not the same parameter as the IntraPeriod in xavs2 log */ > +xavs2_opt_set2("intraperiod", "%d", avctx->gop_size); > + > +xavs2_opt_set2("thread_frames", "%d", avctx->thread_count); > +xavs2_opt_set2("thread_rows", "%d", cae->lcu_row_
Re: [FFmpeg-devel] [PATCH v6 1/2] lavc, doc, configure: add libxavs2 video encoder wrapper
On 06/09/18 14:46, Huiwen Ren wrote: > At 2018-09-06 08:43:05, "Mark Thompson" wrote: >> On 05/09/18 14:38, hwren wrote: >>> +{ "i_initial_qp", "Quantization parameter" , >>> OFFSET(i_initial_qp), AV_OPT_TYPE_INT, {.i64 = 34 }, 1, 63, VE }, >> >> If I understand what you said previously correctly, this is only used in >> constant-QP mode, and there it is used as the QP for every frame (not just >> the initial one)? >> >> If that's the case then it should probably not say "initial" - I would read >> "initial_qp" as meaning the QP used for the first frame only, so probably in >> modes with a bitrate target. Maybe change it to just be "qp"? That name is >> used by several other encoders, including libx264 and libxavs. > > If "RateControl" is opened, the "initial_qp" will be used for the first frame > and kept for all the other frames (constant-QP) and if there is no rate > control, the initial_qp will only work for the first frame (xavs2 will always > initial the qp for the first frame). So...maybe better with "initial"? Oh, so it's actually being used for both cases here? Then I think it should be two separate options to match other encoders ("initial_qp" for the bitrate-target case, "qp" or AVCodecContext.global_quality for the constant-quality case). Relatedly, the min-QP default value seems to be applied in constant-quality mode as well, where it probably shouldn't be: $ for i in $(seq 1 63) ; do ./ffmpeg_g -y -i in.mp4 -an -c:v libxavs2 -frames:v 1000 -initial_qp $i out-$i.avs ; done ... $ rename 's/-(..avs)/-0$1/' out-* $ du -b out-* 18464881out-01.avs 18464878out-02.avs 18464872out-03.avs 18464872out-04.avs 18464875out-05.avs 18464872out-06.avs 18464875out-07.avs 18464873out-08.avs 18464878out-09.avs 18464878out-10.avs 18464875out-11.avs 18464878out-12.avs 18464875out-13.avs 18464872out-14.avs 18464878out-15.avs 18464875out-16.avs 18464875out-17.avs 18464878out-18.avs 18464872out-19.avs 18464878out-20.avs 17015783out-21.avs 1727out-22.avs 14176171out-23.avs 12707758out-24.avs 11603156out-25.avs 10401092out-26.avs 9392228 out-27.avs 8371627 out-28.avs 7476957 out-29.avs 6706333 out-30.avs 6025691 out-31.avs 5402430 out-32.avs 4877929 out-33.avs 4563285 out-34.avs 4081752 out-35.avs 3672218 out-36.avs 3290184 out-37.avs 2945455 out-38.avs 2637767 out-39.avs 2362608 out-40.avs 2119294 out-41.avs 1902747 out-42.avs 1710491 out-43.avs 1536269 out-44.avs 1390060 out-45.avs 1238536 out-46.avs 1122929 out-47.avs 1005188 out-48.avs 906167 out-49.avs 807448 out-50.avs 729962 out-51.avs 647092 out-52.avs 583707 out-53.avs 520264 out-54.avs 469991 out-55.avs 421588 out-56.avs 380653 out-57.avs 347411 out-58.avs 313181 out-59.avs 287456 out-60.avs 268281 out-61.avs 243882 out-62.avs 232726 out-63.avs Thanks, - Mark ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]configure: Do not use -fomit-frame-pointer on sparc
2018-09-09 2:39 GMT+02:00, Michael Niedermayer : > On Sun, Sep 09, 2018 at 01:03:36AM +0200, Carl Eugen Hoyos wrote: >> Hi! >> >> Attached patch fixes many warnings when compiling for sparc. >> >> Please comment, Carl Eugen > >> configure |2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> 92a4853fbf697e9528ab000924a001fd6366b279 >> 0001-configure-Do-not-use-fomit-frame-pointer-on-sparc.patch >> From 9239602b04abb2ee7b986897923a929a2e6a5028 Mon Sep 17 00:00:00 2001 >> From: Carl Eugen Hoyos >> Date: Sun, 9 Sep 2018 01:01:24 +0200 >> Subject: [PATCH] configure: Do not use -fomit-frame-pointer on sparc. >> >> Silences many warnings on compilation. > > can you show some examples of these warnings ? The warning for every C file when using the Sun Studio / Oracle Studio compiler is: cc: Warning: frameptr value of the xregs option is not available on SPARC Solaris, ignored. cc: Warning: illegal use of -xregs option, empty value ignored Added locally to the commit message. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter
From: Roman Arzumanyan Signed-off-by: Timo Rothenpieler --- configure | 5 +- doc/filters.texi | 42 +++ libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_transpose_npp.c | 487 + 6 files changed, 535 insertions(+), 3 deletions(-) create mode 100644 libavfilter/vf_transpose_npp.c diff --git a/configure b/configure index 595be65f2c..c6130ce076 100755 --- a/configure +++ b/configure @@ -2924,6 +2924,7 @@ hwupload_cuda_filter_deps="ffnvcodec" scale_npp_filter_deps="ffnvcodec libnpp" scale_cuda_filter_deps="cuda_sdk" thumbnail_cuda_filter_deps="cuda_sdk" +transpose_npp_filter_deps="ffnvcodec libnpp" amf_deps_any="libdl LoadLibrary" nvenc_deps="ffnvcodec" @@ -6083,8 +6084,8 @@ enabled libmodplug&& require_pkg_config libmodplug libmodplug libmodplug enabled libmp3lame&& require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame $libm_extralibs enabled libmysofa && { check_pkg_config libmysofa libmysofa mysofa.h mysofa_load || require libmysofa mysofa.h mysofa_load -lmysofa $zlib_extralibs; } -enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc || - check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc || +enabled libnpp&& { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc -lnppidei || + check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc -lnppidei || die "ERROR: libnpp not found"; } enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb diff --git a/doc/filters.texi b/doc/filters.texi index 37e79d34e1..43813550d7 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -16205,6 +16205,7 @@ embedded peak information in display metadata is not reliable or when tone mapping from a lower range to a higher range. @end table +@anchor{transpose} @section transpose Transpose rows with columns in the input video and optionally flip it. @@ -16284,6 +16285,47 @@ The command above can also be specified as: transpose=1:portrait @end example +@section transpose_npp + +Transpose rows with columns in the input video and optionally flip it. +For more in depth examples see the @ref{transpose} video filter, which shares mostly the same options. + +It accepts the following parameters: + +@table @option + +@item dir +Specify the transposition direction. + +Can assume the following values: +@table @samp +@item cclock_flip +Rotate by 90 degrees counterclockwise and vertically flip. (default) + +@item clock +Rotate by 90 degrees clockwise. + +@item cclock +Rotate by 90 degrees counterclockwise. + +@item clock_flip +Rotate by 90 degrees clockwise and vertically flip. +@end table + +@item passthrough +Do not apply the transposition if the input geometry matches the one +specified by the specified value. It accepts the following values: +@table @samp +@item none +Always apply transposition. (default) +@item portrait +Preserve portrait geometry (when @var{height} >= @var{width}). +@item landscape +Preserve landscape geometry (when @var{width} >= @var{height}). +@end table + +@end table + @section trim Trim the input so that the output contains one continuous subpart of the input. diff --git a/libavfilter/Makefile b/libavfilter/Makefile index e412000c8f..cc0cc15fd2 100644 --- a/libavfilter/Makefile +++ b/libavfilter/Makefile @@ -374,6 +374,7 @@ OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o colorspace.o OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o colorspace.o opencl.o \ opencl/tonemap.o opencl/colorspace_common.o OBJS-$(CONFIG_TRANSPOSE_FILTER) += vf_transpose.o +OBJS-$(CONFIG_TRANSPOSE_NPP_FILTER) += vf_transpose_npp.o OBJS-$(CONFIG_TRIM_FILTER) += trim.o OBJS-$(CONFIG_UNPREMULTIPLY_FILTER) += vf_premultiply.o framesync.o OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c index 2fa9460335..73a5d7e188 100644 --- a/libavfilter/allfilters.c +++ b/libavfilter/allfilters.c @@ -356,6 +356,7 @@ extern AVFilter ff_vf_tmix; extern AVFilter ff_vf_tonemap; extern AVFilter ff_vf_tonemap_opencl; extern AVFilter ff_vf_transpose; +extern AVFilter ff_vf_transpose_npp; extern AVFilter ff_vf_trim; extern AVFilter ff_vf_unpremultiply; extern AVFilter ff_vf_unsharp; diff --git a/libavfilter/version.h b/libavfilter/version.h index 2ff2b6a318..ef982339d7 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -30,7 +30,7 @@ #include
Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter
On Sun, Sep 09, 2018 at 11:31:49AM +0200, Timo Rothenpieler wrote: > On 9/9/2018 2:12 AM, Michael Niedermayer wrote: > >On Sat, Sep 08, 2018 at 03:49:29PM +0200, Timo Rothenpieler wrote: > >>From: Roman Arzumanyan > >> > >>Signed-off-by: Timo Rothenpieler > >>--- > >>I'm not overly a fan of a rotate filter that only support 90° angles > >>either. > >>So here's my modified version of the original transpose filter, which > >>now behaves the exact same as the software transpose filter. > >> > >>Additionally, I removed the format conversion from the filter. That's > >>the job of the scale filter, and also saves you from doing pointless > >>double format conversion if you scale and transpose NV12 video. > >>Nvenc accepts yuv420p/444p input anyway, and if you really need to, one > >>can add another scale_npp after to get back nv12. > >> > >>A possible commandline for this is: > >>./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v > >>h264_nvenc -vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv > >> > >> > >> configure | 5 +- > >> doc/filters.texi | 55 > >> libavfilter/Makefile | 1 + > >> libavfilter/allfilters.c | 1 + > >> libavfilter/version.h | 2 +- > >> libavfilter/vf_transpose_npp.c | 483 + > >> 6 files changed, 544 insertions(+), 3 deletions(-) > >> create mode 100644 libavfilter/vf_transpose_npp.c > > > >breaks build: > > > >HTML doc/ffmpeg-filters.html > >HTML doc/ffplay-all.html > >HTML doc/ffmpeg-all.html > >HTML doc/ffprobe-all.html > >doc/filters.texi:16290: @ref reference to nonexistent node `transpose' > >make: *** [doc/ffmpeg-filters.html] Error 1 > >doc/filters.texi:16290: @ref reference to nonexistent node `transpose' > >doc/filters.texi:16290: @ref reference to nonexistent node `transpose' > >make: *** [doc/ffplay-all.html] Error 1 > >make: *** [doc/ffprobe-all.html] Error 1 > >doc/filters.texi:16290: @ref reference to nonexistent node `transpose' > >make: *** [doc/ffmpeg-all.html] Error 1 > >make: Target `all' not remade because of errors. > > > > What's the correct way to link to another section? I have seen other parts > use the @ref syntax. i think this needs a @anchor{transpose} somewhere probably but i didnt read the "manual" for this stuff so i could be wrong [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avfilter: add nvidia NPP based transpose filter
On 9/9/2018 2:12 AM, Michael Niedermayer wrote: On Sat, Sep 08, 2018 at 03:49:29PM +0200, Timo Rothenpieler wrote: From: Roman Arzumanyan Signed-off-by: Timo Rothenpieler --- I'm not overly a fan of a rotate filter that only support 90° angles either. So here's my modified version of the original transpose filter, which now behaves the exact same as the software transpose filter. Additionally, I removed the format conversion from the filter. That's the job of the scale filter, and also saves you from doing pointless double format conversion if you scale and transpose NV12 video. Nvenc accepts yuv420p/444p input anyway, and if you really need to, one can add another scale_npp after to get back nv12. A possible commandline for this is: ./ffmpeg.exe -hwaccel cuvid -c:v h264_cuvid -i in.mkv -c copy -c:v h264_nvenc -vf scale_npp=format=yuv420p,transpose_npp=cclock_flip out.mkv configure | 5 +- doc/filters.texi | 55 libavfilter/Makefile | 1 + libavfilter/allfilters.c | 1 + libavfilter/version.h | 2 +- libavfilter/vf_transpose_npp.c | 483 + 6 files changed, 544 insertions(+), 3 deletions(-) create mode 100644 libavfilter/vf_transpose_npp.c breaks build: HTMLdoc/ffmpeg-filters.html HTMLdoc/ffplay-all.html HTMLdoc/ffmpeg-all.html HTMLdoc/ffprobe-all.html doc/filters.texi:16290: @ref reference to nonexistent node `transpose' make: *** [doc/ffmpeg-filters.html] Error 1 doc/filters.texi:16290: @ref reference to nonexistent node `transpose' doc/filters.texi:16290: @ref reference to nonexistent node `transpose' make: *** [doc/ffplay-all.html] Error 1 make: *** [doc/ffprobe-all.html] Error 1 doc/filters.texi:16290: @ref reference to nonexistent node `transpose' make: *** [doc/ffmpeg-all.html] Error 1 make: Target `all' not remade because of errors. What's the correct way to link to another section? I have seen other parts use the @ref syntax. smime.p7s Description: S/MIME Cryptographic Signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/lagarith: switch to planar rgb
Speed goes from 363 fps to 428 fps for 640x480 video. Signed-off-by: Paul B Mahol --- libavcodec/lagarith.c | 108 +++- tests/ref/fate/lagarith-red | 50 +-- tests/ref/fate/lagarith-rgb24 | 8 +- tests/ref/fate/lagarith-ticket4119 | 4 +- tests/ref/fate/lagarith-ticket4119-cfr | 100 +++--- tests/ref/fate/lagarith-ticket4119-drop | 4 +- tests/ref/fate/lagarith-ticket4119-pass | 4 +- tests/ref/fate/lagarith-ticket4119-vfr | 4 +- 8 files changed, 118 insertions(+), 164 deletions(-) diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 3d3b4d41f4..d88c5f5ae7 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -53,9 +53,6 @@ typedef struct LagarithContext { LLVidDSPContext llviddsp; int zeros; /**< number of consecutive zero bytes encountered */ int zeros_rem; /**< number of zero bytes remaining to output */ -uint8_t *rgb_planes; -int rgb_planes_allocated; -int rgb_stride; } LagarithContext; /** @@ -544,7 +541,7 @@ static int lag_decode_frame(AVCodecContext *avctx, uint8_t frametype; uint32_t offset_gu = 0, offset_bv = 0, offset_ry = 9; uint32_t offs[4]; -uint8_t *srcs[4], *dst; +uint8_t *srcs[4]; int i, j, planes = 3; int ret; @@ -557,70 +554,60 @@ static int lag_decode_frame(AVCodecContext *avctx, switch (frametype) { case FRAME_SOLID_RGBA: -avctx->pix_fmt = AV_PIX_FMT_RGB32; +avctx->pix_fmt = AV_PIX_FMT_GBRAP; case FRAME_SOLID_GRAY: if (frametype == FRAME_SOLID_GRAY) if (avctx->bits_per_coded_sample == 24) { -avctx->pix_fmt = AV_PIX_FMT_RGB24; +avctx->pix_fmt = AV_PIX_FMT_GBRP; } else { -avctx->pix_fmt = AV_PIX_FMT_0RGB32; +avctx->pix_fmt = AV_PIX_FMT_GBRAP; planes = 4; } if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; -dst = p->data[0]; if (frametype == FRAME_SOLID_RGBA) { -int qwidth = avctx->width>>2; -uint64_t c = ((uint64_t)offset_gu << 32) | offset_gu; -for (j = 0; j < avctx->height; j++) { -for (i = 0; i < qwidth; i++) { -AV_WN64(dst + i * 16, c); -AV_WN64(dst + i * 16 + 8, c); +for (i = 0; i < avctx->height; i++) { +memset(p->data[0] + i * p->linesize[0], buf[2], avctx->width); +memset(p->data[1] + i * p->linesize[1], buf[1], avctx->width); +memset(p->data[2] + i * p->linesize[2], buf[3], avctx->width); +memset(p->data[3] + i * p->linesize[3], buf[4], avctx->width); } -for (i = 4*qwidth; i < avctx->width; i++) -AV_WN32(dst + i * 4, offset_gu); -dst += p->linesize[0]; -} } else { -for (j = 0; j < avctx->height; j++) { -memset(dst, buf[1], avctx->width * planes); -dst += p->linesize[0]; +for (i = 0; i < avctx->height; i++) { +for (j = 0; j < planes; j++) +memset(p->data[j] + i * p->linesize[j], buf[1], avctx->width); } } break; case FRAME_SOLID_COLOR: if (avctx->bits_per_coded_sample == 24) { -avctx->pix_fmt = AV_PIX_FMT_RGB24; +avctx->pix_fmt = AV_PIX_FMT_GBRP; } else { -avctx->pix_fmt = AV_PIX_FMT_RGB32; -offset_gu |= 0xFFU << 24; +avctx->pix_fmt = AV_PIX_FMT_GBRAP; } if ((ret = ff_thread_get_buffer(avctx, &frame,0)) < 0) return ret; -dst = p->data[0]; -for (j = 0; j < avctx->height; j++) { -for (i = 0; i < avctx->width; i++) -if (avctx->bits_per_coded_sample == 24) { -AV_WB24(dst + i * 3, offset_gu); -} else { -AV_WN32(dst + i * 4, offset_gu); -} -dst += p->linesize[0]; +for (i = 0; i < avctx->height; i++) { +memset(p->data[0] + i * p->linesize[0], buf[2], avctx->width); +memset(p->data[1] + i * p->linesize[1], buf[1], avctx->width); +memset(p->data[2] + i * p->linesize[2], buf[3], avctx->width); +if (avctx->pix_fmt == AV_PIX_FMT_GBRAP) +memset(p->data[3] + i * p->linesize[3], 0xFFu, avctx->width); } break; case FRAME_ARITH_RGBA: -avctx->pix_fmt = AV_PIX_FMT_RGB32; +avctx->pix_fmt = AV_PIX_FMT_GBRAP; planes = 4; offset_ry += 4; offs[3] = AV_RL32(buf + 9); case FRAME_ARITH_RGB24: case FRAME_U_RGB24: if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) -avctx->pix_fmt = AV_PIX_FMT_RGB