libx264: support yuv422/444 output.

pull/2/head
Anton Khirnov 13 years ago
parent 04de1569cd
commit 46c3c53bae
  1. 4
      configure
  2. 24
      libavcodec/libx264.c

4
configure vendored

@ -2905,8 +2905,8 @@ enabled libvpx && {
enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx ||
die "ERROR: libvpx encoder version must be >=0.9.1"; } }
enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
{ check_cpp_condition x264.h "X264_BUILD >= 115" ||
die "ERROR: libx264 version must be >= 0.115."; }
{ check_cpp_condition x264.h "X264_BUILD >= 118" ||
die "ERROR: libx264 version must be >= 0.118."; }
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib

@ -123,7 +123,7 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
x264_picture_t pic_out;
x264_picture_init( &x4->pic );
x4->pic.img.i_csp = X264_CSP_I420;
x4->pic.img.i_csp = x4->params.i_csp;
if (x264_bit_depth > 8)
x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH;
x4->pic.img.i_plane = 3;
@ -192,6 +192,22 @@ static av_cold int X264_close(AVCodecContext *avctx)
return 0;
}
static int convert_pix_fmt(enum PixelFormat pix_fmt)
{
switch (pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUVJ420P:
case PIX_FMT_YUV420P9:
case PIX_FMT_YUV420P10: return X264_CSP_I420;
case PIX_FMT_YUV422P:
case PIX_FMT_YUV422P10: return X264_CSP_I422;
case PIX_FMT_YUV444P:
case PIX_FMT_YUV444P9:
case PIX_FMT_YUV444P10: return X264_CSP_I444;
};
return 0;
}
#define PARSE_X264_OPT(name, var)\
if (x4->var && x264_param_parse(&x4->params, name, x4->var) < 0) {\
av_log(avctx, AV_LOG_ERROR, "Error parsing option '%s' with value '%s'.\n", name, x4->var);\
@ -218,6 +234,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.pf_log = X264_log;
x4->params.p_log_private = avctx;
x4->params.i_log_level = X264_LOG_DEBUG;
x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);
if (avctx->bit_rate) {
x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
@ -462,14 +479,19 @@ static av_cold int X264_init(AVCodecContext *avctx)
static const enum PixelFormat pix_fmts_8bit[] = {
PIX_FMT_YUV420P,
PIX_FMT_YUVJ420P,
PIX_FMT_YUV422P,
PIX_FMT_YUV444P,
PIX_FMT_NONE
};
static const enum PixelFormat pix_fmts_9bit[] = {
PIX_FMT_YUV420P9,
PIX_FMT_YUV444P9,
PIX_FMT_NONE
};
static const enum PixelFormat pix_fmts_10bit[] = {
PIX_FMT_YUV420P10,
PIX_FMT_YUV422P10,
PIX_FMT_YUV444P10,
PIX_FMT_NONE
};

Loading…
Cancel
Save