H7 Plus rotation_corr broken?

Discussion related to "under the hood" OpenMV topics.
mirkwood
Posts: 13
Joined: Tue Mar 10, 2020 4:08 am

H7 Plus rotation_corr broken?

Postby mirkwood » Fri May 08, 2020 12:34 am

I've got some code that works fine on the H7 but not on the plus with the v3.6.2 and latest master build.
The rotation_corr fails even at QQVGA with a MemoryError: out of fast Frame Buffer Stack memory.

I can see between the boards that some blocks have moved to different ram.
#define OMV_FB_MEMORY AXI_SRAM => became DRAM
#define OMV_JPEG_MEMORY SRAM3 => became DRAM

But I can't see how this would cause an issue because it all seems bigger.
The rotation_corr has fb_alloc in it, but I don't see how that could fail given the size of frame_buffer.
Also I don't see any changes to this function recently.

Any ideas?

Code: Select all

import sensor, image

# Camera Init

sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)

# Camera Defs
while(True):
    # Capture an image
    img = sensor.snapshot()
    img.rotation_corr(x_translation=1,y_translation=1)
mirkwood
Posts: 13
Joined: Tue Mar 10, 2020 4:08 am

Re: H7 Plus rotation_corr broken?

Postby mirkwood » Fri May 08, 2020 2:16 am

My mistake, I see a heap allocation there umm_init_x which allocates on heap?
The heap size is the same between H7 and H7 Plus.


So the call is this:

Code: Select all

apriltag.c:12328
void imlib_rotation_corr(image_t *img, float x_rotation, float y_rotation, float z_rotation,
                         float x_translation, float y_translation,
                         float zoom, float fov, float *corners)
{
  umm_init_x(8000); // 400 20 byte heap blocks...
  ...
}
To this function:

Code: Select all

// Note OMV_UMM_BLOCK_SIZE is 16 on H7 and 256 on H7 plys

void umm_init_x( size_t size ) {
  // UMM_MALLOC_CFG_HEAP_SIZE = 8000
  uint32_t UMM_MALLOC_CFG_HEAP_SIZE = (size / sizeof(size_t)) * sizeof(size_t);
  // H7      if (8000 <  16*128= 2048) then fail.  (Success)
  // H7 plus if (8000 < 256*128=32768) then fail!  (*Failure*)
  if (UMM_MALLOC_CFG_HEAP_SIZE < (sizeof(umm_block) * 128)) fb_alloc_fail();
  ...
}
So what is a UMM and what is this actually doing?
User avatar
kwagyeman
Posts: 4271
Joined: Sun May 24, 2015 2:10 pm

Re: H7 Plus rotation_corr broken?

Postby kwagyeman » Fri May 08, 2020 2:43 am

Definitely a bug, can you add this on the github issue tracker.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 8 guests