Skip to content

Commit

Permalink
avcodec/rkmppdec: Add AV1
Browse files Browse the repository at this point in the history
Note: For new chips like rk3588.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
  • Loading branch information
JeffyCN authored and jjm2473 committed Jun 14, 2023
1 parent 4dbf181 commit 2fea5c6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -3109,6 +3109,7 @@ nvenc_deps_any="libdl LoadLibrary"
aac_mf_encoder_deps="mediafoundation"
ac3_mf_encoder_deps="mediafoundation"
av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS"
av1_rkmpp_decoder_deps="rkmpp"
h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m"
h263_v4l2m2m_encoder_deps="v4l2_m2m h263_v4l2_m2m"
h263_rkmpp_decoder_deps="rkmpp"
Expand Down
1 change: 1 addition & 0 deletions libavcodec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
OBJS-$(CONFIG_AURA2_DECODER) += aura.o
OBJS-$(CONFIG_AV1_DECODER) += av1dec.o
OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o
OBJS-$(CONFIG_AV1_RKMPP_DECODER) += rkmppdec.o
OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o
OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o
OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o
Expand Down
1 change: 1 addition & 0 deletions libavcodec/allcodecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extern const AVCodec ff_vp9_rkmpp_decoder;
extern const AVCodec ff_h263_rkmpp_decoder;
extern const AVCodec ff_h264_rkmpp_decoder;
extern const AVCodec ff_hevc_rkmpp_decoder;
extern const AVCodec ff_av1_rkmpp_decoder;

extern const AVCodec ff_a64multi_encoder;
extern const AVCodec ff_a64multi5_encoder;
Expand Down
6 changes: 4 additions & 2 deletions libavcodec/rkmppdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ static MppCodingType rkmpp_get_codingtype(AVCodecContext *avctx)
case AV_CODEC_ID_H263: return MPP_VIDEO_CodingH263;
case AV_CODEC_ID_H264: return MPP_VIDEO_CodingAVC;
case AV_CODEC_ID_HEVC: return MPP_VIDEO_CodingHEVC;
case AV_CODEC_ID_AV1: return MPP_VIDEO_CodingAV1;
case AV_CODEC_ID_VP8: return MPP_VIDEO_CodingVP8;
case AV_CODEC_ID_VP9: return MPP_VIDEO_CodingVP9;
case AV_CODEC_ID_MPEG1VIDEO: /* fallthrough */
Expand Down Expand Up @@ -164,8 +165,8 @@ static int rkmpp_prepare_decoder(AVCodecContext *avctx)
MppPacket packet;
int ret;

// send extra data
if (avctx->extradata_size) {
// HACK: somehow MPP cannot handle extra data for AV1
if (avctx->extradata_size && avctx->codec_id != AV_CODEC_ID_AV1) {
ret = mpp_packet_init(&packet, avctx->extradata, avctx->extradata_size);
if (ret < 0)
return AVERROR_UNKNOWN;
Expand Down Expand Up @@ -800,6 +801,7 @@ static const AVCodecHWConfigInternal *const rkmpp_hw_configs[] = {
RKMPP_DEC(h263, AV_CODEC_ID_H263, NULL)
RKMPP_DEC(h264, AV_CODEC_ID_H264, "h264_mp4toannexb")
RKMPP_DEC(hevc, AV_CODEC_ID_HEVC, "hevc_mp4toannexb")
RKMPP_DEC(av1, AV_CODEC_ID_AV1, NULL)
RKMPP_DEC(vp8, AV_CODEC_ID_VP8, NULL)
RKMPP_DEC(vp9, AV_CODEC_ID_VP9, NULL)
RKMPP_DEC(mpeg1, AV_CODEC_ID_MPEG1VIDEO, NULL)
Expand Down

0 comments on commit 2fea5c6

Please sign in to comment.