[FFmpeg-cvslog] avcodec/vvcdec: derive subpic position for PPS

Nuo Mi git at videolan.org
Tue Apr 2 15:59:28 EEST 2024


ffmpeg | branch: master | Nuo Mi <nuomi2021 at gmail.com> | Wed Mar 27 21:01:02 2024 +0800| [4e47847119cee3ebdd3e13890a3da8e0552f00f9] | committer: Nuo Mi

avcodec/vvcdec: derive subpic position for PPS

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e47847119cee3ebdd3e13890a3da8e0552f00f9
---

 libavcodec/vvc/vvc_ps.c | 19 +++++++++++++++++++
 libavcodec/vvc/vvc_ps.h |  4 ++++
 2 files changed, 23 insertions(+)

diff --git a/libavcodec/vvc/vvc_ps.c b/libavcodec/vvc/vvc_ps.c
index 634c2b05a7..04bd6e758a 100644
--- a/libavcodec/vvc/vvc_ps.c
+++ b/libavcodec/vvc/vvc_ps.c
@@ -516,6 +516,24 @@ static void pps_ref_wraparound_offset(VVCPPS *pps, const VVCSPS *sps)
         pps->ref_wraparound_offset = (pps->width / sps->min_cb_size_y) - r->pps_pic_width_minus_wraparound_offset;
 }
 
+static void pps_subpic(VVCPPS *pps, const VVCSPS *sps)
+{
+    const H266RawSPS *rsps = sps->r;
+    for (int i = 0; i < rsps->sps_num_subpics_minus1 + 1; i++) {
+        if (rsps->sps_subpic_treated_as_pic_flag[i]) {
+            pps->subpic_x[i]      = rsps->sps_subpic_ctu_top_left_x[i] << sps->ctb_log2_size_y;
+            pps->subpic_y[i]      = rsps->sps_subpic_ctu_top_left_y[i] << sps->ctb_log2_size_y;
+            pps->subpic_width[i]  = FFMIN(pps->width  - pps->subpic_x[i], (rsps->sps_subpic_width_minus1[i]  + 1) << sps->ctb_log2_size_y);
+            pps->subpic_height[i] = FFMIN(pps->height - pps->subpic_y[i], (rsps->sps_subpic_height_minus1[i] + 1) << sps->ctb_log2_size_y);
+        } else {
+            pps->subpic_x[i]      = 0;
+            pps->subpic_y[i]      = 0;
+            pps->subpic_width[i]  = pps->width;
+            pps->subpic_height[i] = pps->height;
+        }
+    }
+}
+
 static int pps_derive(VVCPPS *pps, const VVCSPS *sps)
 {
     int ret;
@@ -532,6 +550,7 @@ static int pps_derive(VVCPPS *pps, const VVCSPS *sps)
         return ret;
 
     pps_ref_wraparound_offset(pps, sps);
+    pps_subpic(pps, sps);
 
     return 0;
 }
diff --git a/libavcodec/vvc/vvc_ps.h b/libavcodec/vvc/vvc_ps.h
index d962cdf524..f60d8b81c6 100644
--- a/libavcodec/vvc/vvc_ps.h
+++ b/libavcodec/vvc/vvc_ps.h
@@ -127,6 +127,10 @@ typedef struct VVCPPS {
 
     uint16_t ref_wraparound_offset;         ///< PpsRefWraparoundOffset
 
+    uint16_t subpic_x[VVC_MAX_SLICES];      ///< SubpicLeftBoundaryPos
+    uint16_t subpic_y[VVC_MAX_SLICES];      ///< SubpicTopBoundaryPos
+    uint16_t subpic_width[VVC_MAX_SLICES];
+    uint16_t subpic_height[VVC_MAX_SLICES];
 } VVCPPS;
 
 #define MAX_WEIGHTS 15



More information about the ffmpeg-cvslog mailing list