Hi Community
I am making a decoder app using VPU wrapper. (Input: H264, Output: YUV)
Input H264 data is updated real time.
If VPU_DecDecodeBuf() has been called once to decode the I-frame,
then P-frame is encoded and appended to the input H264 data,
which parameter should I change so that the next time VPU_DecDecodeBuf() is called
it will decode the P-frame?
解決済! 解決策の投稿を見る。
>what kind of streaming do you need to decode?
I said in my OP that my input is H264 data
>I don't think raw P frame append to the I frame is correct procedure, you also can refer to the nxp source code for reference
Input H264 data is set to VpuBufferNode then passed to VPU_DecDecodeBuf().
If originally the H264 data has both I and P Frames before setting to VpuBufferNode, decoding works.
(1st call of VPU_DecDecodeBuf() decodes I, then 2nd call decodes P)
However, if original input H264 data only has I frame, then P frame was created separately so it has to be reflected to VpuBufferNode, I wanted to know what to change before calling VPU_DecDecodeBuf() for the 2nd time.
After some trial and error, I found the following code to solve the above problem.
/** Change address of input set in VpuBufferNode to the address of P-Frame */
m_vpuBufferNode.pVirAddr = <P-Frame address>;
/** Change input data size */
m_vpuBufferNode.nSize = <P-Frame size>;
Please consider this sequence
1. VpuBufferNode only contains I-Frame
2. VPU_DecDecodeBuf() is called
Result: I-Frame is decoded properly
(Here comes my problem)
3. A P-Frame has been created separately, so I understand it has to be appended to VpuBufferNode, like this
/** Append P-Frame data at the end of I-Frame data in VpuBufferNode */
memcpy(m_vpuBufferNode.pVirAddr + <I-Frame size>, <P-Frame address>, <P-Frame size>);
/** Update input data size */
m_vpuBufferNode.nSize = <I-Frame size> + <P-Frame size>;
4. VPU_DecDecodeBuf() is called again and is expected to decode the P-frame added in #3
Result: No image is decoded (output decoded data from VPU_DecGetOutputFrame is all-zero)
My question is, is the implementation of #3 enough to update VpuBufferNode, before calling VPU_DecDecodeBuf() again?
what kind of streaming do you need to decode? I don't think raw P frame append to the I frame is correct procedure, you also can refer to the nxp source code for reference
>what kind of streaming do you need to decode?
I said in my OP that my input is H264 data
>I don't think raw P frame append to the I frame is correct procedure, you also can refer to the nxp source code for reference
Input H264 data is set to VpuBufferNode then passed to VPU_DecDecodeBuf().
If originally the H264 data has both I and P Frames before setting to VpuBufferNode, decoding works.
(1st call of VPU_DecDecodeBuf() decodes I, then 2nd call decodes P)
However, if original input H264 data only has I frame, then P frame was created separately so it has to be reflected to VpuBufferNode, I wanted to know what to change before calling VPU_DecDecodeBuf() for the 2nd time.
After some trial and error, I found the following code to solve the above problem.
/** Change address of input set in VpuBufferNode to the address of P-Frame */
m_vpuBufferNode.pVirAddr = <P-Frame address>;
/** Change input data size */
m_vpuBufferNode.nSize = <P-Frame size>;
this is part of decoding flow, after decoding one frame, if still have more frames, the VPU will decode next frame before close the VPU