懒人精

懒人精

1个粉丝

7

问答

1

专栏

0

资料

懒人精  发布于  2025-03-20 11:41:03
采纳率 15%
7个问答
50

hi_mpi_vpss_get_chn_frame 获取yuv 数据后有问题?

   

我在3519的mpp6.0 的vio例程上进行修改。

在vpss启动后调用了

hi_mpi_vpss_get_chn_frame获取一帧yuv格式图像
存储后,我用yuv查看工具查看


看这个结果好像是 把y分量的数据放到 uv分量的地址上了。而且 uv分量各有一半图像。
这是为啥呢?
以下为 获取vpss 源码

if ((ret=hi_mpi_vpss_get_chn_frame(vpss_grp[0], HI_VPSS_CHN0,&video_frameInfo, 1000)) != HI_SUCCESS) 
        { /* 1000 is a number */
            sample_print("HI_MPI_VPSS_GetChnFrame err:0x%x\n", ret);
            continue;
        }else{
            printf("get vpss chn succ \n");
        }


        printf("stride  %d  %d \n",video_frameInfo.video_frame.stride[0],video_frameInfo.video_frame.stride[1]);

        int imageYSize =  video_frameInfo.video_frame.width*video_frameInfo.video_frame.height;


        int imageUVsize = video_frameInfo.video_frame.width*video_frameInfo.video_frame.height / 2;
        int l_imageSize =  video_frameInfo.video_frame.width*video_frameInfo.video_frame.height*3/2;

        void* Yaddr =     hi_mpi_sys_mmap(video_frameInfo.video_frame.phys_addr[0],l_imageSize);
       // void* uvaddr = hi_mpi_sys_mmap(video_frameInfo.video_frame.phys_addr[1],imageUVsize);

        int l_height = video_frameInfo.video_frame.height;
        int l_width = video_frameInfo.video_frame.width;
        int l_stride = video_frameInfo.video_frame.width;

        FILE *fp = fopen("./image.yuv","wb");
        if(fp == NULL)
        {
            printf("fopen image.yuv faile\n");
        }


    // 假设 stride 为对齐后的行宽(可能大于 width)  
        // for (int y_row = 0; y_row < l_height; y_row++) {  
        //     fwrite(Yaddr+ y_row * l_stride, 1, l_width, fp);  // 写入 Y 分量‌
        // }  

        // for (int uv_row = 0; uv_row < l_height/2; uv_row++) {  
        //     fwrite(uvaddr + uv_row * l_stride, 1, l_width, fp);  // 写入 UV 分量  
        // } 


        fwrite(Yaddr,1,l_imageSize,fp);

        fclose(fp);
        hi_mpi_sys_munmap(Yaddr, l_imageSize);
     //   hi_mpi_sys_munmap(uvaddr, imageUVsize);
        hi_mpi_vpss_release_chn_frame(vpss_grp[0], HI_VPSS_CHN0, &video_frameInfo);

----------------------------------------vpss module param---------------------------------------------------------------
   schedule_mode   max_out_width  max_out_height    high_profile
          NORMAL            8192            8192               N

----------------------------------------vpss grp cfg1-------------------------------------------------------------------
  grp is_rotation_input_support is_dis_gyro_support     is_motion_denoise_support
    0                         N                   N                             N

----------------------------------------vpss grp cfg2-------------------------------------------------------------------
  grp   max_split_num max_out_rgn_num is_save_out_lut  out_lut_buf_size
    0               3               1               N                 0

----------------------------------------vpss grp attr1------------------------------------------------------------------
  grp   max_w   max_h   pixel_fmt  src_rate  dst_rate   user_ctrl  backup
    0    3840    2160   YVU-SP420        -1        -1           Y       N

----------------------------------------vpss grp attr2------------------------------------------------------------------
  grp  buf_share_en  buf_share_chn     dci      ie  dei_mode  dei_width  dei_height  mcf_en  act_buf_share
    0             N              0       N       N       OFF          0           0       N              N

----------------------------------------vpss grp crop info--------------------------------------------------------------
  grp crop_en   coord     x     y   width  height    trim_x    trim_y  trim_width trim_height
    0       N     ABS     0     0       0       0         0         0        3840        2160

----------------------------------------vpss grp 3dnr attr--------------------------------------------------------------
  grp  enable      type     ref_cmp     motion_mode
    0       N     VIDEO           N            NORM

