Quantcast
Channel: Processors
Viewing all articles
Browse latest Browse all 148958

Forum Post: RE: Image resizer downscale on Linux

$
0
0

We're using a modified version of the saMmapLoopback.c to test on our side. Most modifications affect our sensor configuration, and the only one regarding scaling is this addition:

 {                                                                                 struct v4l2_format fmt;                                                        struct v4l2_crop crop;                                                         /* Changing display window size to 200x200 */                                  fmt.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;                                        /*fmt.fmt.pix.width = display->width;                                          fmt.fmt.pix.height = display->height;                                          fmt.fmt.pix.pixelformat = DEF_PIX_FMT;*/                                       fmt.fmt.win.w.left = 0;                                                        fmt.fmt.win.w.top = 0;                                                         fmt.fmt.win.w.width = 720;                                                     fmt.fmt.win.w.height = 574;                                                    ret = ioctl(display->display_fd, VIDIOC_S_FMT, &fmt);                          if (ret < 0) {                                                                        perror("VIDIOC_S_FMT\n");                                                      goto ERROR;                                                             }                                                                                                         crop.type = V4L2_BUF_TYPE_VIDEO_OUTPUT;                                        crop.c.left = 0;                                                               crop.c.top = 0;                                                                crop.c.width = 1024;                                                      crop.c.height = 768;                                                    ret = ioctl(display->display_fd, VIDIOC_S_CROP, &crop);                        if (ret < 0) {                                                                        perror("VIDIOC_S_CROP\n");                                                    goto ERROR;                                                              }                                                                           }               

We do it in display_prepare_streaming, right after:

   fmt->fmt.pix.width = display->width;                                           fmt->fmt.pix.height = display->height;                                         fmt->fmt.pix.pixelformat = DEF_PIX_FMT;                                        fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;                                        ret = ioctl(display->display_fd, VIDIOC_S_FMT, fmt);                           if (ret < 0) {                                                                    perror("VIDIOC_S_FMT");                                                        goto ERROR;                                                                 }        

I hope this helps.

Emilio.


Viewing all articles
Browse latest Browse all 148958

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>