diff mbox series

[FFmpeg-devel,2/4] libavcodec/h2645_sei: export raw LCEVC metadata

Message ID 20240720124510.1689-2-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/4] avutil/frame: add an LCEVC enhancement data payload side data type | expand

Commit Message

James Almer July 20, 2024, 12:45 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/h2645_sei.c | 36 ++++++++++++++++++++++++++++++++++++
 libavcodec/h2645_sei.h |  5 +++++
 libavcodec/itut35.h    |  2 ++
 3 files changed, 43 insertions(+)

Comments

Michael Niedermayer July 20, 2024, 11:38 p.m. UTC | #1
On Sat, Jul 20, 2024 at 09:45:08AM -0300, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/h2645_sei.c | 36 ++++++++++++++++++++++++++++++++++++
>  libavcodec/h2645_sei.h |  5 +++++
>  libavcodec/itut35.h    |  2 ++
>  3 files changed, 43 insertions(+)

I must be missing some patch as this doesnt build

libavcodec/h2645_sei.c: In function ‘h2645_sei_to_side_data’:
libavcodec/h2645_sei.c:698:63: error: ‘frame’ undeclared (first use in this function)
  698 |         AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_LCEVC, lcevc->info);
      |                                                               ^~~~~
libavcodec/h2645_sei.c:698:63: note: each undeclared identifier is reported only once for each function it appears in
CC	libavcodec/x86/flacencdsp_init.o
make: *** [ffbuild/common.mak:81: libavcodec/h2645_sei.o] Error 1


[...]
Gagan Sidhu July 20, 2024, 11:40 p.m. UTC | #2
that file has nothing to do with the patch.

but i think you may have been outed as an APPUL user.

PREPARE THE SOCKS AND SOAP BARS, LADS

Thanks,
Gagan

> On Jul 20, 2024, at 5:38 PM, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
> On Sat, Jul 20, 2024 at 09:45:08AM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavcodec/h2645_sei.c | 36 ++++++++++++++++++++++++++++++++++++
>> libavcodec/h2645_sei.h |  5 +++++
>> libavcodec/itut35.h    |  2 ++
>> 3 files changed, 43 insertions(+)
> 
> I must be missing some patch as this doesnt build
> 
> libavcodec/h2645_sei.c: In function ‘h2645_sei_to_side_data’:
> libavcodec/h2645_sei.c:698:63: error: ‘frame’ undeclared (first use in this function)
>  698 |         AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_LCEVC, lcevc->info);
>      |                                                               ^~~~~
> libavcodec/h2645_sei.c:698:63: note: each undeclared identifier is reported only once for each function it appears in
> CC	libavcodec/x86/flacencdsp_init.o
> make: *** [ffbuild/common.mak:81: libavcodec/h2645_sei.o] Error 1
> 
> 
> [...]
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> Elect your leaders based on what they did after the last election, not
> based on what they say before an election.
> 
> _______________________________________________
> 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".
James Almer July 21, 2024, 12:17 a.m. UTC | #3
On 7/20/2024 8:38 PM, Michael Niedermayer wrote:
> On Sat, Jul 20, 2024 at 09:45:08AM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>   libavcodec/h2645_sei.c | 36 ++++++++++++++++++++++++++++++++++++
>>   libavcodec/h2645_sei.h |  5 +++++
>>   libavcodec/itut35.h    |  2 ++
>>   3 files changed, 43 insertions(+)
> 
> I must be missing some patch as this doesnt build

No, just a rebase mistake. Will resend the set later.

> 
> libavcodec/h2645_sei.c: In function ‘h2645_sei_to_side_data’:
> libavcodec/h2645_sei.c:698:63: error: ‘frame’ undeclared (first use in this function)
>    698 |         AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_LCEVC, lcevc->info);
>        |                                                               ^~~~~
> libavcodec/h2645_sei.c:698:63: note: each undeclared identifier is reported only once for each function it appears in
> CC	libavcodec/x86/flacencdsp_init.o
> make: *** [ffbuild/common.mak:81: libavcodec/h2645_sei.o] Error 1
Gagan Sidhu July 21, 2024, 12:18 a.m. UTC | #4
oh ADHD fail my bad.

i'll unsub now haha. but please do add the "RETINA" functionality to ffmpeg. thanks and bye


Thanks,
Gagan

> On Jul 20, 2024, at 6:17 PM, James Almer <jamrial@gmail.com> wrote:
> 
> On 7/20/2024 8:38 PM, Michael Niedermayer wrote:
>> On Sat, Jul 20, 2024 at 09:45:08AM -0300, James Almer wrote:
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  libavcodec/h2645_sei.c | 36 ++++++++++++++++++++++++++++++++++++
>>>  libavcodec/h2645_sei.h |  5 +++++
>>>  libavcodec/itut35.h    |  2 ++
>>>  3 files changed, 43 insertions(+)
>> I must be missing some patch as this doesnt build
> 
> No, just a rebase mistake. Will resend the set later.
> 
>> libavcodec/h2645_sei.c: In function ‘h2645_sei_to_side_data’:
>> libavcodec/h2645_sei.c:698:63: error: ‘frame’ undeclared (first use in this function)
>>   698 |         AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_LCEVC, lcevc->info);
>>       |                                                               ^~~~~
>> libavcodec/h2645_sei.c:698:63: note: each undeclared identifier is reported only once for each function it appears in
>> CC	libavcodec/x86/flacencdsp_init.o
>> make: *** [ffbuild/common.mak:81: libavcodec/h2645_sei.o] Error 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".
diff mbox series

Patch

diff --git a/libavcodec/h2645_sei.c b/libavcodec/h2645_sei.c
index 7c83747cd0..90e59df781 100644
--- a/libavcodec/h2645_sei.c
+++ b/libavcodec/h2645_sei.c
@@ -99,6 +99,20 @@  static int decode_registered_user_data_dynamic_hdr_vivid(HEVCSEIDynamicHDRVivid
 }
 #endif
 
+static int decode_registered_user_data_lcevc(HEVCSEILCEVC *s,
+                                             GetByteContext *gb)
+{
+    int size = bytestream2_get_bytes_left(gb);
+
+    av_buffer_unref(&s->info);
+    s->info = av_buffer_alloc(size);
+    if (!s->info)
+        return AVERROR(ENOMEM);
+
+    bytestream2_get_bufferu(gb, s->info->data, size);
+    return 0;
+}
+
 static int decode_registered_user_data_afd(H2645SEIAFD *h, GetByteContext *gb)
 {
     int flag;
@@ -142,6 +156,7 @@  static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
     }
 
     if (country_code != ITU_T_T35_COUNTRY_CODE_US &&
+        country_code != ITU_T_T35_COUNTRY_CODE_UK &&
         country_code != ITU_T_T35_COUNTRY_CODE_CN) {
         av_log(logctx, AV_LOG_VERBOSE,
                "Unsupported User Data Registered ITU-T T35 SEI message (country_code = %d)\n",
@@ -173,6 +188,13 @@  static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb,
         }
         break;
     }
+    case ITU_T_T35_PROVIDER_CODE_LCEVC: {
+        if (bytestream2_get_bytes_left(gb) < 2)
+            return AVERROR_INVALIDDATA;
+
+        bytestream2_skipu(gb, 1); // user_data_type_code
+        return decode_registered_user_data_lcevc(&h->lcevc, gb);
+    }
 #if CONFIG_HEVC_SEI
     case ITU_T_T35_PROVIDER_CODE_CUVA: {
         const uint16_t cuva_provider_oriented_code = 0x0005;
@@ -501,6 +523,11 @@  int ff_h2645_sei_ctx_replace(H2645SEI *dst, const H2645SEI *src)
         av_buffer_unref(&dst->unregistered.buf_ref[i]);
     dst->unregistered.nb_buf_ref = 0;
 
+    ret = av_buffer_replace(&dst->lcevc.info,
+                             src->lcevc.info);
+    if (ret < 0)
+        return ret;
+
     if (src->unregistered.nb_buf_ref) {
         ret = av_reallocp_array(&dst->unregistered.buf_ref,
                                 src->unregistered.nb_buf_ref,
@@ -666,6 +693,14 @@  static int h2645_sei_to_side_data(AVCodecContext *avctx, H2645SEI *sei,
         }
     }
 
+    if (sei->lcevc.info) {
+        HEVCSEILCEVC *lcevc = &sei->lcevc;
+        AVFrameSideData *sd = av_frame_new_side_data_from_buf(frame, AV_FRAME_DATA_LCEVC, lcevc->info);
+        if (!sd)
+            av_buffer_unref(&lcevc->info);
+        lcevc->info = NULL;
+    }
+
     return 0;
 }
 
@@ -875,6 +910,7 @@  void ff_h2645_sei_reset(H2645SEI *s)
     av_freep(&s->unregistered.buf_ref);
     av_buffer_unref(&s->dynamic_hdr_plus.info);
     av_buffer_unref(&s->dynamic_hdr_vivid.info);
+    av_buffer_unref(&s->lcevc.info);
 
     s->ambient_viewing_environment.present = 0;
     s->mastering_display.present = 0;
diff --git a/libavcodec/h2645_sei.h b/libavcodec/h2645_sei.h
index 488dbcad7e..598f78b585 100644
--- a/libavcodec/h2645_sei.h
+++ b/libavcodec/h2645_sei.h
@@ -50,6 +50,10 @@  typedef struct HEVCSEIDynamicHDRVivid {
     AVBufferRef *info;
 } HEVCSEIDynamicHDRVivid;
 
+typedef struct HEVCSEILCEVC {
+    AVBufferRef *info;
+} HEVCSEILCEVC;
+
 typedef struct H2645SEIUnregistered {
     AVBufferRef **buf_ref;
     unsigned nb_buf_ref;
@@ -126,6 +130,7 @@  typedef struct H2645SEI {
     H2645SEIAFD afd;
     HEVCSEIDynamicHDRPlus  dynamic_hdr_plus;     //< HEVC only
     HEVCSEIDynamicHDRVivid dynamic_hdr_vivid;    //< HEVC only
+    HEVCSEILCEVC lcevc;
     H2645SEIUnregistered unregistered;
     H2645SEIFramePacking frame_packing;
     H2645SEIDisplayOrientation display_orientation;
diff --git a/libavcodec/itut35.h b/libavcodec/itut35.h
index ffa7024981..a75ef37929 100644
--- a/libavcodec/itut35.h
+++ b/libavcodec/itut35.h
@@ -20,11 +20,13 @@ 
 #define AVCODEC_ITUT35_H
 
 #define ITU_T_T35_COUNTRY_CODE_CN 0x26
+#define ITU_T_T35_COUNTRY_CODE_UK 0xB4
 #define ITU_T_T35_COUNTRY_CODE_US 0xB5
 
 #define ITU_T_T35_PROVIDER_CODE_ATSC  0x31
 #define ITU_T_T35_PROVIDER_CODE_CUVA  0x04
 #define ITU_T_T35_PROVIDER_CODE_DOLBY 0x3B
+#define ITU_T_T35_PROVIDER_CODE_LCEVC 0x50
 #define ITU_T_T35_PROVIDER_CODE_SMTPE 0x3C
 
 #endif /* AVCODEC_ITUT35_H */