X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Fdxtory.c;fp=ffmpeg%2Flibavcodec%2Fdxtory.c;h=4d8b7b29a63570bcc93c2fab8de25e7a6e384cbb;hp=1a59ae7a0485c08d53f3b7709916398dabbe85b5;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/dxtory.c b/ffmpeg/libavcodec/dxtory.c index 1a59ae7..4d8b7b2 100644 --- a/ffmpeg/libavcodec/dxtory.c +++ b/ffmpeg/libavcodec/dxtory.c @@ -82,10 +82,10 @@ static int dxtory_decode_v1_410(AVCodecContext *avctx, AVFrame *pic, V = pic->data[2]; for (h = 0; h < avctx->height; h += 4) { for (w = 0; w < avctx->width; w += 4) { - AV_COPY32(Y1 + w, src); - AV_COPY32(Y2 + w, src + 4); - AV_COPY32(Y3 + w, src + 8); - AV_COPY32(Y4 + w, src + 12); + AV_COPY32U(Y1 + w, src); + AV_COPY32U(Y2 + w, src + 4); + AV_COPY32U(Y3 + w, src + 8); + AV_COPY32U(Y4 + w, src + 12); U[w >> 2] = src[16] + 0x80; V[w >> 2] = src[17] + 0x80; src += 18; @@ -410,7 +410,7 @@ static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic, { GetByteContext gb; GetBitContext gb2; - int nslices, slice, slice_height, ref_slice_height; + int nslices, slice, slice_height; int cur_y, next_y; uint32_t off, slice_size; uint8_t *Y, *U, *V; @@ -424,13 +424,12 @@ static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; } - if (!nslices || avctx->height % nslices) { + if (!nslices) { avpriv_request_sample(avctx, "%d slices for %dx%d", nslices, avctx->width, avctx->height); return AVERROR_PATCHWELCOME; } - ref_slice_height = avctx->height / nslices; if ((avctx->width & 3) || (avctx->height & 3)) { avpriv_request_sample(avctx, "Frame dimensions %dx%d", avctx->width, avctx->height); @@ -445,9 +444,9 @@ static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic, V = pic->data[2]; cur_y = 0; - next_y = ref_slice_height; for (slice = 0; slice < nslices; slice++) { slice_size = bytestream2_get_le32(&gb); + next_y = ((slice + 1) * avctx->height) / nslices; slice_height = (next_y & ~3) - (cur_y & ~3); if (slice_size > src_size - off) { av_log(avctx, AV_LOG_ERROR, @@ -475,7 +474,6 @@ static int dxtory_decode_v2_410(AVCodecContext *avctx, AVFrame *pic, V += pic->linesize[2] * (slice_height >> 2); off += slice_size; cur_y = next_y; - next_y += ref_slice_height; } return 0; @@ -514,7 +512,7 @@ static int dxtory_decode_v2_420(AVCodecContext *avctx, AVFrame *pic, { GetByteContext gb; GetBitContext gb2; - int nslices, slice, slice_height, ref_slice_height; + int nslices, slice, slice_height; int cur_y, next_y; uint32_t off, slice_size; uint8_t *Y, *U, *V; @@ -528,13 +526,12 @@ static int dxtory_decode_v2_420(AVCodecContext *avctx, AVFrame *pic, return AVERROR_INVALIDDATA; } - if (!nslices || avctx->height % nslices) { + if (!nslices) { avpriv_request_sample(avctx, "%d slices for %dx%d", nslices, avctx->width, avctx->height); return AVERROR_PATCHWELCOME; } - ref_slice_height = avctx->height / nslices; if ((avctx->width & 1) || (avctx->height & 1)) { avpriv_request_sample(avctx, "Frame dimensions %dx%d", avctx->width, avctx->height); @@ -549,9 +546,9 @@ static int dxtory_decode_v2_420(AVCodecContext *avctx, AVFrame *pic, V = pic->data[2]; cur_y = 0; - next_y = ref_slice_height; for (slice = 0; slice < nslices; slice++) { slice_size = bytestream2_get_le32(&gb); + next_y = ((slice + 1) * avctx->height) / nslices; slice_height = (next_y & ~1) - (cur_y & ~1); if (slice_size > src_size - off) { av_log(avctx, AV_LOG_ERROR, @@ -579,7 +576,6 @@ static int dxtory_decode_v2_420(AVCodecContext *avctx, AVFrame *pic, V += pic->linesize[2] * (slice_height >> 1); off += slice_size; cur_y = next_y; - next_y += ref_slice_height; } return 0;