aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManojGuptaBonda <mbonda@nvidia.com>2019-04-26 09:43:37 +0530
committerPhilip Langdale <philipl@overt.org>2019-05-05 11:35:35 -0700
commitfc8fb88f10efe7e15c08c12c8895d36cfc92316d (patch)
treea87be24ccf2c95baf942b64ee6e426f924673ed8
parentd617d54efa146ddd81309c6236ca561ae1914698 (diff)
downloadffmpeg-fc8fb88f10efe7e15c08c12c8895d36cfc92316d.tar.gz
avcodec/vdpau_hevc: Pass sps and pps range extension flags to VDPAU
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.
-rw-r--r--libavcodec/vdpau_hevc.c41
-rw-r--r--libavcodec/vdpau_internal.h3
2 files changed, 44 insertions, 0 deletions
diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c
index 421135bce2..024ac6e2f2 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_YCBCR_FORMAT_Y_U_V_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_YCBCR_FORMAT_Y_U_V_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..1ee38dbc55 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_YCBCR_FORMAT_Y_U_V_444
+ VdpPictureInfoHEVC444 hevc_444;
+#endif
};
typedef struct VDPAUHWContext {