网站建设各模块功能简述,制作免费企业宣传视频,泉州一个网站多少钱,目前推广软件DVPP#xff08;Digital Vision Pre-Processing#xff09;是昇腾AI处理器内置的图像处理单元#xff0c;通过AscendCL媒体数据处理接口提供强大的媒体处理硬加速能力#xff0c;主要功能包括图像编解码、视频编解码、图像抠图缩放等。
往期分享过几个DVPP视频解码问题的典…DVPPDigital Vision Pre-Processing是昇腾AI处理器内置的图像处理单元通过AscendCL媒体数据处理接口提供强大的媒体处理硬加速能力主要功能包括图像编解码、视频编解码、图像抠图缩放等。
往期分享过几个DVPP视频解码问题的典型案例单击Link查看看的人多说明在这一块大家还是有些疑问的所以本期继续分享其它DVPP视频解码问题的典型案例并给出原因分析及解决方法
视频解码丢帧/丢包导致出现重影或不连续现象视频解码不触发回调函数导致获取不到解码结果复用输出图片描述类型VDEC视频解码报错提示有不支持的图片格式
01 视频解码丢帧/丢包导致出现重影或不连续现象
问题现象可能原因
视频解码丢帧出现重影或不连续现象。查看Device侧日志发现日志中存在以下几个报错中的一个或多个不同版本日志信息可能有所不同。
H264码流缺少IDR帧日志报错示例1
[HiDvpp][A618] [Vfmw]:ppssps_check [Line]:6803 pps with this pic_parameter_set_id %d havent decode
[HiDvpp][A618] [Vfmw]:process_slice_header_first_part [Line]:7401 PPS or SPS of this slice not valid
[HiDvpp][A618] [Vfmw]:h264_dec_slice [Line]:7915 sliceheader dec err
或
[ERROR] DVPP:2020-12-31-23:51:51.339.518 [VDEC][PPSSPSCheckTmpId:7065][T3] PPSSPSCheckTmpId: pps with this pic_parameter_set_id 0 havent decode
[ERROR] DVPP:2020-12-31-23:51:51.339.616 [VDEC][ProcessSliceHeaderFirstPart:7627][T3] PPS or SPS of this slice not valid
[ERROR] DVPP:2020-12-31-23:51:51.339.678 [VDEC][InquiresSlceProperty:10582][T3] sliceheader dec err
H264码流缺少I帧日志报错示例2
[HiDvpp][A618] [Vfmw]:h264_dec_slice [Line]:7983 init pic err, find next recover point or next valid sps, pps, or exit
[HiDvpp][A618] [Vfmw]:h264_dec_slice [Line]:3716 dec list error, ret-1
[HiDvpp][A618] [Vfmw]:receive_packet [Line]:10676 nal_release_err
或
[ERROR] DVPP:2020-12-31-20:51:51.318.218 [VDEC][InitPic:6039][T3] line 6039: frame gap(48) dpb size(2)
[ERROR] DVPP:2020-12-31-20:51:51.318.266 [VDEC][H264_DecSlice:8238][T3] init pic err, find next recover point or next valid sps, pps, or exit
[ERROR] DVPP:2020-12-31-20:51:51.318.336 [VDEC][H264_DecOneNal:10077][T3] DecList error, ret-1
[ERROR] DVPP:2020-12-31-20:51:51.318.392 [VDEC][ReceivePacket:10400][T3] nal_release-err
H264码流缺少P帧日志报错示例3
[HiDvpp][A618] [Vfmw]:init_list_x [Line]:4829 for P slice size of list equal 0.ctx-dpb.ref_frames_in_buffer:0.
[HiDvpp][A618] [Vfmw]:dec_list [Line]:5068 init list error.
[HiDvpp][A618] [Vfmw]:h264_dec_list [Line]:4829 dec_list error, ret-1
[HiDvpp][A618] [Vfmw]:h264_dec_one_nal [Line]:10298 slice_check failed, clear current slice.
或
[ERROR] DVPP:2020-12-31-20:30:22.188.008 [VDEC][InitListX:4513][T3] for P slice size of list equal 0.
[ERROR] DVPP:2020-12-31-20:30:22.188.056 [VDEC][DecList:4832][T3] line: 4832 InitListX failed
[ERROR] DVPP:2020-12-31-20:30:22.188.128 [VDEC][H264_DecSlice:8260][T3] DecList error, ret-1
[ERROR] DVPP:2020-12-31-20:30:22.188.199 [VDEC][H264_DecOneNal:10077][T3] Decoder Slice failed
H264码流缺少B帧日志报错示例4
[HiDvpp][A618] [Vfmw]:init_list_x [Line]:4865 for B slice size of two list all equal 0.
[HiDvpp][A618] [Vfmw]:dec_list [Line]:5068 init list error.
[HiDvpp][A618] [Vfmw]:h264_dec_list [Line]:4829 dec_list error, ret-1
或
[ERROR] DVPP:2020-12-31-10:20:28.528.090 [VDEC][InitListX:4653][T3] for B slice size of two list all equal 0.
[ERROR] DVPP:2020-12-31-10:20:28.528.168 [VDEC][DecList:4830][T3] line: 4832 InitListX failed
[ERROR] DVPP:2020-12-31-10:20:28.528.266 [VDEC][H264_DecSlice:8257][T3] DecList error, ret-1
H265码流缺少IDR帧日志报错示例5
[HiDvpp][A618] [Vfmw]:hevc_vps_sps_pps_check [Line]:7300 pps with this pic_parameter_set_id 0 havent be decoded
[HiDvpp][A618] [Vfmw]:hevc_dec_slice_segment_header [Line]:3857 hevc_vps_sps_pps_check ! HEVC_DEC_NORMAL
[HiDvpp][A618] [Vfmw]:hevc_inquire_slice_property [Line]:9004 hevc_dec_slice_segment_header dec err
[HiDvpp][A618] [Vfmw]:hevc_dec_decode_packet[Line]:9004 hevc_inquire_slice_property error.
或
[ERROR] DVPP:2020-12-31-10:30:22.130.500 [VDEC][HEVC_VpsSpsPpsCheck:8084][T10] pps with this pic_parameter_set_id 0 havent be decoded
[ERROR] DVPP:2020-12-31-10:30:22.130.598 [VDEC][HEVC_DecSliceSegmentHeader:2793][T10] HEVC_VpsSpsPpsCheck ! HEVC_DEC_NORMAL
[ERROR] DVPP:2020-12-31-10:30:22.130.686 [VDEC][HEVC_InquireSliceProperty:10169][T10] HEVC_DecSliceSegmentHeader dec err
[ERROR] DVPP:2020-12-31-10:30:22.130.789 [VDEC][HEVCDEC_DecodePacket:753][T10] HEVC_InquireSliceProperty error.
H265码流缺少I帧或者P帧日志报错示例6
[HiDvpp][A618] [Vfmw]:hevc_ref_pic_process [Line]:3474 ref frame(poc 15) lost.
[HiDvpp][A618] [Vfmw]:hevc_create_lost_picture [Line]:5839 DPB no suited fs for lost pic.
[HiDvpp][A618] [Vfmw]:hevc_create_lost_picture [Line]:5847 take poc(17) to create lost poc(15).
或
[ERROR] DVPP:2020-12-31-11:22:28.800.158 [VDEC][HEVC_RefPicProcess:2480][T10] Ref frame(poc 15) lost.
[ERROR] DVPP:2020-12-31-11:22:28.800.236 [VDEC][HEVC_CreateLostPicture:6392][T10] DPB no suited fs for lost pic.
[ERROR] DVPP:2020-12-31-11:22:28.800.352 [VDEC][HEVC_RefPicProcess:2480][T10] Ref frame(poc 18) lost.
[ERROR] DVPP:2020-12-31-11:22:28.800.426 [VDEC][HEVC_CreateLostPicture:6392] [T10] DPB no suited fs for lost pic.
[ERROR] DVPP:2020-12-31-11:22:28.800.522 [VDEC][HEVC_RefPicProcess:2480] [T10] Ref frame(poc 18) lost.
H265码流缺少I帧或者B帧日志报错示例7
[ERROR] DVPP:2020-12-31-11:56:35.038.109 [VDEC][HEVC_RefPicProcess:2480] [T56] Ref frame(poc 15) lost.
[ERROR] DVPP:2020-12-31-11:56:35.038.283 [VDEC][HEVC_CreateLostPicture:6392] [T56] Take poc(17) to create lost poc(15).
[ERROR] DVPP:2020-12-31-11:56:35.038.502 [VDEC][FSP_SetRef:934] [T56] check condition: pstLogicFs-IsDummyFs 0 fail
[ERROR] DVPP:2020-12-31-11:56:35.038.801 [VDEC][FSP_SetRef:934] [T56] check condition: pstLogicFs-IsDummyFs 0 fail
[ERROR] DVPP:2020-12-31-11:56:35.039.128 [VDEC][FSP_SetRef:934] [T56] check condition: pstLogicFs-IsDummyFs 0 fail
处理步骤
检查输入的源码流是否有问题。
使用第三方工具如eseye u对输入码流进行检查查看码流是否异常。
若查看的源码流结果为正常则可能码流在传输给设备侧VDEC视频解码的过程中遭到破坏需要在调用发送码流接口之前通过fwrite函数将输送给VDEC的码流保存下来。 使用第三方工具对保存的码流进行检查如果码流异常用户需自行排查将码流送进去之前是否有送流问题。通过对应版本的sample解码这段保留下来的码流验证码流是否正常或VDEC是否支持该格式。
如果sample 解码正常那就是开发代码有问题可以参考VDEC示例代码找到对应的视频解码的代码参考优化。
02 视频解码不触发回调函数导致获取不到解码结果
现象描述
用户输入码流给VDEC解码某些帧或所有帧都没有触发回调函数用户收不到解码结果。
可能原因
码流中某些帧是坏帧导致语法解析不出这些帧的含义或者解码这些帧失败从而不调用回调函数。
处理步骤
针对分析的可能原因请参考以下步骤进行处理
查看日志中是否有视频解码丢帧/丢包中的日志报错信息若有则是因为异常帧解码失败导致没有回调。若没有视频解码丢帧/丢包中的日志报错信息则设置环境变量export ASCEND_MODULE_LOG_LEVELDVPP1将DVPP模块的日志级别设置为info或设置环境变量export ASCEND_GLOBAL_LOG_LEVEL1将全局日志级别设置为info查看下述三条日志打印的总次数是否和输入的帧数相等。 1The queue is empty, so call the non-intelligent pointer callback interface.2The queue is not empty, so call the smart pointer callback interface.3The queue is not empty, but hiai_data_sp is nullptr.
生成上述3种日志信息的场景如下 未使用hiai_data_sp成功解码返回打印1日志然后调用用户注册的回调函数。每一帧对应设置一个hiai_data_sp成功解码返回打印2日志然后调用用户注册的回调函数。N帧对应设置一个hiai_data_sp第1帧成功解码返回打印2日志然后调用用户注册的回调函数其他N-1帧成功解码后打印3日志信息并调用用户注册的回调函数。
不论上述场景中哪一种均会调用用户注册的回调函数即只要调用一次用户回调函数就说明解码返回一帧。所以上述三条日志出现的次数总和与用户输入总帧数相等则说明无解码丢帧用户需排查自身接收解码结果的统计是否有误。
03 复用输出图片描述类型VDEC视频解码报错提示有不支持的图片格式
现象描述
循环调用aclvdecSendFrame接口解码视频中的每一帧码流时在遇到异常帧之后解码下一帧就会报错退出应用进程。
分别查看Host侧日志、Device侧日志发现Device日志中提示the out format 0 is not supported日志片段如下
Device侧日志 [ERROR] KERNEL(2234,sklogd):2023-06-13-19:21:22.987.969 [klogd.c:246][652145.056916] [HiDvpp][A618] [Vdec]:vdec_check_resize_param [Line]:6768 pid 23973 usr chn 0 device 0 chn 0 the out format 0 is not supported. Host侧日志 [ERROR] RUNTIME(17174,AIMCDemo):2023-06-13-19:21:23.664.211 [api_c.cc:721]17184 rtStreamSynchronize:[DVPP][DEFAULT]ErrCode507018, desc[aicpu exception], InnerCode0x715002a
[ERROR] RUNTIME(17174,AIMCDemo):2023-06-13-19:21:23.664.215 [error_message_manage.cc:49]17184 FuncErrorReason:[DVPP][DEFAULT]report error module_type3, module_nameEE8888
[ERROR] RUNTIME(17174,AIMCDemo):2023-06-13-19:21:23.664.221 [error_message_manage.cc:49]17184 FuncErrorReason:[DVPP][DEFAULT]rtStreamSynchronize execute failed, reason[aicpu exception]
[INFO] GE(17174,AIMCDemo):2023-06-13-19:21:23.664.227 [error_manager.cc:252]17184 ReportInterErrMessage:report error_message, error_code:EE8888, work_stream_id:1717417184
[ERROR] ASCENDCL(17174,AIMCDemo):2023-06-13-19:21:23.664.234 [video_processor_v200.cpp:1089]17184 aclvdecSendFrame: [DVPP][DEFAULT][Sync][Stream]vdec fail to synchronize sendFrameStream, runtime errorCode 507018, channelId 0.
可能原因
检查应用代码发现循环解码视频中的每一帧码流时复用aclvdecSendFrame接口的输出图片描述类型acldvppPicDesc但在下一次解码前没有重新设置输出图片format、width、height、widthStride、heightStride这时如果前一帧解码失败acldvppPicDesc的参数format、width、height、widthStride、heightStride变成默认值0width、height、widthStride、heightStride为0时vdec会以实际图片宽高解码输出但format为0表示YUV400格式vdec不支持解码输出该格式会导致下一帧参数不合法解失败。
处理步骤
优化应用代码逻辑复用输出图片描述类型acldvppPicDesc时在下一次解码前需重新设置输出图片format、width、height、widthStride、heightStride。
正例代码片段
aclError ret;
int restLen 10;
uint32_t inBufferSize 0;
void *g_picOutBufferDev;
void *inBufferDev nullptr;
acldvppPicDesc *picOutputDesc;
size_t dataSize (INPUT_WIDTH * INPUT_HEIGHT * 3) / 2;
// 申请一个picOutputDesc,每帧复用
picOutputDesc acldvppCreatePicDesc();
// read file to device memoryReadFileToDeviceMem(filePath.c_str(), inBufferDev, inBufferSize);while (restLen 0) {// 等待前一个使用picOutputDesc解码帧结束重新复用picOutputDesc,并针对这一帧重新设置Format、width、height、widthStride、heightStride参数值ret acldvppSetPicDescFormat(picOutputDesc, static_castacldvppPixelFormat(1)); // 1YUV420 semi-plannernv12ret acldvppSetPicDescWidth(picOutputDesc, 1920);ret acldvppSetPicDescHeight(picOutputDesc, 1080);ret acldvppSetPicDescWidthStride(picOutputDesc, 1920);ret acldvppSetPicDescHeightStride(picOutputDesc, 1080);ret acldvppMalloc(g_picOutBufferDev, dataSize);ret acldvppSetPicDescData(picOutputDesc, g_picOutBufferDev);ret acldvppSetPicDescSize(picOutputDesc, dataSize);ret aclvdecSendFrame(vdecChannelDesc, streamInputDesc, picOutputDesc, nullptr, nullptr);restLen restLen - 1;
}
反例代码片段
aclError ret;
int restLen 10;
uint32_t inBufferSize 0;
void *g_picOutBufferDev;
void *inBufferDev nullptr;
acldvppPicDesc *picOutputDesc;
size_t dataSize (INPUT_WIDTH * INPUT_HEIGHT * 3) / 2;
// 申请一个picOutputDesc每帧复用且对Format、width、height、widthStride、heightStride参数值只设置了一次
picOutputDesc acldvppCreatePicDesc();
ret acldvppSetPicDescFormat(picOutputDesc, static_castacldvppPixelFormat(1)); // 1YUV420 semi-plannernv12
ret acldvppSetPicDescWidth(picOutputDesc, 1920);
ret acldvppSetPicDescHeight(picOutputDesc, 1080);
ret acldvppSetPicDescWidthStride(picOutputDesc, 1920);
ret acldvppSetPicDescHeightStride(picOutputDesc, 1080);
// read file to device memory
ReadFileToDeviceMem(filePath.c_str(), inBufferDev, inBufferSize);
while (restLen 0) {// 等待前一个使用picOutputDesc解码帧结束重新复用picOutputDesc,但没有重新设置Format、width、height、widthStride、heightStride参数值// 如果前一帧解码失败picOutputDesc_的参数Format、width、height、widthStride、heightStride变成默认值0// width、height、widthStride、heightStride为0时vdec会以实际图片宽高解码输出但Format为0表示YUV400格式vdec不支持解码输出该格式会导致本帧参数不合法解码失败ret acldvppMalloc(g_picOutBufferDev, dataSize);ret acldvppSetPicDescData(picOutputDesc, g_picOutBufferDev);ret acldvppSetPicDescSize(picOutputDesc, dataSize);ret aclvdecSendFrame(vdecChannelDesc, streamInputDesc, picOutputDesc, nullptr, nullptr);restLen restLen - 1;}
04 更多介绍
[1]昇腾文档中心昇腾社区-官网丨昇腾万里 让智能无所不及
[2]昇腾社区在线课程开发者主页-昇腾社区
[3]昇腾论坛https://www.hiascend.com/forum