diff mbox series

[FFmpeg-devel,2/9] swscale: Add swscale input support for Y210LE

Message ID 1579071574-11806-1-git-send-email-linjie.fu@intel.com
State New
Headers show
Series [FFmpeg-devel,1/9] lavu/pix_fmt: add new pixel format y210
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Linjie Fu Jan. 15, 2020, 6:59 a.m. UTC
Add swscale input support for Y210LE, output support and fate
test could be added later if there is requirement for software
CSC to this packed format.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libswscale/input.c | 24 ++++++++++++++++++++++++
 libswscale/utils.c |  1 +
 2 files changed, 25 insertions(+)

Comments

Carl Eugen Hoyos Jan. 15, 2020, 6:29 p.m. UTC | #1
Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
>
> Add swscale input support for Y210LE, output support and fate
> test could be added later if there is requirement for software
> CSC to this packed format.

Please confirm that this works as expected on big-endian hardware.

Thank you, Carl Eugen
Linjie Fu Jan. 16, 2020, 6:47 a.m. UTC | #2
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Carl Eugen Hoyos
> Sent: Thursday, January 16, 2020 02:30
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> for Y210LE
> 
> Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
> >
> > Add swscale input support for Y210LE, output support and fate
> > test could be added later if there is requirement for software
> > CSC to this packed format.
> 
> Please confirm that this works as expected on big-endian hardware.
> 
If I understood correctly,  the concern is whether it works for Y210 software scale
on big-endian hardware, and whether it would break fate.

For Y210 on big-endian hardware, it'll be defined as Y210BE in pixfmt.h:
#define AV_PIX_FMT_Y210       AV_PIX_FMT_NE(Y210BE,  Y210LE)

And in the query of format_entries[] in utils.c, AV_PIX_FMT_Y210BE is not
declared to have the capability to support Input or Output in swscale. 

So Y210 software scale is not going to be supported on big-endian hardware.

Hence this won't break fate on big-endian hardware for Y210 IMHO, because this patch
didn't declare it has the capability for either input or output support.

If there is something wrong with my understanding, please correct me.

Thanks.
Carl Eugen Hoyos Jan. 16, 2020, 11:37 a.m. UTC | #3
Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Carl Eugen Hoyos
> > Sent: Thursday, January 16, 2020 02:30
> > To: FFmpeg development discussions and patches <ffmpeg-
> > devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> > for Y210LE
> >
> > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
> > >
> > > Add swscale input support for Y210LE, output support and fate
> > > test could be added later if there is requirement for software
> > > CSC to this packed format.
> >
> > Please confirm that this works as expected on big-endian hardware.
> >
> If I understood correctly,  the concern is whether it works for Y210 software scale
> on big-endian hardware, and whether it would break fate.

Exactly.
Just confirm (either in the commit message or via mail) that you tested it.

Carl Eugen
Linjie Fu Jan. 17, 2020, 4:15 a.m. UTC | #4
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Carl Eugen Hoyos
> Sent: Thursday, January 16, 2020 19:38
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> for Y210LE
> 
> Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
> >
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Carl Eugen Hoyos
> > > Sent: Thursday, January 16, 2020 02:30
> > > To: FFmpeg development discussions and patches <ffmpeg-
> > > devel@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input
> support
> > > for Y210LE
> > >
> > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
> > > >
> > > > Add swscale input support for Y210LE, output support and fate
> > > > test could be added later if there is requirement for software
> > > > CSC to this packed format.
> > >
> > > Please confirm that this works as expected on big-endian hardware.
> > >
> > If I understood correctly,  the concern is whether it works for Y210 software
> scale
> > on big-endian hardware, and whether it would break fate.
> 
> Exactly.
> Just confirm (either in the commit message or via mail) that you tested it.
> 

I'm willing to do some tests and provide more data, but unfortunately I don't have
big-endian hardware or environment.

Would you please help to recommend any testing methods/environment which is
accessible for FFmpeg testing on Big-endian hardware? 
(BTW, also tried arm server and Debian/MIPS on AWS,  but still got little-endian)

Thx.
Linjie Fu Jan. 19, 2020, 9:28 a.m. UTC | #5
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Carl Eugen Hoyos
> Sent: Thursday, January 16, 2020 19:38
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> for Y210LE
> 
> Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
> >
> > > -----Original Message-----
> > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > Carl Eugen Hoyos
> > > Sent: Thursday, January 16, 2020 02:30
> > > To: FFmpeg development discussions and patches <ffmpeg-
> > > devel@ffmpeg.org>
> > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input
> support
> > > for Y210LE
> > >
> > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
> > > >
> > > > Add swscale input support for Y210LE, output support and fate
> > > > test could be added later if there is requirement for software
> > > > CSC to this packed format.
> > >
> > > Please confirm that this works as expected on big-endian hardware.
> > >
> > If I understood correctly,  the concern is whether it works for Y210 software
> scale
> > on big-endian hardware, and whether it would break fate.
> 
> Exactly.
> Just confirm (either in the commit message or via mail) that you tested it.

