comparison pngdec.c @ 9703:05cf2547e0f0 libavcodec

Fix unaligned dsputil call. Should fix FATE corepng test on Solaris/Sparc.
author vitor
date Sun, 24 May 2009 12:44:54 +0000
parents cd207441ca56
children 3768b0da80b8
comparison
equal deleted inserted replaced
9702:3dcbde0de577 9703:05cf2547e0f0
385 const uint8_t *buf = avpkt->data; 385 const uint8_t *buf = avpkt->data;
386 int buf_size = avpkt->size; 386 int buf_size = avpkt->size;
387 PNGDecContext * const s = avctx->priv_data; 387 PNGDecContext * const s = avctx->priv_data;
388 AVFrame *picture = data; 388 AVFrame *picture = data;
389 AVFrame *p; 389 AVFrame *p;
390 uint8_t *crow_buf_base = NULL;
390 uint32_t tag, length; 391 uint32_t tag, length;
391 int ret, crc; 392 int ret, crc;
392 393
393 FFSWAP(AVFrame *, s->current_picture, s->last_picture); 394 FFSWAP(AVFrame *, s->current_picture, s->last_picture);
394 avctx->coded_frame= s->current_picture; 395 avctx->coded_frame= s->current_picture;
525 s->tmp_row = av_malloc(s->row_size); 526 s->tmp_row = av_malloc(s->row_size);
526 if (!s->tmp_row) 527 if (!s->tmp_row)
527 goto fail; 528 goto fail;
528 } 529 }
529 /* compressed row */ 530 /* compressed row */
530 s->crow_buf = av_malloc(s->row_size + 1); 531 crow_buf_base = av_malloc(s->row_size + 16);
531 if (!s->crow_buf) 532 if (!crow_buf_base)
532 goto fail; 533 goto fail;
534
535 /* we want crow_buf+1 to be 16-byte aligned */
536 s->crow_buf = crow_buf_base + 15;
533 s->zstream.avail_out = s->crow_size; 537 s->zstream.avail_out = s->crow_size;
534 s->zstream.next_out = s->crow_buf; 538 s->zstream.next_out = s->crow_buf;
535 } 539 }
536 s->state |= PNG_IDAT; 540 s->state |= PNG_IDAT;
537 if (png_decode_idat(s, length) < 0) 541 if (png_decode_idat(s, length) < 0)
610 *data_size = sizeof(AVFrame); 614 *data_size = sizeof(AVFrame);
611 615
612 ret = s->bytestream - s->bytestream_start; 616 ret = s->bytestream - s->bytestream_start;
613 the_end: 617 the_end:
614 inflateEnd(&s->zstream); 618 inflateEnd(&s->zstream);
615 av_freep(&s->crow_buf); 619 av_free(crow_buf_base);
620 s->crow_buf = NULL;
616 av_freep(&s->last_row); 621 av_freep(&s->last_row);
617 av_freep(&s->tmp_row); 622 av_freep(&s->tmp_row);
618 return ret; 623 return ret;
619 fail: 624 fail:
620 ret = -1; 625 ret = -1;