Le 27/03/13 13:16, Luca Barbato a écrit :
May be a simpler way, but this one works. The simpler way would be to guess w and h. Not sure they are constants along the decoding int32_t because the w, and h are uint_16_t and res += w*h, and we return à negative velaue in case of error+static int32_t tag_tree_size(uint16_t w, uint16_t h) >+{ >+ uint32_t res = 0; >+ while (w > 1 || h > 1) { >+ res += w * h; >+ if (res + 1 >= INT32_MAX) >+ return -1; >+ w = (w + 1) >> 1; >+ h = (h + 1) >> 1; >+ } >+ return (int32_t)(res + 1); >+}Are we sure there isn't a simpler way to code it? why int32_t ?
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
