Dual Video Input Resizable on screen RZ/A1H

Hello all,

we are trying to show 2 cameras (VIN1A and VIN1B) on the screeen, using the windows_surface, video_input and RGA Library v 3.12 from Application Note R01AN2162EJ0312 (Jan 18) without luck.

We have allocated the layer id -1, for the camera layer (as advised in Application Note), with layer format ycbcr and tried to show both cameras. Actually we see only a camera at 0,0 coordinates and we cannot figure out how to:

  • - show the camera in a particular point offset of the screen (for example centering the image or put on the right) 
  • - resize a camera stream
  • - paint two cameras on the same window_surfaces layer

We've tried to use:

  • - window_surface::accesslayerattributes method, but without success: x,y,offset_x,offset_y modifications seem to not affect the behaviour of video layer.
  • - RGA_ContextClass: applying translate seems not affect the position of camera

Are there any examples which uses RGA+window_surfaces for achieve this?

Any clue is appreciated


Here a snapshot of the code:

/* e is always 0 */
/* Configure WindowSurfaces -> LayerNum = 2 */
WindowSurfacesConfigClass wsConfig;
wsConfig.pixel_format = PIXEL_FORMAT_ARGB4444;
wsConfig.layer_count = LayerNum;
wsConfig.background_format = BACKGROUND_FORMAT_VIDEO_INTERLACE;
e = m_windowSurfaces.initialize( wsConfig );
e = m_windowSurfaces.get_layer_frame_buffer(LayerBackground, &m_frameBuffer[FbLayerBackground]);
e = m_windowSurfaces.get_layer_frame_buffer(LayerForeground, &m_frameBuffer[FbLayerForeground]);
e = m_windowSurfaces.get_layer_frame_buffer(LayerVideo, &m_frameBuffer[FbLayerVideo]);
/* Create Canvas2D class, for RGA */
Canvas2D_ContextConfigClass canvCfg;
canvCfg.frame_buffer = m_frameBuffer[FbLayerForeground];
m_canvas2D = R_RGA_New_Canvas2D_ContextClass( canvCfg );
e = R_OSPL_GetErrNum();
/* Configure, for the moment, only one camera channel, but i expect that is sufficent creating two instances on the same framebuffer for having two camera */
VideoInputConfig videoConfig;
videoConfig.video_input_channel_num = 0;
videoConfig.display_channel_num = 0;
videoConfig.frame_buffer = m_frameBuffer[FbLayerVideo];
videoConfig.display_layer_num = LayerVideo;
e = m_videoInput.initialize(videoConfig);
/* Switch to VideoLayer framebuffer context */
e = R_GRAPHICS_SetFrameBuffer(m_canvas2D.c_LanguageContext, m_frameBuffer[FbLayerVideo]);
/* Test 1 -> failed */
#if 0
LayerAttributesClass layerAttribute;
layerAttribute.offset_x = 0U;
layerAttribute.offset_y = 0U;
layerAttribute.x = 0U;
layerAttribute.y = 0U;
layerAttribute.width = 0U;
layerAttribute.height = 0U;
layerAttribute.access = ACCESS_WRITE;
layerAttribute.flags = F_LAYER_X | F_LAYER_Y |F_LAYER_OFFSET_X | F_LAYER_OFFSET_Y;
layerAttribute.offset_x = 100U;
layerAttribute.offset_y = 100U;
layerAttribute.x = 100U;
layerAttribute.y = 100U;

/* This is necessary for having the camera at full screen, we do not figure out why it's necessary, but it is */
m_windowSurfaces.swap_buffers(LayerVideo, m_canvas2D);

Thank in advance