----------------------------------------vpss 3dnr param-----------------------------------------------------------------

----------------------------------------frame interrupt attr------------------------------------------------------------
  grp       int_type     early_line
    0              -              0

----------------------------------------vpss grp gdc param--------------------------------------------------------------
  grp  in_width in_height  lut_cell_size
    0      3840      2160             16

----------------------------------------vpss grp spread attr------------------------------------------------------------
  grp  enable  coef

----------------------------------------vpss grp ldc v1 attr------------------------------------------------------------
  grp  enable  aspect  x_ratio  y_ratio  xy_ratio  center_x_offset  center_y_offset  distortion_ratio

----------------------------------------vpss grp ldc v2 attr------------------------------------------------------------
  grp  enable  aspect  x_ratio  y_ratio  xy_ratio    len_x    len_y  shift_x  shift_y   coef_intp_ratio

----------------------------------------vpss grp rotation attr----------------------------------------------------------
  grp  enable  rotation_type  view_type   angle  x_offset  y_offset     width    height

----------------------------------------vpss grp fisheye attr-----------------------------------------------------------
  grp  enable mount_mode rgn_num  bg_color lmf_en hor_offset ver_offset trapezoid_coef fan_strength

----------------------------------------vpss grp fisheye rgn attr-------------------------------------------------------
  grp  rgn_index  view_mode  in_radius  out_radius  pan  tilt  hor_zoom  ver_zoom  out_x  out_y  out_w  out_h

----------------------------------------vpss grp pmf attr---------------------------------------------------------------
  grp  enable   width  height                    pmf_coef

----------------------------------------vpss grp zoom in window attr----------------------------------------------------
  grp  enable    mode       x       y     width    height  trim_x  trim_y  trim_width trim_height   valid

----------------------------------------vpss grp fov attr---------------------------------------------------------------
  grp  enable                    fov_coef

----------------------------------------vpss grp lut attr---------------------------------------------------------------
  grp  pre_lut_en post_lut_en    lut_mode       ratio

----------------------------------------vpss grp lut--------------------------------------------------------------------
  grp      name   in_width  in_height  out_width out_height  cell_size    phys_addr

----------------------------------------vpss grp zme attr---------------------------------------------------------------
  grp       width      height

----------------------------------------vpss grp stitch attr------------------------------------------------------------
  grp  enable  pipe_num sync_en stitch_mode correction_mode

----------------------------------------vpss grp stitch correction cylindrical attr-------------------------------------
  grp pipe pmf_enable  dst_width dst_height x_offset y_offset ratio                    pmf_coef

----------------------------------------vpss grp stitch correction lut attr---------------------------------------------
  grp pipe   in_width  in_height  out_width out_height  cell_size    phys_addr

----------------------------------------vpss grp stitch luma sync staus-------------------------------------------------
  grp sync_en milli_sec            isp_pipe smooth_strength  shading_adjust_thr  real_sync_en  last_sync_interval

----------------------------------------vpss grp stitch blend param-----------------------------------------------------
  grp buf_num  position[0]     range[0]  position[1]     range[1]  position[2]     range[2]

----------------------------------------vpss chn crop info--------------------------------------------------------------
  grp  chn  crop_en     coord       x       y   width  height  trim_x  trim_y  trim_width  trim_height
    0    0        N       ABS       0       0       0       0

----------------------------------------vpss chn attr1------------------------------------------------------------------
  grp  chn  enable  mode  width  height align mirror flip  src_rate  dst_rate  depth  vb_src  pool_id
    0    0       Y  USER   3840    2160    32      N    N        -1        -1      3  common        -

----------------------------------------vpss chn attr2------------------------------------------------------------------
  grp  chn  aspect  video_x  video_y  video_w  video_h   bg_color  border  left_w right_w   top_w  bottom_w  bd_color
    0    0    NONE        0        0     3840     2160        0x0       N       0       0       0         0       0x0

----------------------------------------vpss chn attr3------------------------------------------------------------------
  grp  chn  sharpen  sp_strength  quick_send  scale_type
    0    0        N            0           N      NORMAL

----------------------------------------vpss chn fmu info---------------------------------------------------------------
  grp  chn  fmu_mode
    0    0       off

----------------------------------------vpss ext chn attr1--------------------------------------------------------------
  grp   ext_chn  enable src_chn   width  height  src_rate  dst_rate   depth   align        src_type  vb_src  pool_id

