Pass SPS, PPS range extensions to VDPAU layer via VdpPictureInfoHEVC444.
Added VdpPictureInfoHEVC444 struct to VdpPictureInfo union to populate
the range extension params. Mapped FF_PROFILE_HEVC_REXT to
VDP_DECODER_PROFILE_HEVC_MAIN_444.
---
 libavcodec/vdpau_hevc.c     | 41 +++++++++++++++++++++++++++++++++++++
 libavcodec/vdpau_internal.h |  3 +++
 2 files changed, 44 insertions(+)

diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 421135bce2..a68e1361fb 100644
--- a/libavcodec/vdpau_hevc.c
+++ b/libavcodec/vdpau_hevc.c
@@ -38,6 +38,9 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
     struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private;
 
     VdpPictureInfoHEVC *info = &pic_ctx->info.hevc;
+#ifdef VDP_DECODER_PROFILE_HEVC_MAIN_444
+    VdpPictureInfoHEVC444 *info2 = &pic_ctx->info.hevc_444;
+#endif
 
     const HEVCSPS *sps = h->ps.sps;
     const HEVCPPS *pps = h->ps.pps;
@@ -355,6 +358,41 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx,
         }
     }
 
+#ifdef VDP_DECODER_PROFILE_HEVC_MAIN_444
+    if (sps->sps_range_extension_flag) {
+        info2->sps_range_extension_flag             = 1;
+        info2->transformSkipRotationEnableFlag      = 
sps->transform_skip_rotation_enabled_flag;
+        info2->transformSkipContextEnableFlag       = 
sps->transform_skip_context_enabled_flag;
+        info2->implicitRdpcmEnableFlag              = 
sps->implicit_rdpcm_enabled_flag;
+        info2->explicitRdpcmEnableFlag              = 
sps->explicit_rdpcm_enabled_flag;
+        info2->extendedPrecisionProcessingFlag      = 
sps->extended_precision_processing_flag;
+        info2->intraSmoothingDisabledFlag           = 
sps->intra_smoothing_disabled_flag;
+        info2->highPrecisionOffsetsEnableFlag       = 
sps->high_precision_offsets_enabled_flag;
+        info2->persistentRiceAdaptationEnableFlag   = 
sps->persistent_rice_adaptation_enabled_flag;
+        info2->cabacBypassAlignmentEnableFlag       = 
sps->cabac_bypass_alignment_enabled_flag;
+    } else {
+        info2->sps_range_extension_flag = 0;
+    }
+    if (pps->pps_range_extensions_flag) {
+        info2->pps_range_extension_flag             = 1;
+        info2->log2MaxTransformSkipSize             = 
pps->log2_max_transform_skip_block_size;
+        info2->crossComponentPredictionEnableFlag   = 
pps->cross_component_prediction_enabled_flag;
+        info2->chromaQpAdjustmentEnableFlag         = 
pps->chroma_qp_offset_list_enabled_flag;
+        info2->diffCuChromaQpAdjustmentDepth        = 
pps->diff_cu_chroma_qp_offset_depth;
+        info2->chromaQpAdjustmentTableSize          = 
pps->chroma_qp_offset_list_len_minus1 + 1;
+        info2->log2SaoOffsetScaleLuma               = 
pps->log2_sao_offset_scale_luma;
+        info2->log2SaoOffsetScaleChroma             = 
pps->log2_sao_offset_scale_chroma;
+        for (ssize_t i = 0; i < info2->chromaQpAdjustmentTableSize; i++)
+        {
+            info2->cb_qp_adjustment[i] = pps->cb_qp_offset_list[i];
+            info2->cr_qp_adjustment[i] = pps->cr_qp_offset_list[i];
+        }
+
+    } else {
+        info2->pps_range_extension_flag = 0;
+    }
+#endif
+
     return ff_vdpau_common_start_frame(pic_ctx, buffer, size);
 }
 
@@ -406,6 +444,9 @@ static int vdpau_hevc_init(AVCodecContext *avctx)
     case FF_PROFILE_HEVC_MAIN_STILL_PICTURE:
         profile = VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
         break;
+    case FF_PROFILE_HEVC_REXT:
+        profile = VDP_DECODER_PROFILE_HEVC_MAIN_444;
+        break;
     default:
         return AVERROR(ENOTSUP);
     }
diff --git a/libavcodec/vdpau_internal.h b/libavcodec/vdpau_internal.h
index 4d63e50b16..ebe4a8e9d5 100644
--- a/libavcodec/vdpau_internal.h
+++ b/libavcodec/vdpau_internal.h
@@ -51,6 +51,9 @@ union VDPAUPictureInfo {
 #ifdef VDP_DECODER_PROFILE_HEVC_MAIN
     VdpPictureInfoHEVC        hevc;
 #endif
+#ifdef VDP_DECODER_PROFILE_HEVC_MAIN
+    VdpPictureInfoHEVC444     hevc_444;
+#endif
 };
 
 typedef struct VDPAUHWContext {
-- 
2.17.1


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to