Simplify ptx decoding on big-endian.
Reviewed-by: Reimar Döffinger
This commit is contained in:
parent
a8ff7e3f96
commit
a1e52c9441
1 changed files with 1 additions and 7 deletions
|
|
@ -58,7 +58,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
avctx->pix_fmt = PIX_FMT_RGB555;
|
avctx->pix_fmt = PIX_FMT_RGB555LE;
|
||||||
|
|
||||||
if (buf_end - buf < offset)
|
if (buf_end - buf < offset)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
@ -85,13 +85,7 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
||||||
stride = p->linesize[0];
|
stride = p->linesize[0];
|
||||||
|
|
||||||
for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) {
|
for (y = 0; y < h && buf_end - buf >= w * bytes_per_pixel; y++) {
|
||||||
#if HAVE_BIGENDIAN
|
|
||||||
unsigned int x;
|
|
||||||
for (x=0; x<w*bytes_per_pixel; x+=bytes_per_pixel)
|
|
||||||
AV_WN16(ptr+x, AV_RL16(buf+x));
|
|
||||||
#else
|
|
||||||
memcpy(ptr, buf, w*bytes_per_pixel);
|
memcpy(ptr, buf, w*bytes_per_pixel);
|
||||||
#endif
|
|
||||||
ptr += stride;
|
ptr += stride;
|
||||||
buf += w*bytes_per_pixel;
|
buf += w*bytes_per_pixel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue