[FFmpeg-devel] Patch for High color and High bit-depth support
James Zern
jzern at google.com
Sat Mar 28 04:07:01 CET 2015
On Fri, Mar 27, 2015 at 6:58 PM, Debargha Mukherjee <debargha at google.com> wrote:
> [...]
> +#if CONFIG_LIBVPX_VP9_ENCODER && defined(VPX_IMG_FMT_HIGHBITDEPTH)
> +static int set_pix_fmt(AVCodecContext *avctx, struct vpx_codec_enc_cfg *enccfg,
> + vpx_codec_flags_t *flags, vpx_img_fmt_t *img_fmt) {
> + if (avctx->codec_id == AV_CODEC_ID_VP8 && avctx->pix_fmt != AV_PIX_FMT_YUV420P) {
>
couldn't you just check a codec capability? what happens when vp9 is configured
with high bitdepth encoding disabled?
> + av_log(avctx, AV_LOG_ERROR, "Can only encode YUV420P format to VP8.\n");
> + return AVERROR_INVALIDDATA;
> + }
> + switch (avctx->pix_fmt) {
> + case AV_PIX_FMT_YUV420P:
>
indent is wrong; 4 spaces in blocks, cases aligned.
> - if (avctx->profile != FF_PROFILE_UNKNOWN)
> - enccfg.g_profile = avctx->profile;
> + if (avctx->profile != FF_PROFILE_UNKNOWN) {
> + enccfg.g_profile = avctx->profile;
> + }
> +
>
seems unrelated.
> @@ -709,7 +783,6 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
> int64_t timestamp = 0;
> int res, coded_size;
> vpx_enc_frame_flags_t flags = 0;
> -
> if (frame) {
> rawimg = &ctx->rawimg;
> rawimg->planes[VPX_PLANE_Y] = frame->data[0];
> @@ -744,6 +817,7 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt,
>
> res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp,
> avctx->ticks_per_frame, flags, ctx->deadline);
> +
> if (res != VPX_CODEC_OK) {
> log_encoder_error(avctx, "Error encoding frame");
> return AVERROR_INVALIDDATA;
same.
More information about the ffmpeg-devel
mailing list