Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
align DRM frames strides to 64
Browse files Browse the repository at this point in the history
  • Loading branch information
boogieeeee committed Nov 14, 2023
1 parent 2bcff74 commit b025677
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions libavcodec/rkmpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#endif

#define RKMPP_STRIDE_ALIGN 16
#define RKMPP_DRM_STRIDE_ALIGN 64
#define RKMPP_RGA_MIN_SIZE 128
#define RKMPP_RGA_MAX_SIZE 4096
#define HDR_SIZE 1024
Expand Down
14 changes: 10 additions & 4 deletions libavcodec/rkmppdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,22 @@ static int rkmpp_config_decoder(AVCodecContext *avctx, MppFrame mppframe){
if(rk_context->informat.av == AV_PIX_FMT_NV15){ // convert to requested format
if(rk_context->drm_hdrbits == 16) // P010
rkmpp_get_av_format(&rk_context->outformat, AV_PIX_FMT_P010LE,
avctx->width, avctx->height, RKMPP_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
avctx->width, avctx->height, RKMPP_DRM_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
else if (rk_context->drm_hdrbits == 8) // NV12
rkmpp_get_av_format(&rk_context->outformat, AV_PIX_FMT_NV12,
avctx->width, avctx->height, RKMPP_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
avctx->width, avctx->height, RKMPP_DRM_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
rk_context->codec_flow = CONVERT;
} else if (rk_context->fbc == RKMPP_FBC_DECODER){
rkmpp_get_av_format(&rk_context->outformat, rk_context->informat.av,
avctx->width, avctx->height, RKMPP_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
avctx->width, avctx->height, RKMPP_DRM_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
rk_context->codec_flow = CONVERT;
} else if (mpp_frame_get_hor_stride(mppframe) != FFALIGN(avctx->width, RKMPP_DRM_STRIDE_ALIGN)){
// drm prime frame strides must be 64 aligned when imported thorugh EGL,
// in this case we must realign
rkmpp_get_av_format(&rk_context->outformat, rk_context->informat.av,
avctx->width, avctx->height, RKMPP_DRM_STRIDE_ALIGN, 0, 0, 0, 0, 0, 0);
rk_context->codec_flow = CONVERT;
}else {
} else {
rkmpp_get_av_format(&rk_context->outformat, rk_context->informat.av,
avctx->width, avctx->height, 0,
mpp_frame_get_hor_stride(mppframe), mpp_frame_get_ver_stride(mppframe), 0,
Expand Down

0 comments on commit b025677

Please sign in to comment.