On Wed, Mar 26, 2014 at 7:28 PM, Kostya Shishkov
<[email protected]> wrote:
> On Wed, Mar 26, 2014 at 07:19:54PM +0100, Vittorio Giovara wrote:
>> ---
>> + x = avctx->width;
>
> x = 0;
> out_buf = f->data[0];
>
>> + while (bytestream2_get_bytes_left(&gb) > 0) {
>> + int i;
>> +
>> + /* set buffer at the right position at every new line */
>> + if (x == avctx->width) {
>> + x = 0;
>> + out_buf = f->data[0] + f->linesize[0] * y++;
>> + if (y > avctx->height) {
OK I'll also ad a y = 1 so that i don't have to put a -1 in the check below
>> + av_log(avctx, AV_LOG_ERROR,
>> + "Ended frame decoding with %d bytes left.\n",
>> + bytestream2_get_bytes_left(&gb));
>> + return AVERROR_INVALIDDATA;
>> + }
>> + }
>> +
>> + /* read packet and copy data */
>> + count = bytestream2_get_byteu(&gb);
>> + if (!count || x + count > avctx->width) {
>> + av_log(avctx, AV_LOG_ERROR, "Invalid run length %d.\n", count);
>> + return AVERROR_INVALIDDATA;
>> + }
>> +
>> + if (avctx->pix_fmt == AV_PIX_FMT_BGR24) {
>> + pixel = bytestream2_get_be24u(&gb);
>
> u?
> Are you sure it doesn't need to be checked?
>
>> + for (i = 0; i < count; i++) {
>> + AV_WB24(out_buf, pixel);
>> + out_buf += 3;
>> + }
>> + } else { // AV_PIX_FMT_GRAY8
>> + pixel = bytestream2_get_byteu(&gb);
>
> ditto
Well, yes, it need to be checked.
>
> the rest (including encoder) LGTM
yay, thanks.
--
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel