diff mbox series

[FFmpeg-devel,06/42] lavc: add HEVC Multiview Main profile

Message ID 20240827154041.13846-8-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/42] lavu/opt: add API for setting array-type option values | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov Aug. 27, 2024, 3:04 p.m. UTC
---
 doc/APIchanges        |  3 +++
 libavcodec/defs.h     |  1 +
 libavcodec/hevc/ps.c  | 21 +++++++++------------
 libavcodec/profiles.c |  1 +
 libavcodec/version.h  |  2 +-
 5 files changed, 15 insertions(+), 13 deletions(-)

Comments

Michael Niedermayer Sept. 4, 2024, 9:05 p.m. UTC | #1
On Tue, Aug 27, 2024 at 05:04:46PM +0200, Anton Khirnov wrote:
> ---
>  doc/APIchanges        |  3 +++
>  libavcodec/defs.h     |  1 +
>  libavcodec/hevc/ps.c  | 21 +++++++++------------
>  libavcodec/profiles.c |  1 +
>  libavcodec/version.h  |  2 +-
>  5 files changed, 15 insertions(+), 13 deletions(-)

assuming this matches your mv-hevc branch then it fails to build

/usr/bin/x86_64-w64-mingw32-ld: libavcodec/libavcodec.a(ps.o):ps.c:(.rdata$.refptr.ff_hevc_profiles[.refptr.ff_hevc_profiles]+0x0): undefined reference to `ff_hevc_profiles'
collect2: error: ld returned 1 exit status
make: *** [Makefile:141: ffprobe_g.exe] Error 1

probably related to --enable-small

thx

[...]
Anton Khirnov Sept. 5, 2024, 11:35 a.m. UTC | #2
Quoting Michael Niedermayer (2024-09-04 23:05:28)
> On Tue, Aug 27, 2024 at 05:04:46PM +0200, Anton Khirnov wrote:
> > ---
> >  doc/APIchanges        |  3 +++
> >  libavcodec/defs.h     |  1 +
> >  libavcodec/hevc/ps.c  | 21 +++++++++------------
> >  libavcodec/profiles.c |  1 +
> >  libavcodec/version.h  |  2 +-
> >  5 files changed, 15 insertions(+), 13 deletions(-)
> 
> assuming this matches your mv-hevc branch then it fails to build
> 
> /usr/bin/x86_64-w64-mingw32-ld: libavcodec/libavcodec.a(ps.o):ps.c:(.rdata$.refptr.ff_hevc_profiles[.refptr.ff_hevc_profiles]+0x0): undefined reference to `ff_hevc_profiles'
> collect2: error: ld returned 1 exit status
> make: *** [Makefile:141: ffprobe_g.exe] Error 1
> 
> probably related to --enable-small

Fixed locally by wrapping the profile mapping code under
#if !CONFIG_SMALL
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index a8f84ca45f..a4cf1bf69f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -2,6 +2,9 @@  The last version increases of all libraries were on 2024-03-07
 
 API changes, most recent first:
 
+2024-xx-xx - xxxxxxx - lavc 61.12.100 - defs.h
+  Add AV_PROFILE_HEVC_MULTIVIEW_MAIN
+
 2024-xx-xx - xxxxxxx - lavu 59.37.100 - frame.h
   Add AV_FRAME_DATA_VIEW_ID.
 
diff --git a/libavcodec/defs.h b/libavcodec/defs.h
index 7ddfdcad0b..24250f8af5 100644
--- a/libavcodec/defs.h
+++ b/libavcodec/defs.h
@@ -160,6 +160,7 @@ 
 #define AV_PROFILE_HEVC_MAIN_10                     2
 #define AV_PROFILE_HEVC_MAIN_STILL_PICTURE          3
 #define AV_PROFILE_HEVC_REXT                        4
+#define AV_PROFILE_HEVC_MULTIVIEW_MAIN              6
 #define AV_PROFILE_HEVC_SCC                         9
 
 #define AV_PROFILE_VVC_MAIN_10                      1
diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index 22042d3e62..dbdfc16cfa 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -29,6 +29,7 @@ 
 #include "h2645_vui.h"
 #include "data.h"
 #include "ps.h"
+#include "profiles.h"
 #include "refstruct.h"
 
 static const uint8_t default_scaling_list_intra[] = {
@@ -244,6 +245,7 @@  int ff_hevc_decode_short_term_rps(GetBitContext *gb, AVCodecContext *avctx,
 static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx,
                                       PTLCommon *ptl)
 {
+    const char *profile_name = NULL;
     int i;
 
     if (get_bits_left(gb) < 2+1+5 + 32 + 4 + 43 + 1)
@@ -252,18 +254,13 @@  static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx,
     ptl->profile_space = get_bits(gb, 2);
     ptl->tier_flag     = get_bits1(gb);
     ptl->profile_idc   = get_bits(gb, 5);
-    if (ptl->profile_idc == AV_PROFILE_HEVC_MAIN)
-        av_log(avctx, AV_LOG_DEBUG, "Main profile bitstream\n");
-    else if (ptl->profile_idc == AV_PROFILE_HEVC_MAIN_10)
-        av_log(avctx, AV_LOG_DEBUG, "Main 10 profile bitstream\n");
-    else if (ptl->profile_idc == AV_PROFILE_HEVC_MAIN_STILL_PICTURE)
-        av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n");
-    else if (ptl->profile_idc == AV_PROFILE_HEVC_REXT)
-        av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n");
-    else if (ptl->profile_idc == AV_PROFILE_HEVC_SCC)
-        av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n");
-    else
-        av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc);
+    for (int i = 0; ff_hevc_profiles[i].profile != AV_PROFILE_UNKNOWN; i++)
+        if (ff_hevc_profiles[i].profile == ptl->profile_idc) {
+            profile_name = ff_hevc_profiles[i].name;
+            break;
+        }
+    av_log(avctx, profile_name ? AV_LOG_DEBUG : AV_LOG_WARNING,
+           "%s profile bitstream\n", profile_name ? profile_name : "Unknown");
 
     for (i = 0; i < 32; i++) {
         ptl->profile_compatibility_flag[i] = get_bits1(gb);
diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c
index 44bdf6f85b..3cef82be3b 100644
--- a/libavcodec/profiles.c
+++ b/libavcodec/profiles.c
@@ -99,6 +99,7 @@  const AVProfile ff_hevc_profiles[] = {
     { AV_PROFILE_HEVC_MAIN_10,              "Main 10"             },
     { AV_PROFILE_HEVC_MAIN_STILL_PICTURE,   "Main Still Picture"  },
     { AV_PROFILE_HEVC_REXT,                 "Rext"                },
+    { AV_PROFILE_HEVC_MULTIVIEW_MAIN,       "Multiview Main"      },
     { AV_PROFILE_HEVC_SCC,                  "Scc"                 },
     { AV_PROFILE_UNKNOWN },
 };
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8b53586be1..da2264a097 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR  11
+#define LIBAVCODEC_VERSION_MINOR  12
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \