IMX6ULL 的PXP模块问题请教

attachments-2020-04-7JudgXg75e982c90165e0.pngattachments-2020-04-21qCowke5e982cb62742b.jpg利用pxp模块做图片翻转,出来的效果是这样,大家有没有使用过pxp模块的?这是哪里的问题,求解答!!

请先 登录 后评论

2 个回答

hceng

检查下命令参数吧。

现在效果是图片被分割成了小横段翻转,说明软件问题不大,多半设置参数没对。

另外,交流问题多说点信息嘛,透露得最多,越好帮你想办法。现在连你怎么操作的都不知道,全靠猜。


类似工具imagemagick效果:

attachments-2020-04-cwpWnRbb5e9920ff63b9d.pngattachments-2020-04-1EHCRp4l5e99210fccee6.pngattachments-2020-04-qxNKqZtd5e99212e2de04.png

请先 登录 后评论
云心水影

翻转pxp模块是按8*8或16*16的像素块来处理的,参数上只有旋转像素块大小的一个选项,针对像素块本身没有可设置的其他参数了。直接用官方的例程也是同样的问题。具体实现如下:


int lcd_device::blit_image(image_data* pout, image_data* ps_image,image_data* as_image)
{  
   if(ps_image->pos.px < 0)
     ps_image->pos.px = 0;
   if(ps_image->pos.py < 0)
     ps_image->pos.py = 0;
   if(as_image)
   {
     if(as_image->pos.px < 0)
       as_image->pos.px = 0;
     if(as_image->pos.py < 0)
       as_image->pos.py = 0;
 
     /* AS configure. */
     asBufferConfig.pixelFormat = (pxp_as_pixel_format_t)as_image->as_format; /*!< AS buffer pixel format. */
     asBufferConfig.bufferAddr  = (uint32_t)*as_image->p_image_data;;         /*!< Input buffer address. */
     asBufferConfig.pitchBytes  =  as_image->pitch;;
    }
   /* PS configure. */
 
   psBufferConfig.pixelFormat = (pxp_ps_pixel_format_t)ps_image->ps_format;
   psBufferConfig.swapByte = false;
   psBufferConfig.bufferAddr = (uint32_t)*ps_image->p_image_data;
   psBufferConfig.bufferAddrU = 0U;
   psBufferConfig.bufferAddrV = 0U;
   psBufferConfig.pitchBytes = ps_image->pitch;

   /* OUT  configure. */
   outputBufferConfig.pixelFormat = (pxp_output_pixel_format_t)pout->out_format;
   outputBufferConfig.interlacedMode = kPXP_OutputProgressive;
   outputBufferConfig.buffer0Addr = (uint32_t)(*pout->p_image_data) + ps_image->pos.px + ps_image->pos.py * pout->pitch;
   outputBufferConfig.buffer1Addr = 0U;
   outputBufferConfig.pitchBytes = pout->pitch;
   outputBufferConfig.width =  ps_image->width;
   outputBufferConfig.height = ps_image->height;

   PXP_SetProcessBlockSize (PXP, kPXP_BlockSize16);       //选择像素块大小
   PXP_SetProcessSurfaceBackGroundColor(PXP, 0U);         //设置PS层区域外的背景色
   PXP_SetProcessSurfaceBufferConfig(PXP, &psBufferConfig);//设置PS层配置
 
   PXP_SetProcessSurfacePosition(PXP,0,                    //设置PS处理坐标范围   
                                     0,
                                     ps_image->width  - 1,
                                     ps_image->height - 1);
   if(as_image)
   {
      PXP_SetAlphaSurfaceBufferConfig(PXP, &asBufferConfig);  //设置AS层配置
      int x = (as_image->pos.px - ps_image->pos.px);
      x = (x>0)?x:0;
      int y = (as_image->pos.py - ps_image->pos.py);
      y = (y>0)?y:0;
  
      PXP_SetAlphaSurfacePosition(PXP,   x,                    //设置AS层处理范围
                                      y,
                                      as_image->width + x-1,
                                      as_image->height+ y-1);
   }else
      PXP_SetAlphaSurfacePosition(PXP, 0xFFFFU, 0xFFFFU, 0U, 0U);/* Disable AS if not used. */
   /* Output config. */
   PXP_SetOutputBufferConfig(PXP, &outputBufferConfig);
 
   /* Disable CSC1, it is enabled by default. */
   PXP_EnableCsc1(PXP, false);
  
   /* Set FLIP configuration */
  
   PXP_SetRotateConfig(PXP, kPXP_RotateOutputBuffer,         //设置输出翻转/选择方向
                       (pxp_rotate_degree_t)pout->rotate,
                       (pxp_flip_mode_t)pout->flip_mode);
  
   PXP_SetRotateConfig(PXP, kPXP_RotateProcessSurface,       //设置输入翻转/旋转方向
                       (pxp_rotate_degree_t)ps_image->rotate,
                       (pxp_flip_mode_t)ps_image->flip_mode);
 
   /* Start processing. */
   PXP_EnableInterrupts(PXP,PXP_CTRL_IRQ_ENABLE_MASK);
  
   PXP_Start(PXP);

   /* Wait for process complete. Interrupt method could be used alternatively. */
   while(1)
   {
      OS_FLAGS event =  wait_done_event();
        if(event  == 2) return 0;
   }
}

请先 登录 后评论