Skip to main content
Associate II
December 22, 2024
Solved

STM32N6 H264 encoder motion vectors

  • December 22, 2024
  • 1 reply
  • 1276 views

Hello,

I've been reading the reference manual for the STM32N6 and it's video encoder. There does not seem to be any registers that point to a region where the motion vectors are calculated, nor a memory map for the SRAM region mapped for the peripheral. Is there anyway to access the motion vectors calculated by the H264 peripheral directly instead of needing to decode the H264 stream? This would be incredibly useful in applications that require optical flow as part of their operation.

Thanks,

-Alex

Best answer by Ethan HUANG

Hi Alex,

I'm not a VENC expert. According to the name of the API, EncAsicGetMvOutput in encasiccontroller.c (inside STM32Cube_FW_N6_V1.0.0\Middlewares\Third_Party\VideoEncoder\source\common) looks like what you need:

/*------------------------------------------------------------------------------
 EncAsicGetMvOutput
 Return encOutputMbInfo_s pointer to beginning of macroblock mbNum
------------------------------------------------------------------------------*/
u32 * EncAsicGetMvOutput(asicData_s *asic, u32 mbNum)
{
 ...
}

The usage of this API in the example VENC_USB (inside STM32Cube_FW_N6_V1.0.0\Projects\STM32N6570-DK\Applications\VENC) is shown below for your reference:

EthanHUANG_0-1734919694484.png

1 reply

Ethan HUANG
Ethan HUANGBest answer
ST Employee
December 23, 2024

Hi Alex,

I'm not a VENC expert. According to the name of the API, EncAsicGetMvOutput in encasiccontroller.c (inside STM32Cube_FW_N6_V1.0.0\Middlewares\Third_Party\VideoEncoder\source\common) looks like what you need:

/*------------------------------------------------------------------------------
 EncAsicGetMvOutput
 Return encOutputMbInfo_s pointer to beginning of macroblock mbNum
------------------------------------------------------------------------------*/
u32 * EncAsicGetMvOutput(asicData_s *asic, u32 mbNum)
{
 ...
}

The usage of this API in the example VENC_USB (inside STM32Cube_FW_N6_V1.0.0\Projects\STM32N6570-DK\Applications\VENC) is shown below for your reference:

EthanHUANG_0-1734919694484.png

Associate II
December 24, 2024

Thank you, this was certainly helpful. I haven't tested it out yet, but it did point me to the correct portion of the VENC demo provided for the DK. As part of that demo, the `encOut` struct already contains a pointer to the macroblock motion vectors.

mƎALLEm
Technical Moderator
December 24, 2024

Hello @ClosedBridge , if @Ethan HUANG comment answered your question, don't hesitate to mark it "Accepted as Solution".

Thanks.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.