----------------------------------------vpss ext chn attr2--------------------------------------------------------------
  grp   ext_chn  scale_type

----------------------------------------vpss chn low delay attr---------------------------------------------------------
  grp  chn  enable  line_cnt   one_buf_en one_buf_addr act_low_delay_en
    0    0       Y       200            N          0x0                Y

----------------------------------------vpss rgn info-------------------------------------------------------------------
  grp     cover    mosaic    corner   overlay  position
    0         0         0         0         0       cur

----------------------------------------vpss grp stitch pipe status-----------------------------------------------------
  grp pipe   recv_pic preview_lost  free_num  busy_num overlap_point0x overlap_point1x

----------------------------------------vpss grp gdc status-------------------------------------------------------------
  grp  enable  dis_en   out_width  out_height
    0       N       N           0           0

----------------------------------------vpss chn proc ex----------------------------------------------------------------
  grp  chn  rotate    cover_ex   mosaic_ex line_ex   corner_ex  overlay_ex
    0    0       N           0           0       0           0           0

----------------------------------------vpss node status----------------------------------------------------------------
  grp  free_num  busy_num delay_num  backup     cur
    0         9         0         0       0       0

----------------------------------------vpss grp work status------------------------------------------------------------
  grp   recv_pic preview_lost     new_do     old_do   new_undo   old_undo start_fail start  cost_time max_cost_time vpss
    0        308            0        308          0          0          0          0     Y       2002          2251    0

----------------------------------------vpss grp video frame info-------------------------------------------------------
  grp   width  height pixel_fmt  video_format dynamic_range    cmp_mode recv_fmu       first_pic_pts         cur_pic_pts
    0    3840    2160 YVU-SP420        LINEAR          SDR8         SEG      off                   0                   0

----------------------------------------vpss chn output status----------------------------------------------------------
  grp  chn  enable   width  height  pixel_fmt  video_format  dynamic_range    cmp_mode  send_ok  frame_rate    proc_time
    0    0       Y    3840    2160  YVU-SP420        LINEAR           SDR8         SEG      275          30         2029

----------------------------------------vpss drv work status------------------------------------------------------------
   link_int  bus_err  dcmp_err  frame_err  malloc_err  free_err  start_suc0 start_err0 node_err0
        308        0         0          0           0         0         308          0         0

----------------------------------------vpss hardware node queue--------------------------------------------------------
   free_num    wait_num    proc_num sel00 busy000 busy001 sel01 busy010 busy011  load_ratio_0
         22           0           0     0       0       0     0       0       0           52%

----------------------------------------vpss int work status------------------------------------------------------------
   cnt_per_sec   max_cnt_per_sec     cost_time   max_cost_time   cost_time_per_sec   max_cost_time_per_sec
            61                61            73             191                5594                    5942
我来回答
回答4个
时间排序
认可量排序

UncleRoderick

41个粉丝

16

问答

3

专栏

16

资料

UncleRoderick 2025-03-20 13:41:45
认可0
易百纳技术社区该回答已被题主采纳为最佳答案

把VPSS的compress_mode改成OT_COMPRESS_MODE_NONE

懒人精
懒人精   回复   UncleRoderick  2025-03-20 13:57:45
0

厉害哦!按你的改了就可以了。就是图像uv 这个有点问题

UncleRoderick
UncleRoderick   回复   懒人精  2025-03-20 14:00:55
0

代码参考SDK/smp/a55_linux/source/mpp/tools/vpss_chn_dump.c,或者直接在这个目录下make,试试生成的vpss_chn_dump程序。

懒人精
懒人精   回复   UncleRoderick  2025-03-20 14:06:02
0

好的,感谢,感谢。

或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
+ 添加网盘链接/附件

Markdown 语法

  • 加粗**内容**
  • 斜体*内容*
  • 删除线~~内容~~
  • 引用> 引用内容
  • 代码`代码`
  • 代码块```编程语言↵代码```
  • 链接[链接标题](url)
  • 无序列表- 内容
  • 有序列表1. 内容
  • 缩进内容
  • 图片![alt](url)
举报反馈

举报类型

  • 内容涉黄/赌/毒
  • 内容侵权/抄袭
  • 政治相关
  • 涉嫌广告
  • 侮辱谩骂
  • 其他

详细说明

易百纳技术社区