diff options
author | Nuo Mi <nuomi2021@gmail.com> | 2024-03-27 21:01:02 +0800 |
---|---|---|
committer | Nuo Mi <nuomi2021@gmail.com> | 2024-04-02 20:56:03 +0800 |
commit | 4e47847119cee3ebdd3e13890a3da8e0552f00f9 (patch) | |
tree | eaea2c59ad8c0644172ddd777c8bb2c2e07a9739 | |
parent | 8078a0b0fa72b41c780953ed5fbbca132a2f9948 (diff) | |
download | ffmpeg-4e47847119cee3ebdd3e13890a3da8e0552f00f9.tar.gz |
avcodec/vvcdec: derive subpic position for PPS
-rw-r--r-- | libavcodec/vvc/vvc_ps.c | 19 | ||||
-rw-r--r-- | libavcodec/vvc/vvc_ps.h | 4 |
2 files changed, 23 insertions, 0 deletions
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 |