I am trying to set up the PXP to perform a 90-degree rotation of an input image with dimensions of 480 x 320 pixels in RGB565 format. I do not get the desired results with the following processed surface and output setup:
Hi @mborgerson ,
I modify the pxp_rotate example to rotate a rectangle. Please take a look.
Regards,
Jing
Unfortunately, while the changes may rotate the full image rectangle, the code still has all the defines with no explanation:
#define APP_IMG_WIDTH DEMO_BUFFER_WIDTH //480 #define APP_IMG_HEIGHT DEMO_BUFFER_HEIGHT //272 /* PS input buffer is not square. */ #if APP_IMG_WIDTH > APP_IMG_HEIGHT #define APP_PS_WIDTH APP_IMG_HEIGHT //272 #define APP_PS_HEIGHT (APP_IMG_HEIGHT/2+8) //272 #else #define APP_PS_SIZE APP_IMG_WIDTH #endif #define APP_PS_ULC_X ((APP_IMG_WIDTH / 2) - (APP_PS_WIDTH / 2)) #define APP_PS_ULC_Y ((APP_IMG_HEIGHT / 2) - (APP_PS_HEIGHT / 2)) #define APP_PS_LRC_X ((APP_IMG_WIDTH / 2) + (APP_PS_WIDTH / 2) - 1U) #define APP_PS_LRC_Y ((APP_IMG_HEIGHT / 2) + (APP_PS_HEIGHT / 2) - 1U) #define APP_PS_ULC_X1 ((APP_IMG_WIDTH / 2) - (APP_PS_HEIGHT / 2)) #define APP_PS_ULC_Y1 ((APP_IMG_HEIGHT / 2) - (APP_PS_WIDTH / 2)) #define APP_PS_LRC_X1 ((APP_IMG_WIDTH / 2) + (APP_PS_HEIGHT / 2) - 1U) #define APP_PS_LRC_Y1 ((APP_IMG_HEIGHT / 2) + (APP_PS_WIDTH / 2) - 1U)
What is needed is an explanation of why these #define statements are part of the code.
In my own experiments, I get good result by just setting the PS corners to (0,0) and (width-1, height-1). I set the output surface to the same dimensions because the reference manual tells me so:
36.6.7 Output Surface Lower Right Coordinate (PXP_OUT_LRC)
This register contains the size, or lower right coordinate, of the output buffer NOT rotated. It is implied that the upper left coordinate of the output surface is always [0,0]. When rotating the framebuffer, the PXP will automatically swap the X/Y, or WIDTH/ HEIGHT, to accomodate the rotated size.