Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -1634,6 +1634,7 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 1633 unmodified lines | ||
| 1634 | 1634 | MJpegDecodeContext *s = avctx->priv_data; |
| 1635 | 1635 | const uint8_t *buf_end, *buf_ptr; |
| 1636 | 1636 | const uint8_t *unescaped_buf_ptr; |
| 1637 | + int hshift, vshift; | |
| 1637 | 1638 | int unescaped_buf_size; |
| 1638 | 1639 | int start_code; |
| 1639 | 1640 | int i, index; |
| @@ -1815,6 +1816,9 @@ the_end: · 175 unmodified lines | ||
| 1815 | 1816 | } |
| 1816 | 1817 | if (s->upscale_v) { |
| 1817 | 1818 | uint8_t *dst = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(s->height - 1) * s->linesize[s->upscale_v]]; |
| 1819 | + int w; | |
| 1820 | + avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); | |
| 1821 | + w = s->width >> hshift; | |
| 1818 | 1822 | av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVJ444P || |
| 1819 | 1823 | avctx->pix_fmt == AV_PIX_FMT_YUV444P || |
| 1820 | 1824 | avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || |
| @@ -1823,16 +1827,16 @@ the_end: · 2 unmodified lines | ||
| 1823 | 1827 | uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[i / 2 * s->linesize[s->upscale_v]]; |
| 1824 | 1828 | uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[s->upscale_v])[(i + 1) / 2 * s->linesize[s->upscale_v]]; |
| 1825 | 1829 | if (src1 == src2) { |
| 1826 | − memcpy(dst, src1, s->width); | |
| 1830 | + memcpy(dst, src1, w); | |
| 1827 | 1831 | } else { |
| 1828 | − for (index = 0; index < s->width; index++) | |
| 1832 | + for (index = 0; index < w; index++) | |
| 1829 | 1833 | dst[index] = (src1[index] + src2[index]) >> 1; |
| 1830 | 1834 | } |
| 1831 | 1835 | dst -= s->linesize[s->upscale_v]; |
| 1832 | 1836 | } |
| 1833 | 1837 | } |
| 1834 | 1838 | if (s->flipped && (s->avctx->flags & CODEC_FLAG_EMU_EDGE)) { |
| 1835 | − int hshift, vshift, j; | |
| 1839 | + int j; | |
| 1836 | 1840 | avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &hshift, &vshift); |
| 1837 | 1841 | for (index=0; index<4; index++) { |
| 1838 | 1842 | uint8_t *dst = s->picture_ptr->data[index]; |