[FFmpeg-devel] PATH :wmv2 Limit the mvx and mvy to be integer in some condition

Di Wu di1028.wu at samsung.com
Wed Oct 15 13:44:18 CEST 2014

Hi :
    I have created a patch, but I'm not sure if the patch is correct 
because I don't have the spec of wmv2.
    The following code which is in ff_mspel_motion function seems to 
limit the mvx and mvy to be integer to make sure the prediction right 
and to void reading overflow. But I'm not sure, maybe this is just 
specified by the spec of wmv2.
     if (src_x <= -16 || src_x >= s->width)
        dxy &= ~3;
    if (src_y <= -16 || src_y >= s->height)
        dxy &= ~4;

    If the goal of the up code is the former one, the following code 
can play the same role, So I'm confused.
    if (src_x < 1 || src_y < 1 || src_x + 17 >= s->h_edge_pos ||
        src_y + h + 1 >= v_edge_pos) {
        s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize,
                                 s->linesize, s->linesize, 19, 19,
                                 src_x - 1, src_y - 1,
                                 s->h_edge_pos, s->v_edge_pos);
        ptr = s->edge_emu_buffer + 1 + s->linesize;
        emu = 1;
    If this code is used to make sure the prediction right and to void 
reading overflow, I think my patch should applied or just remove this 
    My patch is attached, please check it.

Best Regards
Di Wu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-wmv2-Limit-the-mvx-and-mvy-to-be-integer-in-some-con.patch
Type: application/octet-stream
Size: 1513 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141015/ebc49a91/attachment.obj>

More information about the ffmpeg-devel mailing list