From: Mark Reid <mindmark@gmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v4 1/4] swscale/input: add rgbaf32 input support
Date: Tue, 22 Nov 2022 13:17:09 -0800
Message-ID: <CA+anCRks5mFvxsu3uuGfVBEDhCD0qhiFCFCEfQwt2PM-ATPd6Q@mail.gmail.com> (raw)
In-Reply-To: <20221122194247.GG710311@pb2>
On Tue, Nov 22, 2022 at 11:43 AM Michael Niedermayer <michael@niedermayer.cc>
wrote:
> On Mon, Nov 21, 2022 at 02:11:43PM -0800, mindmark@gmail.com wrote:
> > From: Mark Reid <mindmark@gmail.com>
> >
> > ---
> > libswscale/input.c | 120 +++++++++++++++++++++++++++++++++++++++++++++
> > libswscale/utils.c | 6 +++
> > 2 files changed, 126 insertions(+)
> >
> > diff --git a/libswscale/input.c b/libswscale/input.c
> > index d5676062a2..a305be5ac2 100644
> > --- a/libswscale/input.c
> > +++ b/libswscale/input.c
> > @@ -1284,6 +1284,96 @@ static void rgbaf16##endian_name##ToA_c(uint8_t
> *_dst, const uint8_t *_src, cons
> > rgbaf16_funcs_endian(le, 0)
> > rgbaf16_funcs_endian(be, 1)
> >
> > +#define rdpx(src) (is_be ? av_int2float(AV_RB32(&src)):
> av_int2float(AV_RL32(&src)))
> > +
> > +static av_always_inline void rgbaf32ToUV_endian(uint16_t *dstU,
> uint16_t *dstV, int is_be,
> > + const float *src, int
> width,
> > + int32_t *rgb2yuv, int
> comp)
> > +{
> > + int32_t ru = rgb2yuv[RU_IDX], gu = rgb2yuv[GU_IDX], bu =
> rgb2yuv[BU_IDX];
> > + int32_t rv = rgb2yuv[RV_IDX], gv = rgb2yuv[GV_IDX], bv =
> rgb2yuv[BV_IDX];
> > + int i;
> > + for (i = 0; i < width; i++) {
> > + int r = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f,
> 65535.0f));
> > + int g = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f,
> 65535.0f));
> > + int b = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f,
> 65535.0f));
> > +
> > + dstU[i] = (ru*r + gu*g + bu*b + (0x10001<<(RGB2YUV_SHIFT-1)))
> >> RGB2YUV_SHIFT;
> > + dstV[i] = (rv*r + gv*g + bv*b + (0x10001<<(RGB2YUV_SHIFT-1)))
> >> RGB2YUV_SHIFT;
> > + }
> > +}
>
>
>
>
>
> > +
> > +static av_always_inline void rgbaf32ToY_endian(uint16_t *dst, const
> float *src, int is_be,
> > + int width, int32_t
> *rgb2yuv, int comp)
> > +{
> > + int32_t ry = rgb2yuv[RY_IDX], gy = rgb2yuv[GY_IDX], by =
> rgb2yuv[BY_IDX];
> > + int i;
> > + for (i = 0; i < width; i++) {
> > + int r = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+0]), 0.0f,
> 65535.0f));
> > + int g = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+1]), 0.0f,
> 65535.0f));
> > + int b = lrintf(av_clipf(65535.0f * rdpx(src[i*comp+2]), 0.0f,
> 65535.0f));
> > +
> > + dst[i] = (ry*r + gy*g + by*b + (0x2001<<(RGB2YUV_SHIFT-1))) >>
> RGB2YUV_SHIFT;
> > + }
> > +}
>
> I thought you would post a patchset that in the end has 1 lrintf/av_clipf
> for a function like this not 3
> Just asking as you arent saying this is temporary in this set nor why its
> left liek this nor does it include the factorization of these operations
>
>
Sorry I must have misunderstood. I was hoping I could leave it like this
temporarily as it matches the planar f32 version and address the
factorization separate patchset.
> thx
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> I have never wished to cater to the crowd; for what I know they do not
> approve, and what they approve I do not know. -- Epicurus
> _______________________________________________
> 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".
next prev parent reply other threads:[~2022-11-22 21:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 22:11 [FFmpeg-devel] [PATCH v4 0/4] swscale: rgbaf32 input/output support mindmark
2022-11-21 22:11 ` [FFmpeg-devel] [PATCH v4 1/4] swscale/input: add rgbaf32 input support mindmark
2022-11-22 19:42 ` Michael Niedermayer
2022-11-22 21:17 ` Mark Reid [this message]
2022-11-22 22:43 ` Michael Niedermayer
2022-11-23 2:07 ` Mark Reid
2022-11-21 22:11 ` [FFmpeg-devel] [PATCH v4 2/4] avfilter/vf_hflip: add support for packed rgb float formats mindmark
2022-11-21 22:11 ` [FFmpeg-devel] [PATCH v4 3/4] avfilter/vf_transpose: " mindmark
2022-11-21 22:11 ` [FFmpeg-devel] [PATCH v4 4/4] swscale/output: add rgbaf32 output support mindmark
2022-11-21 22:21 ` [FFmpeg-devel] [PATCH v4 0/4] swscale: rgbaf32 input/output support StreamNG Harold Camargo
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=CA+anCRks5mFvxsu3uuGfVBEDhCD0qhiFCFCEfQwt2PM-ATPd6Q@mail.gmail.com \
--to=mindmark@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