Thanks.  Looking at the code for av_picture_crop, I see that only the top
and left bands are specified, but it uses the stride lengths from the
source picture for the destination picture.  Assuming the width and height
of the destination picture have been set to reflect values further
decreased by bands on the right and bottom, then does av_picture_crop work
simply because the extra data is truncated?

--mvp

Marc Perrone
Senior Staff Engineer
Johnson Controls, Inc.
414/524-5580
414/403-7578 (cell)
[email protected]


|------------>
| From:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Stefano Sabatini <[email protected]>                            
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Libav* user questions and discussions <[email protected]>              
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |10/21/2009 02:54 AM                                                          
                                                                     |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [libav-user] how to do cropping with latest ffmpeg api's      (old  code 
deprecated)                                                          |
  
>--------------------------------------------------------------------------------------------------------------------------------------------------|





On date Friday 2009-10-16 15:39:29 -0500, [email protected] encoded:
>
> I have some legacy code that was written against an old version of ffmpeg
> and I need to update it to use the latest API's.  There is some code that
> does cropping that currently looks like this:
>
>             ImgReSampleContext* r_context = img_resample_full_init
> (dst_width, dst_height, src_linesize, src_height,
>                   crop.top, crop.bottom, crop.left, crop.right, 0, 0, 0,
> 0);
>             img_resample(r_context, (AVPicture*)&dst_picture,
> (AVPicture*)dst_frame);
>             img_resample_close(r_context);
>
> where "crop" is just a struct containing the number of pixels to crop off
> on each of the four sides of the original image.  Looking over the ffmpeg
> release history, ImgReSampleContext and img_resample were deprecated and
> then removed, with the comment in the intermediate source code to "use
> sws_scale instead."  I have looked at sws_scale but don't see an easy way
> to do what the above code does -- seems like the "slice" parameters let
you
> crop vertically, but not horizonatly.  Anyone know the answer to this?
Do
> I need to use libavfilter?

av_picture_crop() in libavcodec, but it works only with YUV formats,
check also the crop filter in the SOC libavfilter repo.

Regards.
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user



_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to