diff mbox

[FFmpeg-devel] Add YUV-based floating-point pixel formats.

Message ID 20170902092217.6116-1-adsun701@gmail.com
State Rejected
Headers show

Commit Message

Andrew Sun Sept. 2, 2017, 9:22 a.m. UTC
This commit adds support for 32-bpc YUV-based floating-point pixel formats.
---
 doc/APIchanges      |  2 ++
 libavutil/pixdesc.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 libavutil/pixfmt.h  | 11 ++++++++
 libavutil/version.h |  2 +-
 4 files changed, 89 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer July 28, 2018, 1:12 a.m. UTC | #1
On Sat, Sep 02, 2017 at 09:22:17AM +0000, Andrew Sun wrote:
> This commit adds support for 32-bpc YUV-based floating-point pixel formats.
> ---
>  doc/APIchanges      |  2 ++
>  libavutil/pixdesc.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavutil/pixfmt.h  | 11 ++++++++
>  libavutil/version.h |  2 +-
>  4 files changed, 89 insertions(+), 1 deletion(-)

can you add support in libswscale too ? 
That way vf_scale and libavfilter will be able to automatically convert to
and from it

thanks

[...]
Paul B Mahol July 29, 2018, 12:07 p.m. UTC | #2
On 9/2/17, Andrew Sun <adsun701@gmail.com> wrote:
> This commit adds support for 32-bpc YUV-based floating-point pixel formats.
> ---
>  doc/APIchanges      |  2 ++
>  libavutil/pixdesc.c | 75
> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  libavutil/pixfmt.h  | 11 ++++++++
>  libavutil/version.h |  2 +-
>  4 files changed, 89 insertions(+), 1 deletion(-)
>

All float formats need proper definition in nut container.
Ronald S. Bultje July 29, 2018, 12:10 p.m. UTC | #3
Hi,

On Sun, Jul 29, 2018 at 8:07 AM, Paul B Mahol <onemda@gmail.com> wrote:

> On 9/2/17, Andrew Sun <adsun701@gmail.com> wrote:
> > This commit adds support for 32-bpc YUV-based floating-point pixel
> formats.
> > ---
> >  doc/APIchanges      |  2 ++
> >  libavutil/pixdesc.c | 75
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  libavutil/pixfmt.h  | 11 ++++++++
> >  libavutil/version.h |  2 +-
> >  4 files changed, 89 insertions(+), 1 deletion(-)
> >
>
> All float formats need proper definition in nut container.


The nut maintainer can do that him/herself.

I agree with Michael we need swscale support, we've always required that
for new (non-hw) pix_fmt additions.

Ronald
Andrew Sun July 29, 2018, 12:36 p.m. UTC | #4
On Sun, Jul 29, 2018 at 8:10 AM Ronald S. Bultje <rsbultje@gmail.com> wrote:

> Hi,
>
> On Sun, Jul 29, 2018 at 8:07 AM, Paul B Mahol <onemda@gmail.com> wrote:
>
>> On 9/2/17, Andrew Sun <adsun701@gmail.com> wrote:
>> > This commit adds support for 32-bpc YUV-based floating-point pixel
>> formats.
>> > ---
>> >  doc/APIchanges      |  2 ++
>> >  libavutil/pixdesc.c | 75
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  libavutil/pixfmt.h  | 11 ++++++++
>> >  libavutil/version.h |  2 +-
>> >  4 files changed, 89 insertions(+), 1 deletion(-)
>> >
>>
>> All float formats need proper definition in nut container.
>
>
> The nut maintainer can do that him/herself.
>
> I agree with Michael we need swscale support, we've always required that
> for new (non-hw) pix_fmt additions.
>
> Ronald
>
I am really sorry, this is an old email I tried to send over a year ago,
but my mail client did not work at the time
and I apparently forgot about the email until I fixed my mail client
recently, which led to this old mail being sent.

Andrew Sun
diff mbox

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index 4effbf9364..980b6e01bf 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,8 @@  libavutil:     2015-08-28
 
 
 API changes, most recent first:
