[vlc-devel] [PATCH] Fix snapshot chroma/size mismach bug

basos g noxelia at gmail.com
Fri Dec 12 22:08:15 CET 2008


----snapshot chroma/size mismatch report.

  At least in one case there is a mistmatch between p_vout->fmt_out
and corresponding p_pic->format in chroma...
Also there is size mismatch. Vout->fmt_out has the final video size
that may be resized. This is not the initial picture size. This
affects the snapshot size when snapshot-width and snapshot-height vars
are zero (meaning snap the *original* size )
So  in the following example @ vout_Snapshot the local variable fmt_in
that  *was* initialized with p_vout->fmt_out had a chroma RV32 while
the real chroma taken from p_pic->format is I420. So when we feed this
fmt_in to the encoder nasty snapshots are taken..

We fix it by initializing fmt_in with p_pic->format. Why take the
chroma data for the picture from another place while the picture holds
them anyway.

For the history this vout_Snapshot was called from a video filter
Filter( filter_t *p_filter, picture_t *p_in_pic ) routine like this
       vout_Snapshot( (vout_thread_t*) p_filter->p_owner, p_in_pic );


Debug data :
Breakpoint  @vout_Snapshot

(gdb) p p_vout->fmt_in
$1 = {i_chroma = 808596553, i_aspect = 576000, i_width = 192, i_height
= 144, i_x_offset = 0, i_y_offset = 0,
  i_visible_width = 192, i_visible_height = 144, i_bits_per_pixel = 0,
i_sar_num = 1, i_sar_den = 1, i_frame_rate = 25,
  i_frame_rate_base = 1, i_rmask = 0, i_gmask = 0, i_bmask = 0,
i_rrshift = 0, i_lrshift = 0, i_rgshift = 0, i_lgshift = 0,
  i_rbshift = 0, i_lbshift = 0, p_palette = 0x0}
(gdb) p p_vout->fmt_out
$2 = {i_chroma = 842225234, i_aspect = 574747, i_width = 306, i_height
= 230, i_x_offset = 0, i_y_offset = 0,
  i_visible_width = 306, i_visible_height = 230, i_bits_per_pixel = 0,
i_sar_num = 1, i_sar_den = 1, i_frame_rate = 0,
  i_frame_rate_base = 0, i_rmask = 16711680, i_gmask = 65280, i_bmask
= 255, i_rrshift = 0, i_lrshift = 16, i_rgshift = 0,
  i_lgshift = 8, i_rbshift = 0, i_lbshift = 0, p_palette = 0x0}
(gdb) p p_pic->format
$3 = {i_chroma = 808596553, i_aspect = 576000, i_width = 192, i_height
= 144, i_x_offset = 0, i_y_offset = 0,
  i_visible_width = 192, i_visible_height = 144, i_bits_per_pixel =
12, i_sar_num = 0, i_sar_den = 0, i_frame_rate = 0,
  i_frame_rate_base = 0, i_rmask = 0, i_gmask = 0, i_bmask = 0,
i_rrshift = 0, i_lrshift = 0, i_rgshift = 0, i_lgshift = 0,
  i_rbshift = 0, i_lbshift = 0, p_palette = 0x0}
(gdb) x/s & p_vout->fmt_in
0xa143c4c:	 "I420"
(gdb) x/s & p_vout->fmt_out
0xa143ca8:	 "RV32\033�\b"
(gdb) x/s & p_pic->format
0xa1441a4:	 "I420"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Fix-snapshot-chroma-size-mismach-bug.patch
Type: text/x-diff
Size: 984 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20081212/bafa0b59/attachment.patch>


More information about the vlc-devel mailing list