video-format: fix off-by-one for tiled coordinates

https://bugzilla.gnome.org/show_bug.cgi?id=707361
This commit is contained in:
Wim Taymans 2013-12-25 16:06:43 +01:00 committed by Nicolas Dufresne
parent fb0fecbf48
commit f3e989179b
2 changed files with 5 additions and 5 deletions

View file

@ -2142,7 +2142,7 @@ unpack_NV12T (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
/* first x tile to convert */
tx = x >> ws;
/* Last tile to convert */
ntx = (x + width) >> ws;
ntx = ((x + width - 1) >> ws) + 1;
/* The row we are going to convert */
ty = y >> hs;
@ -2151,7 +2151,7 @@ unpack_NV12T (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
/* x position in a tile */
x = x & (tile_width - 1);
for (; tx <= ntx; tx++) {
for (; tx < ntx; tx++) {
gpointer tdata[GST_VIDEO_MAX_PLANES];
gint tstride[GST_VIDEO_MAX_PLANES];
gint unpack_width;
@ -2200,7 +2200,7 @@ pack_NV12T (const GstVideoFormatInfo * info, GstVideoPackFlags flags,
pack_pstride = GST_VIDEO_FORMAT_INFO_PSTRIDE (pack_info, 0);
/* Last tile to convert */
ntx = width >> ws;
ntx = ((width - 1) >> ws) + 1;
/* The row we are going to convert */
ty = y >> hs;

View file

@ -280,8 +280,8 @@ gst_video_frame_copy_plane (GstVideoFrame * dest, const GstVideoFrame * src,
dy_tiles = dinfo->stride[tidx];
/* this is the amount of tiles to copy */
w = (w + (1 << ws) - 1) >> ws;
h = (h + (1 << hs) - 1) >> hs;
w = ((w - 1) >> ws) + 1;
h = ((h - 1) >> hs) + 1;
/* FIXME can possibly do better when no retiling is needed, it depends on
* the stride and the tile_size */