#10669: crop filter with exact=0 does not work correctly on 
non-chroma-subsampled
hardware-backed inputs
-------------------------------------+-------------------------------------
             Reporter:  Russell      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:  git-
             Keywords:  crop vaapi   |  master
  hwaccel                            |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug: I'm trying to crop a 444 (no chroma subsampling) video
 using `crop` using vaapi. The crop region seems to always be rounded to a
 multiple of two, even though the input has no chroma subsampling, which
 according to the documentation means that `exact` should have no effect.

 Originally reported to a project I develop at https://github.com/russelltg
 /wl-screenrec/issues/26

 The sample video has lines at x,y = 100,299. So the crop args
 w=200:h=200:x=100:x=100 should give a perfect box around the corner (which
 it does). But w=200:h=200:x=101:x=101 incorrectly gives the same result.

 How to reproduce:
 {{{
 % ffmpeg -vaapi_device /dev/dri/renderD129 -i screenrecord.mp4 -vf
 'hwupload,
 crop=w=200:h=200:x=101:y=101,scale_vaapi=format=nv12:w=200:h=200' -c:v
 h264_vaapi cropped.mp4
 ffmpeg version N-112783-g5452cbdc15
   built with gcc 13.2.1 (GCC) 20230801
   HW: Intel i9-11900H
 }}}

 However, it does work if you put exact=1

 It seems to me that the problematic snippet is from vf_crop.c:158

 {{{
     if (pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) {
         s->hsub = 1;
         s->vsub = 1;
     } else {
         s->hsub = pix_desc->log2_chroma_w;
         s->vsub = pix_desc->log2_chroma_h;
     }
 }}}

 from vf_crop.c, which seems to assume all hardware backed formats have 2x2
 chroma subsampling (which, sure is typically the case, but not always!)
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10669>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to