Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format
On Fri, Jan 19, 2024 at 5:56 PM Connor Worley wrote: > Thanks for the feedback! For the next revision, is it preferred to reply > to this thread or create a new one? > here is fine > On 1/19/24 08:23, Vittorio Giovara wrote: > >> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > >> index 93ce8e3224..ef8c3a6d7d 100644 > >> --- a/libavcodec/allcodecs.c > >> +++ b/libavcodec/allcodecs.c > >> @@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder; > >> extern const FFCodec ff_dvvideo_decoder; > >> extern const FFCodec ff_dxa_decoder; > >> extern const FFCodec ff_dxtory_decoder; > >> +extern const FFCodec ff_dxv_encoder; > >> extern const FFCodec ff_dxv_decoder; > >> > > nit: keep list in order > > > Not sure what you mean, the present order seems to be encoder followed by > decoder for codecs that have both. > disregard, I assumed it was in alphabetical order > > What does the HT stand for? > > > Hash table -- this change implements a simple linear probing approach. > got it, would be nice to have a small comment on why it's needed, as documentation > >> +#define LOOKBACK_WORDS0x20202 > >> + > >> +enum DXVTextureFormat { > >> +DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), > >> +}; > >> > > Why would you go for an enum here? Just for future expansion and the > switch > > case below? > > > Exactly, that's the plan. > very cool -- Vittorio ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format
Thanks for the feedback! For the next revision, is it preferred to reply to this thread or create a new one? On 1/19/24 08:23, Vittorio Giovara wrote: >> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c >> index 93ce8e3224..ef8c3a6d7d 100644 >> --- a/libavcodec/allcodecs.c >> +++ b/libavcodec/allcodecs.c >> @@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder; >> extern const FFCodec ff_dvvideo_decoder; >> extern const FFCodec ff_dxa_decoder; >> extern const FFCodec ff_dxtory_decoder; >> +extern const FFCodec ff_dxv_encoder; >> extern const FFCodec ff_dxv_decoder; >> > nit: keep list in order Not sure what you mean, the present order seems to be encoder followed by decoder for codecs that have both. >> extern const FFCodec ff_eacmv_decoder; >> extern const FFCodec ff_eamad_decoder; >> diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c >> new file mode 100644 >> index 00..33080fa1c9 >> --- /dev/null >> +++ b/libavcodec/dxvenc.c >> @@ -0,0 +1,358 @@ >> +/* >> + * Resolume DXV encoder >> + * Copyright (C) 2015 Vittorio Giovara >> + * Copyright (C) 2015 Tom Butterworth >> + * Copyright (C) 2018 Paul B Mahol >> + * Copyright (C) 2024 Connor Worley >> > Idk about tom or paul, but I haven't done anything for this encoder :) > I think you can prune the list of copyright quite a bit here Got it. I copied some code verbatim from dxv.c and hapenc.c and erred on the side of overcrediting. >> +#define LOOKBACK_HT_ELEMS 0x4 >> > What does the HT stand for? Hash table -- this change implements a simple linear probing approach. >> +#define LOOKBACK_WORDS0x20202 >> + >> +enum DXVTextureFormat { >> +DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), >> +}; >> > Why would you go for an enum here? Just for future expansion and the switch > case below? Exactly, that's the plan. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format
Hi, thanks for the patch, below a few minor nits On Wed, Jan 17, 2024 at 9:57 PM Connor Worley wrote: > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c > index 93ce8e3224..ef8c3a6d7d 100644 > --- a/libavcodec/allcodecs.c > +++ b/libavcodec/allcodecs.c > @@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder; > extern const FFCodec ff_dvvideo_decoder; > extern const FFCodec ff_dxa_decoder; > extern const FFCodec ff_dxtory_decoder; > +extern const FFCodec ff_dxv_encoder; > extern const FFCodec ff_dxv_decoder; > nit: keep list in order > extern const FFCodec ff_eacmv_decoder; > extern const FFCodec ff_eamad_decoder; > diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c > new file mode 100644 > index 00..33080fa1c9 > --- /dev/null > +++ b/libavcodec/dxvenc.c > @@ -0,0 +1,358 @@ > +/* > + * Resolume DXV encoder > + * Copyright (C) 2015 Vittorio Giovara > + * Copyright (C) 2015 Tom Butterworth > + * Copyright (C) 2018 Paul B Mahol > + * Copyright (C) 2024 Connor Worley > Idk about tom or paul, but I haven't done anything for this encoder :) I think you can prune the list of copyright quite a bit here > +#define LOOKBACK_HT_ELEMS 0x4 > What does the HT stand for? > +#define LOOKBACK_WORDS0x20202 > + > +enum DXVTextureFormat { > +DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), > +}; > Why would you go for an enum here? Just for future expansion and the switch case below? lgtm overall -- Vittorio ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format
On 1/17/24 08:55, Connor Worley wrote: Signed-off-by: Connor Worley --- Changelog | 1 + configure | 1 + doc/general_contents.texi | 3 +- libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/dxvenc.c | 362 ++ libavcodec/version.h | 2 +- 7 files changed, 369 insertions(+), 2 deletions(-) create mode 100644 libavcodec/dxvenc.c diff --git a/Changelog b/Changelog index 5b2899d05b..224d84664a 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version : +- DXV DXT1 encoder - LEAD MCMP decoder - EVC decoding using external library libxevd - EVC encoding using external library libxeve diff --git a/configure b/configure index c8ae0a061d..21663000f8 100755 --- a/configure +++ b/configure @@ -2851,6 +2851,7 @@ dvvideo_decoder_select="dvprofile idctdsp" dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp" dxa_decoder_deps="zlib" dxv_decoder_select="lzf texturedsp" +dxv_encoder_select="texturedspenc" eac3_decoder_select="ac3_decoder" eac3_encoder_select="ac3_encoder" eamad_decoder_select="aandcttables blockdsp bswapdsp" diff --git a/doc/general_contents.texi b/doc/general_contents.texi index 8b48fed060..f269cbd1a9 100644 --- a/doc/general_contents.texi +++ b/doc/general_contents.texi @@ -670,7 +670,8 @@ library: @item Redirector @tab @tab X @item RedSpark @tab @tab X @item Renderware TeXture Dictionary @tab @tab X -@item Resolume DXV @tab @tab X +@item Resolume DXV @tab X @tab X + @tab Encoding is only supported for the DXT1 (Normal Quality, No Alpha) texture format. @item RF64 @tab @tab X @item RL2 @tab @tab X @tab Audio and video format used in some games by Entertainment Software Partners. diff --git a/libavcodec/Makefile b/libavcodec/Makefile index bb42095165..96361ac794 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -341,6 +341,7 @@ OBJS-$(CONFIG_DVVIDEO_ENCODER) += dvenc.o dv.o dvdata.o OBJS-$(CONFIG_DXA_DECODER) += dxa.o OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o OBJS-$(CONFIG_DXV_DECODER) += dxv.o +OBJS-$(CONFIG_DXV_ENCODER) += dxvenc.o OBJS-$(CONFIG_EAC3_DECODER) += eac3_data.o OBJS-$(CONFIG_EAC3_ENCODER) += eac3enc.o eac3_data.o OBJS-$(CONFIG_EACMV_DECODER) += eacmv.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 93ce8e3224..ef8c3a6d7d 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -106,6 +106,7 @@ extern const FFCodec ff_dvvideo_encoder; extern const FFCodec ff_dvvideo_decoder; extern const FFCodec ff_dxa_decoder; extern const FFCodec ff_dxtory_decoder; +extern const FFCodec ff_dxv_encoder; extern const FFCodec ff_dxv_decoder; extern const FFCodec ff_eacmv_decoder; extern const FFCodec ff_eamad_decoder; diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c new file mode 100644 index 00..36ee06699d --- /dev/null +++ b/libavcodec/dxvenc.c @@ -0,0 +1,362 @@ +/* + * Resolume DXV encoder + * Copyright (C) 2015 Vittorio Giovara + * Copyright (C) 2015 Tom Butterworth + * Copyright (C) 2018 Paul B Mahol + * Copyright (C) 2024 Connor Worley + * + * 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 + +#include "libavutil/crc.h" +#include "libavutil/imgutils.h" +#include "libavutil/opt.h" + +#include "mathops.h" +#include "avcodec.h" +#include "bytestream.h" +#include "codec_internal.h" +#include "encode.h" +#include "lzf.h" +#include "texturedsp.h" +#include "thread.h" + +#define LOOKBACK_HT_ELEMS 0x4 +#define LOOKBACK_WORDS 0x20202 + +enum DXVTextureFormat { + DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), +}; + +typedef struct HTEntry { + uint32_t key; + uint32_t pos; +} HTEntry; + +static void ht_init(HTEntry *ht) +{ + for (size_t i = 0; i < LOOKBACK_HT_ELEMS; i++) { + ht[i].pos = -1; + } +} + +static uint32_t ht_lookup_and_upsert(HTEntry *ht, AVCRC *hash_ctx, + uint32_t
Re: [FFmpeg-devel] [PATCH] Add DXV encoder with support for DXT1 texture format
On Wed, Jan 17, 2024 at 12:27:40AM -0800, Connor Worley wrote: > Signed-off-by: Connor Worley > --- > Changelog | 1 + > configure | 1 + > doc/general_contents.texi | 3 +- > libavcodec/Makefile | 1 + > libavcodec/allcodecs.c| 1 + > libavcodec/dxvenc.c | 362 ++ > libavcodec/version.h | 2 +- > 7 files changed, 369 insertions(+), 2 deletions(-) > create mode 100644 libavcodec/dxvenc.c > > diff --git a/Changelog b/Changelog > index 5b2899d05b..224d84664a 100644 > --- a/Changelog > +++ b/Changelog > @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest > within each release, > releases are sorted from youngest to oldest. > version : > +- DXV DXT1 encoder > - LEAD MCMP decoder > - EVC decoding using external library libxevd > - EVC encoding using external library libxeve please resend without extra linebreaks Applying: Add DXV encoder with support for DXT1 texture format error: corrupt patch at line 23 thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB "You are 36 times more likely to die in a bathtub than at the hands of a terrorist. Also, you are 2.5 times more likely to become a president and 2 times more likely to become an astronaut, than to die in a terrorist attack." -- Thoughty2 signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".