Le 19/02/2013 09:29, Kostya Shishkov a écrit :
+static int tag_tree_size(int w, int h)
>+{
>+    int res = 0;
>+    while (w > 1 || h > 1){
>+        res += w * h;
>+        w = (w+1) >> 1;
>+        h = (h+1) >> 1;
>+    }
>+    return res + 1;
The value obtained here may be too large, so it would be nice to check it.

you mean modifications like
static uint16_t tag_tree_size(int w, int h)
{
    uint32_t res = 0;
    while (w > 1 || h > 1) {
        res += w * h;
        if ( (res + 1) >= MAX_UINT16)
            return NULL;
        w    = (w + 1) >> 1;
        h    = (h + 1) >> 1;
    }
    return (uint16_t)(res + 1);
}

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to