Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Leo Izen <leo.izen@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v11] avcodec: add farbfeld encoder, decoder and demuxer
Date: Sat, 8 Jun 2024 20:13:15 -0400
Message-ID: <078e828c-091f-4e61-aa98-f3ced854124b@gmail.com> (raw)
In-Reply-To: <20240607200226.171657-1-marcus@marcusspencer.xyz>

On 6/7/24 4:02 PM, Marcus B Spencer wrote:
> farbfeld is an uncompressed image format that is a part of suckless
> tools (https://tools.suckless.org).
> 
> Its documentation is available at https://tools.suckless.org/farbfeld.
> 
> Add support for this image format in avcodec and avformat, and update the image2
> format accordingly.
> 
> Signed-off-by: Marcus B Spencer <marcus@marcusspencer.xyz>
> ---
>   Changelog                 |  1 +
>   doc/general_contents.texi |  2 +
>   libavcodec/Makefile       |  2 +
>   libavcodec/allcodecs.c    |  2 +
>   libavcodec/codec_desc.c   |  7 +++
>   libavcodec/codec_id.h     |  1 +
>   libavcodec/farbfelddec.c  | 83 +++++++++++++++++++++++++++++++++
>   libavcodec/farbfeldenc.c  | 96 +++++++++++++++++++++++++++++++++++++++
>   libavcodec/version.h      |  4 +-
>   libavformat/Makefile      |  1 +
>   libavformat/allformats.c  |  1 +
>   libavformat/img2.c        |  1 +
>   libavformat/img2dec.c     | 16 +++++++
>   libavformat/img2enc.c     |  2 +-
>   libavformat/version.h     |  4 +-
>   15 files changed, 218 insertions(+), 5 deletions(-)
>   create mode 100644 libavcodec/farbfelddec.c
>   create mode 100644 libavcodec/farbfeldenc.c
> 
> diff --git a/Changelog b/Changelog
> index 03d6b29ad8..102c718ffc 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -12,6 +12,7 @@ version <next>:
>   - qsv_params option added for QSV encoders
>   - VVC decoder compatible with DVB test content
>   - xHE-AAC decoder
> +- farbfeld encoder, decoder and demuxer
>   
>   
>   version 7.0:
> diff --git a/doc/general_contents.texi b/doc/general_contents.texi
> index e7cf4f8239..fab30610a4 100644
> --- a/doc/general_contents.texi
> +++ b/doc/general_contents.texi
> @@ -853,6 +853,8 @@ following image formats are supported:
>       @tab X PixMap image format
>   @item XWD  @tab X @tab X
>       @tab X Window Dump image format
> +@item FF           @tab X @tab X
> +    @tab farbfeld uncompressed image format
>   @end multitable
>   
>   @code{X} means that the feature in that column (encoding / decoding) is supported.
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 8ab4398b6c..08a3d39af0 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -356,6 +356,8 @@ OBJS-$(CONFIG_ESCAPE130_DECODER)       += escape130.o
>   OBJS-$(CONFIG_EVRC_DECODER)            += evrcdec.o acelp_vectors.o lsp.o
>   OBJS-$(CONFIG_EXR_DECODER)             += exr.o exrdsp.o half2float.o
>   OBJS-$(CONFIG_EXR_ENCODER)             += exrenc.o float2half.o
> +OBJS-$(CONFIG_FARBFELD_DECODER)        += farbfelddec.o
> +OBJS-$(CONFIG_FARBFELD_ENCODER)        += farbfeldenc.o
>   OBJS-$(CONFIG_FASTAUDIO_DECODER)       += fastaudio.o
>   OBJS-$(CONFIG_FFV1_DECODER)            += ffv1dec.o ffv1.o
>   OBJS-$(CONFIG_FFV1_ENCODER)            += ffv1enc.o ffv1.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index b102a8069e..9f9eda8ec6 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -115,6 +115,8 @@ extern const FFCodec ff_escape124_decoder;
>   extern const FFCodec ff_escape130_decoder;
>   extern const FFCodec ff_exr_encoder;
>   extern const FFCodec ff_exr_decoder;
> +extern const FFCodec ff_farbfeld_decoder;
> +extern const FFCodec ff_farbfeld_encoder;
>   extern const FFCodec ff_ffv1_encoder;
>   extern const FFCodec ff_ffv1_decoder;
>   extern const FFCodec ff_ffvhuff_encoder;
> diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
> index a28ef68061..33dbd2ce94 100644
> --- a/libavcodec/codec_desc.c
> +++ b/libavcodec/codec_desc.c
> @@ -1959,6 +1959,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
>           .long_name = NULL_IF_CONFIG_SMALL("LEAD MCMP"),
>           .props     = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
>       },
> +    {
> +        .id        = AV_CODEC_ID_FARBFELD,
> +        .type      = AVMEDIA_TYPE_VIDEO,
> +        .name      = "farbfeld",
> +        .long_name = NULL_IF_CONFIG_SMALL("farbfeld uncompressed image"),
> +        .props     = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
> +    },
>   
>       /* various PCM "codecs" */
>       {
> diff --git a/libavcodec/codec_id.h b/libavcodec/codec_id.h
> index 0ab1e34a61..d4b0d23f7e 100644
> --- a/libavcodec/codec_id.h
> +++ b/libavcodec/codec_id.h
> @@ -322,6 +322,7 @@ enum AVCodecID {
>       AV_CODEC_ID_RTV1,
>       AV_CODEC_ID_VMIX,
>       AV_CODEC_ID_LEAD,
> +    AV_CODEC_ID_FARBFELD,
>   
>       /* various PCM "codecs" */
>       AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
> diff --git a/libavcodec/farbfelddec.c b/libavcodec/farbfelddec.c
> new file mode 100644
> index 0000000000..648301dbc6
> --- /dev/null
> +++ b/libavcodec/farbfelddec.c
> @@ -0,0 +1,83 @@
> +/*
> + * Copyright (c) 2024 Marcus B Spencer <marcus@marcusspencer.xyz>
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a copy
> + * of this software and associated documentation files (the “Software”), to
> + * deal in the Software without restriction, including without limitation the
> + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
> + * sell copies of the Software, and to permit persons to whom the Software is
> + * furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be included in
> + * all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
> + * IN THE SOFTWARE.
> + */
> +
> +#include "avcodec.h"
> +#include "bytestream.h"
> +#include "codec_internal.h"
> +#include "decode.h"
> +#include "libavutil/imgutils.h"
> +#include "thread.h"
> +
> +static int farbfeld_decode_frame(AVCodecContext *ctx, AVFrame *p,
> +                                 int *got_frame, AVPacket *pkt)
> +{
> +    int width, height;
> +    GetByteContext g;
> +    int ret;
> +
> +    bytestream2_init(&g, pkt->data, pkt->size);
> +    bytestream2_skip(&g, 8);
If these eight bytes are signature, they should be checked by the 
decoder, not skipped.

- Leo Izen
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2024-06-09  0:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 20:02 Marcus B Spencer
2024-06-09  0:13 ` Leo Izen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=078e828c-091f-4e61-aa98-f3ced854124b@gmail.com \
    --to=leo.izen@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git