Hi,

All fate tests passed on big-endian environment(ppc 64) except for the known dnn breaks.

(finally figured out to get access to a Power 8 with RHEL 7.2 ppc64, and
Configure ffmpeg with  --arch=ppc --enable-altivec --samples=fate-suite)

# lscpu
Architecture:          ppc64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Big Endian

The swscale works for y210le. (-pix_fmt y210le -i input.yuv ... -pix_fmt p010le)

And for y210(-pix_fmt y210 -i input.yuv), since we didn't declare the capability of  y210be,
it is not able to convert to other format as expected.

If there are more tests needed, please help to comment, thanks.
Carl Eugen Hoyos Jan. 19, 2020, 6:26 p.m. UTC | #6
Am So., 19. Jan. 2020 um 10:28 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
>
> > -----Original Message-----
> > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > Carl Eugen Hoyos
> > Sent: Thursday, January 16, 2020 19:38
> > To: FFmpeg development discussions and patches <ffmpeg-
> > devel@ffmpeg.org>
> > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> > for Y210LE
> >
> > Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <linjie.fu@intel.com>:
> > >
> > > > -----Original Message-----
> > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > > Carl Eugen Hoyos
> > > > Sent: Thursday, January 16, 2020 02:30
> > > > To: FFmpeg development discussions and patches <ffmpeg-
> > > > devel@ffmpeg.org>
> > > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input
> > support
> > > > for Y210LE
> > > >
> > > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <linjie.fu@intel.com>:
> > > > >
> > > > > Add swscale input support for Y210LE, output support and fate
> > > > > test could be added later if there is requirement for software
> > > > > CSC to this packed format.
> > > >
> > > > Please confirm that this works as expected on big-endian hardware.
> > > >
> > > If I understood correctly,  the concern is whether it works for Y210 software
> > scale
> > > on big-endian hardware, and whether it would break fate.
> >
> > Exactly.
> > Just confirm (either in the commit message or via mail) that you tested it.
>
> Hi,
>
> All fate tests passed on big-endian environment(ppc 64) except for the known dnn breaks.

Perfect, thank you!

Carl Eugen
Kieran Kunhya Jan. 19, 2020, 11:21 p.m. UTC | #7
>
> > > Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <
> linjie.fu@intel.com>:
> > > >
> > > > > -----Original Message-----
> > > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> > > > > Carl Eugen Hoyos
> > > > > Sent: Thursday, January 16, 2020 02:30
> > > > > To: FFmpeg development discussions and patches <ffmpeg-
> > > > > devel@ffmpeg.org>
> > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input
> > > support
> > > > > for Y210LE
> > > > >
> > > > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <
> linjie.fu@intel.com>:
> > > > > >
> > > > > > Add swscale input support for Y210LE, output support and fate
> > > > > > test could be added later if there is requirement for software
> > > > > > CSC to this packed format.
> > > > >
> > > > > Please confirm that this works as expected on big-endian hardware.
> > > > >
> > > > If I understood correctly,  the concern is whether it works for Y210
> software
> > > scale
> > > > on big-endian hardware, and whether it would break fate.
> > >
> > > Exactly.
> > > Just confirm (either in the commit message or via mail) that you
> tested it.
> >
> > Hi,
> >
> > All fate tests passed on big-endian environment(ppc 64) except for the
> known dnn breaks.
>
> Perfect, thank you!
>

I think this commit needs input from the technical committee, putting these
packed formats into swscale opens a can of worms.
So far as we treated formats like v210 and v210x like codecs (rightly or
wrongly).

Kieran
Linjie Fu Feb. 17, 2020, 4:07 p.m. UTC | #8
> -----Original Message-----
> From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
> Kieran Kunhya
> Sent: Monday, January 20, 2020 07:21
> To: FFmpeg development discussions and patches <ffmpeg-
> devel@ffmpeg.org>
> Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input support
> for Y210LE
> 
> >
> > > > Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <
> > linjie.fu@intel.com>:
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On
> Behalf Of
> > > > > > Carl Eugen Hoyos
> > > > > > Sent: Thursday, January 16, 2020 02:30
> > > > > > To: FFmpeg development discussions and patches <ffmpeg-
> > > > > > devel@ffmpeg.org>
> > > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale
> input
> > > > support
> > > > > > for Y210LE
> > > > > >
> > > > > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <
> > linjie.fu@intel.com>:
> > > > > > >
> > > > > > > Add swscale input support for Y210LE, output support and fate
> > > > > > > test could be added later if there is requirement for software
> > > > > > > CSC to this packed format.
> > > > > >
> > > > > > Please confirm that this works as expected on big-endian hardware.
> > > > > >
> > > > > If I understood correctly,  the concern is whether it works for Y210
> > software
> > > > scale
> > > > > on big-endian hardware, and whether it would break fate.
> > > >
> > > > Exactly.
> > > > Just confirm (either in the commit message or via mail) that you
> > tested it.
> > >
> > > Hi,
> > >
> > > All fate tests passed on big-endian environment(ppc 64) except for the
> > known dnn breaks.
> >
> > Perfect, thank you!
> >
> 
> I think this commit needs input from the technical committee, putting these
> packed formats into swscale opens a can of worms.
> So far as we treated formats like v210 and v210x like codecs (rightly or
> wrongly).
> 