+2017-09-01 - xxxxxxx - lavu 57.82.100 - pixfmt.h
+  Add YUV-based floating-point pixel formats.
 
 2017-09-01 - xxxxxxx - lavf 57.81.100 - avio.h
   Add avio_read_partial().
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index d45eae5772..d954866470 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2237,6 +2237,81 @@  static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
         .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
                  AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
     },
+    [AV_PIX_FMT_YUV420PF32BE] = {
+        .name = "yuv420pf32be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 1,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+                 AV_PIX_FMT_FLAG_FLOAT,
+    },
+    [AV_PIX_FMT_YUV420PF32LE] = {
+        .name = "yuv420pf32le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 1,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+    },
+    [AV_PIX_FMT_YUV422PF32BE] = {
+        .name = "yuv422pf32be",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+                 AV_PIX_FMT_FLAG_FLOAT,
+    },
+    [AV_PIX_FMT_YUV422PF32LE] = {
+        .name = "yuv422pf32le",
+        .nb_components = 3,
+        .log2_chroma_w = 1,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+    },
+    [AV_PIX_FMT_YUV444PF32BE] = {
+        .name = "yuv444pf32be",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+                 AV_PIX_FMT_FLAG_FLOAT,
+    },
+    [AV_PIX_FMT_YUV444PF32LE] = {
+        .name = "yuv444pf32le",
+        .nb_components = 3,
+        .log2_chroma_w = 0,
+        .log2_chroma_h = 0,
+        .comp = {
+            { 0, 4, 0, 0, 32, 3, 31, 1 },        /* R */
+            { 1, 4, 0, 0, 32, 3, 31, 1 },        /* G */
+            { 2, 4, 0, 0, 32, 3, 31, 1 },        /* B */
+        },
+        .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT,
+    },
 };
 #if FF_API_PLUS1_MINUS1
 FF_ENABLE_DEPRECATION_WARNINGS
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 6dd094376f..3863e1c9a9 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -334,6 +334,13 @@  enum AVPixelFormat {
     AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
     AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
 
+    AV_PIX_FMT_YUV420PF32BE, ///< IEEE-754 single precision planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples),   48bpp, big-endian
+    AV_PIX_FMT_YUV420PF32LE, ///< IEEE-754 single precision planar YUV 4:2:0 (1 Cr & Cb sample per 2x2 Y samples),   48bpp, little-endian
+    AV_PIX_FMT_YUV422PF32BE, ///< IEEE-754 single precision planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples),   64bpp, big-endian
+    AV_PIX_FMT_YUV422PF32LE, ///< IEEE-754 single precision planar YUV 4:2:2 (1 Cr & Cb sample per 2x1 Y samples),   64bpp, little-endian
+    AV_PIX_FMT_YUV444PF32BE, ///< IEEE-754 single precision planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples),   96bpp, big-endian
+    AV_PIX_FMT_YUV444PF32LE, ///< IEEE-754 single precision planar YUV 4:4:4 (1 Cr & Cb sample per 1x1 Y samples),   96bpp, little-endian
+
     AV_PIX_FMT_NB         ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
 };
 
@@ -401,6 +408,10 @@  enum AVPixelFormat {
 #define AV_PIX_FMT_GBRPF32    AV_PIX_FMT_NE(GBRPF32BE,  GBRPF32LE)
 #define AV_PIX_FMT_GBRAPF32   AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
 
+#define AV_PIX_FMT_YUV420PF32 AV_PIX_FMT_NE(YUV420PF32BE, YUV420PF32LE)
+#define AV_PIX_FMT_YUV422PF32 AV_PIX_FMT_NE(YUV422PF32BE, YUV422PF32LE)
+#define AV_PIX_FMT_YUV444PF32 AV_PIX_FMT_NE(YUV444PF32BE, YUV444PF32LE)
+
 #define AV_PIX_FMT_YUVA420P9  AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
 #define AV_PIX_FMT_YUVA422P9  AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
 #define AV_PIX_FMT_YUVA444P9  AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE)
diff --git a/libavutil/version.h b/libavutil/version.h
index 6e25b4690c..d99eff5d15 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -80,7 +80,7 @@ 
 
 
 #define LIBAVUTIL_VERSION_MAJOR  55
-#define LIBAVUTIL_VERSION_MINOR  74
+#define LIBAVUTIL_VERSION_MINOR  75
 #define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \