Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lance Wang <lance.lmwang@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/bitpacked_enc: add support for uyvy422 encoding
Date: Mon, 8 May 2023 09:29:15 +0800
Message-ID: <CAM=jba-_i07V+L0K-ovWtr4QDjdUqEb5cCR1GJxHd6Zok2f9TA@mail.gmail.com> (raw)
In-Reply-To: <b75bb8d8-9498-4acc-e43b-0e662f71cefd@gmail.com>

On Mon, May 8, 2023 at 6:56 AM James Almer <jamrial@gmail.com> wrote:

> On 5/7/2023 4:00 AM, Lance Wang wrote:
> > On Sun, May 7, 2023 at 1:38 AM James Almer <jamrial@gmail.com> wrote:
> >
> >> Signed-off-by: James Almer <jamrial@gmail.com>
> >> ---
> >>   libavcodec/bitpacked_enc.c | 27 ++++++++++++++++++++++++++-
> >>   1 file changed, 26 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/libavcodec/bitpacked_enc.c b/libavcodec/bitpacked_enc.c
> >> index 3c4e11293d..cbca38006b 100644
> >> --- a/libavcodec/bitpacked_enc.c
> >> +++ b/libavcodec/bitpacked_enc.c
> >> @@ -25,12 +25,36 @@
> >>   #include "encode.h"
> >>   #include "internal.h"
> >>   #include "put_bits.h"
> >> +#include "libavutil/imgutils.h"
> >>   #include "libavutil/pixdesc.h"
> >>
> >>   struct BitpackedContext {
> >>       int (*encode)(AVCodecContext *avctx, AVPacket *pkt, const AVFrame
> >> *frame);
> >>   };
> >>
> >> +static int encode_uyvy422(AVCodecContext *avctx, AVPacket *pkt, const
> >> AVFrame *frame)
> >> +{
> >> +    int ret = av_image_get_buffer_size(frame->format,
> >> +                                       frame->width, frame->height, 1);
> >> +
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    ret = ff_get_encode_buffer(avctx, pkt, ret, 0);
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    ret = av_image_copy_to_buffer(pkt->data, pkt->size,
> >> +                                  (const uint8_t **)frame->data,
> >> frame->linesize,
> >> +                                  frame->format,
> >> +                                  frame->width, frame->height, 1);
> >> +
> >> +    if (ret < 0)
> >> +        return ret;
> >> +
> >> +    return 0;
> >> +}
> >> +
> >>
> >
> >
> > I prefer to bitpack will used for 10-bit 4:2:2 packed format.  uyvy422
> > should use rawvideo as it'll passthrough directly.
>
> I'm not sure i follow. The rawvideo encoder will do exactly the same
> thing I'm doing here.
>
> Are you maybe talking about patch 3/4?
>

The old rtpdec_rfc4175 use bitpack with rawvideo for uyvy422 and I have
changed to
used rawvideo directly.  For I think bitpacked is better to use for 10-bit
4:2:2 packed format.
However I haven't removed the old uyvy422 decode code in 3/4 for I'm not
sure whether
it'll break any ABI for old avformat.



> >
> >
> >   static int encode_yuv422p10(AVCodecContext *avctx, AVPacket *pkt, const
> >> AVFrame *frame)
> >>   {
> >>       const int buf_size = avctx->height * avctx->width *
> >> avctx->bits_per_coded_sample / 8;
> >> @@ -85,7 +109,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
> >>       if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
> >>           s->encode = encode_yuv422p10;
> >>       else
> >> -        return AVERROR(EINVAL);
> >> +        s->encode = encode_uyvy422;
> >>
> >>       return 0;
> >>   }
> >> @@ -115,5 +139,6 @@ const FFCodec ff_bitpacked_encoder = {
> >>       .init           = encode_init,
> >>       FF_CODEC_ENCODE_CB(encode_frame),
> >>       .p.pix_fmts     = (const enum AVPixelFormat[]){
> AV_PIX_FMT_YUV422P10,
> >> +                                                    AV_PIX_FMT_UYVY422,
> >>                                                       AV_PIX_FMT_NONE },
> >>   };
> >> --
> >> 2.40.1
> >>
> >> _______________________________________________
> >> 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".
> >>
> > _______________________________________________
> > 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".
> _______________________________________________
> 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".
>
_______________________________________________
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:[~2023-05-08  1:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 17:37 James Almer
2023-05-06 17:37 ` [FFmpeg-devel] [PATCH 2/4] avcodec/bitpacked_dec: add missing props to decoded uyvy422 streams James Almer
2023-05-06 17:37 ` [FFmpeg-devel] [PATCH 3/4] aformat/rawvideodec: don't force the rawvideo decoder for uyvy422 bitpacked streams James Almer
2023-05-06 17:37 ` [FFmpeg-devel] [PATCH 4/4] fate/vcodec: add bitpacked tests James Almer
2023-05-07  7:00 ` [FFmpeg-devel] [PATCH 1/4] avcodec/bitpacked_enc: add support for uyvy422 encoding Lance Wang
2023-05-07 22:56   ` James Almer
2023-05-08  1:29     ` Lance Wang [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='CAM=jba-_i07V+L0K-ovWtr4QDjdUqEb5cCR1GJxHd6Zok2f9TA@mail.gmail.com' \
    --to=lance.lmwang@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