mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
Merge commit 'ef3a3519c10620c4206738595bf03fc0bed71802'
* commit 'ef3a3519c10620c4206738595bf03fc0bed71802': rawdec: Replace avpicture functions with imgutils Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
commit
9a6f1eea3e
@ -112,10 +112,10 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void flip(AVCodecContext *avctx, AVPicture *picture)
|
||||
static void flip(AVCodecContext *avctx, AVFrame *frame)
|
||||
{
|
||||
picture->data[0] += picture->linesize[0] * (avctx->height - 1);
|
||||
picture->linesize[0] *= -1;
|
||||
frame->data[0] += frame->linesize[0] * (avctx->height - 1);
|
||||
frame->linesize[0] *= -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -158,19 +158,18 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
int need_copy;
|
||||
|
||||
AVFrame *frame = data;
|
||||
AVPicture *picture = data;
|
||||
|
||||
if ((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
|
||||
avctx->pix_fmt == AV_PIX_FMT_PAL8 &&
|
||||
(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) {
|
||||
context->is_2_4_bpp = 1;
|
||||
context->frame_size = avpicture_get_size(avctx->pix_fmt,
|
||||
FFALIGN(avctx->width, 16),
|
||||
avctx->height);
|
||||
context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,
|
||||
FFALIGN(avctx->width, 16),
|
||||
avctx->height, 1);
|
||||
} else {
|
||||
context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;
|
||||
context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
|
||||
avctx->height);
|
||||
context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width,
|
||||
avctx->height, 1);
|
||||
}
|
||||
if (context->frame_size < 0)
|
||||
return context->frame_size;
|
||||
@ -264,8 +263,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
if ((res = avpicture_fill(picture, buf, avctx->pix_fmt,
|
||||
avctx->width, avctx->height)) < 0) {
|
||||
if ((res = av_image_fill_arrays(frame->data, frame->linesize,
|
||||
buf, avctx->pix_fmt,
|
||||
avctx->width, avctx->height, 1)) < 0) {
|
||||
av_buffer_unref(&frame->buf[0]);
|
||||
return res;
|
||||
}
|
||||
@ -320,27 +320,27 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
frame->linesize[0] = (frame->linesize[0] + 3) & ~3;
|
||||
|
||||
if (context->flip)
|
||||
flip(avctx, picture);
|
||||
flip(avctx, frame);
|
||||
|
||||
if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') ||
|
||||
avctx->codec_tag == MKTAG('Y', 'V', '1', '6') ||
|
||||
avctx->codec_tag == MKTAG('Y', 'V', '2', '4') ||
|
||||
avctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))
|
||||
FFSWAP(uint8_t *, picture->data[1], picture->data[2]);
|
||||
FFSWAP(uint8_t *, frame->data[1], frame->data[2]);
|
||||
|
||||
if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) {
|
||||
picture->data[1] = picture->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height;
|
||||
picture->data[2] = picture->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4;
|
||||
frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height;
|
||||
frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4;
|
||||
}
|
||||
|
||||
if (avctx->codec_tag == AV_RL32("yuv2") &&
|
||||
avctx->pix_fmt == AV_PIX_FMT_YUYV422) {
|
||||
int x, y;
|
||||
uint8_t *line = picture->data[0];
|
||||
uint8_t *line = frame->data[0];
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
for (x = 0; x < avctx->width; x++)
|
||||
line[2 * x + 1] ^= 0x80;
|
||||
line += picture->linesize[0];
|
||||
line += frame->linesize[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user