diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-10-07 03:38:50 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-10-07 03:38:50 +0200 |
commit | 86602d1c79929caa1b88b942f0074b1481b52235 (patch) | |
tree | b25d18d943dd732ef7814ad9d5392d62e07ffdfd /libavcodec/libx264.c | |
parent | 177ed7e818d1e3cb8159b99965254f1236bff106 (diff) | |
parent | a72cad0a6c05aa74940101e937cb3dc602d7d67b (diff) | |
download | ffmpeg-86602d1c79929caa1b88b942f0074b1481b52235.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
vp6: Reset the internal state when aborting key frames header parsing
vp56: Release old pictures after a resolution changes
vp6: Check for huffman tree build errors
vp56: Check for missing reference frame data
cinepak: Fix invalid read access on extra data
vmd: fix segfaults on corruped streams
cook: Fix js_vlc_bits value validation for joint stereo
segafilm: Check for memory allocation failures in segafilm demuxer.
segafilm: Fix potential division by 0 on corrupted streams in the demuxer
Fixed segfault on corrupted sega streams in the demuxer.
Fixed deference of NULL pointer in motionpixels decoder.
libx264: support 9- and 10-bit output.
h264: correct implicit_weight for field-interlaced pictures.
mpegvideo: set correct offset for edge emulation buffer.
mpegvideo: fix position of bottom edge.
Conflicts:
libavcodec/motionpixels.c
libavcodec/mpegvideo.c
libavcodec/version.h
libavcodec/vmdav.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r-- | libavcodec/libx264.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index c1aab6cf15..5c503237b5 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -20,6 +20,7 @@ */ #include "libavutil/opt.h" +#include "libavutil/pixdesc.h" #include "avcodec.h" #include "internal.h" #include <x264.h> @@ -138,6 +139,8 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf, x264_picture_init( &x4->pic ); x4->pic.img.i_csp = X264_CSP_I420; + if (x264_bit_depth > 8) + x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; x4->pic.img.i_plane = 3; if (frame) { @@ -510,6 +513,30 @@ static av_cold int X264_init(AVCodecContext *avctx) return 0; } +static const enum PixelFormat pix_fmts_8bit[] = { + PIX_FMT_YUV420P, + PIX_FMT_YUVJ420P, + PIX_FMT_NONE +}; +static const enum PixelFormat pix_fmts_9bit[] = { + PIX_FMT_YUV420P9, + PIX_FMT_NONE +}; +static const enum PixelFormat pix_fmts_10bit[] = { + PIX_FMT_YUV420P10, + PIX_FMT_NONE +}; + +static av_cold void X264_init_static(AVCodec *codec) +{ + if (x264_bit_depth == 8) + codec->pix_fmts = pix_fmts_8bit; + else if (x264_bit_depth == 9) + codec->pix_fmts = pix_fmts_9bit; + else if (x264_bit_depth == 10) + codec->pix_fmts = pix_fmts_10bit; +} + #define OFFSET(x) offsetof(X264Context, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { @@ -604,8 +631,8 @@ AVCodec ff_libx264_encoder = { .encode = X264_frame, .close = X264_close, .capabilities = CODEC_CAP_DELAY, - .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_YUV420P, PIX_FMT_YUVJ420P, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), .priv_class = &class, .defaults = x264_defaults, + .init_static_data = X264_init_static, }; |