Ping for this, and the whole patch set.
Paul B Mahol Feb. 17, 2020, 4:18 p.m. UTC | #9
On 1/20/20, Kieran Kunhya <kierank@obe.tv> wrote:
>>
>> > > Am Do., 16. Jan. 2020 um 07:49 Uhr schrieb Fu, Linjie <
>> linjie.fu@intel.com>:
>> > > >
>> > > > > -----Original Message-----
>> > > > > From: ffmpeg-devel <ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of
>> > > > > Carl Eugen Hoyos
>> > > > > Sent: Thursday, January 16, 2020 02:30
>> > > > > To: FFmpeg development discussions and patches <ffmpeg-
>> > > > > devel@ffmpeg.org>
>> > > > > Subject: Re: [FFmpeg-devel] [PATCH 2/9] swscale: Add swscale input
>> > > support
>> > > > > for Y210LE
>> > > > >
>> > > > > Am Mi., 15. Jan. 2020 um 07:59 Uhr schrieb Linjie Fu <
>> linjie.fu@intel.com>:
>> > > > > >
>> > > > > > Add swscale input support for Y210LE, output support and fate
>> > > > > > test could be added later if there is requirement for software
>> > > > > > CSC to this packed format.
>> > > > >
>> > > > > Please confirm that this works as expected on big-endian hardware.
>> > > > >
>> > > > If I understood correctly,  the concern is whether it works for Y210
>> software
>> > > scale
>> > > > on big-endian hardware, and whether it would break fate.
>> > >
>> > > Exactly.
>> > > Just confirm (either in the commit message or via mail) that you
>> tested it.
>> >
>> > Hi,
>> >
>> > All fate tests passed on big-endian environment(ppc 64) except for the
>> known dnn breaks.
>>
>> Perfect, thank you!
>>
>
> I think this commit needs input from the technical committee, putting these
> packed formats into swscale opens a can of worms.
> So far as we treated formats like v210 and v210x like codecs (rightly or
> wrongly).
>

Technical committee is scam!

> Kieran
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libswscale/input.c b/libswscale/input.c
index 064f8da..02e87f0 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -552,6 +552,24 @@  static void yvy2ToUV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, con
     av_assert1(src1 == src2);
 }
 
+static void y210le_UV_c(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src,
+                        const uint8_t *unused1, int width, uint32_t *unused2)
+{
+    int i;
+    for (i = 0; i < width; i++) {
+        AV_WN16(dstU + i * 2, AV_RL16(src + i * 8 + 2) >> 6);
+        AV_WN16(dstV + i * 2, AV_RL16(src + i * 8 + 6) >> 6);
+    }
+}
+
+static void y210le_Y_c(uint8_t *dst, const uint8_t *src, const uint8_t *unused0,
+                       const uint8_t *unused1, int width, uint32_t *unused2)
+{
+    int i;
+    for (i = 0; i < width; i++)
+        AV_WN16(dst + i * 2, AV_RL16(src + i * 4) >> 6);
+}
+
 static void bswap16Y_c(uint8_t *_dst, const uint8_t *_src, const uint8_t *unused1, const uint8_t *unused2, int width,
                        uint32_t *unused)
 {
@@ -1154,6 +1172,9 @@  av_cold void ff_sws_init_input_funcs(SwsContext *c)
     case AV_PIX_FMT_P016BE:
         c->chrToYV12 = p016BEToUV_c;
         break;
+    case AV_PIX_FMT_Y210LE:
+        c->chrToYV12 = y210le_UV_c;
+        break;
     }
     if (c->chrSrcHSubSample) {
         switch (srcFormat) {
@@ -1586,6 +1607,9 @@  av_cold void ff_sws_init_input_funcs(SwsContext *c)
         c->lumToYV12 = grayf32ToY16_bswap_c;
 #endif
         break;
+    case AV_PIX_FMT_Y210LE:
+        c->lumToYV12 = y210le_Y_c;
+        break;
     }
     if (c->needAlpha) {
         if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 57c4fd2..0ba312a 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -266,6 +266,7 @@  static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
     [AV_PIX_FMT_YUVA444P12LE] = { 1, 1 },
     [AV_PIX_FMT_NV24]        = { 1, 1 },
     [AV_PIX_FMT_NV42]        = { 1, 1 },
+    [AV_PIX_FMT_Y210LE]      = { 1, 0 },
 };
 
 int sws_isSupportedInput(enum AVPixelFormat pix_fmt)