1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '48c06386831604921bdaf4fb77ea02766cd615f4'

* commit '48c06386831604921bdaf4fb77ea02766cd615f4':
  dpx: Replace avpicture functions with imgutils

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
This commit is contained in:
Hendrik Leppkes 2015-10-22 20:31:09 +02:00
commit 8fe1433ad4

View File

@ -90,7 +90,8 @@ static av_always_inline void write32_internal(int big_endian, void *p, int value
#define write16(p, value) write16_internal(s->big_endian, p, value) #define write16(p, value) write16_internal(s->big_endian, p, value)
#define write32(p, value) write32_internal(s->big_endian, p, value) #define write32(p, value) write32_internal(s->big_endian, p, value)
static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst) static void encode_rgb48_10bit(AVCodecContext *avctx, const AVFrame *pic,
uint8_t *dst)
{ {
DPXContext *s = avctx->priv_data; DPXContext *s = avctx->priv_data;
const uint8_t *src = pic->data[0]; const uint8_t *src = pic->data[0];
@ -115,7 +116,7 @@ static void encode_rgb48_10bit(AVCodecContext *avctx, const AVPicture *pic, uint
} }
} }
static void encode_gbrp10(AVCodecContext *avctx, const AVPicture *pic, uint8_t *dst) static void encode_gbrp10(AVCodecContext *avctx, const AVFrame *pic, uint8_t *dst)
{ {
DPXContext *s = avctx->priv_data; DPXContext *s = avctx->priv_data;
const uint8_t *src[3] = {pic->data[0], pic->data[1], pic->data[2]}; const uint8_t *src[3] = {pic->data[0], pic->data[1], pic->data[2]};
@ -141,7 +142,7 @@ static void encode_gbrp10(AVCodecContext *avctx, const AVPicture *pic, uint8_t *
} }
} }
static void encode_gbrp12(AVCodecContext *avctx, const AVPicture *pic, uint16_t *dst) static void encode_gbrp12(AVCodecContext *avctx, const AVFrame *pic, uint16_t *dst)
{ {
DPXContext *s = avctx->priv_data; DPXContext *s = avctx->priv_data;
const uint16_t *src[3] = {(uint16_t*)pic->data[0], const uint16_t *src[3] = {(uint16_t*)pic->data[0],
@ -243,21 +244,22 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
src += frame->linesize[0]; src += frame->linesize[0];
} }
} else { } else {
size = avpicture_layout((const AVPicture*)frame, avctx->pix_fmt, size = av_image_copy_to_buffer(buf + HEADER_SIZE, pkt->size - HEADER_SIZE,
avctx->width, avctx->height, frame->data, frame->linesize,
buf + HEADER_SIZE, pkt->size - HEADER_SIZE); avctx->pix_fmt,
avctx->width, avctx->height, 1);
} }
if (size < 0) if (size < 0)
return size; return size;
break; break;
case 10: case 10:
if (s->planar) if (s->planar)
encode_gbrp10(avctx, (const AVPicture*)frame, buf + HEADER_SIZE); encode_gbrp10(avctx, frame, buf + HEADER_SIZE);
else else
encode_rgb48_10bit(avctx, (const AVPicture*)frame, buf + HEADER_SIZE); encode_rgb48_10bit(avctx, frame, buf + HEADER_SIZE);
break; break;
case 12: case 12:
encode_gbrp12(avctx, (const AVPicture*)frame, (uint16_t*)(buf + HEADER_SIZE)); encode_gbrp12(avctx, frame, (uint16_t*)(buf + HEADER_SIZE));
break; break;
default: default:
av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", s->bits_per_component); av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", s->bits_per_component);