2013-11-16 01:28:30 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Guillaume Martres <smarter@ubuntu.com>
|
|
|
|
*
|
2013-12-08 15:49:16 +03:00
|
|
|
* This file is part of FFmpeg.
|
2013-11-16 01:28:30 +03:00
|
|
|
*
|
2013-12-08 15:49:16 +03:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2013-11-16 01:28:30 +03:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2013-12-08 15:49:16 +03:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2013-11-16 01:28:30 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2013-12-08 15:49:16 +03:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2013-11-16 01:28:30 +03:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <vpx/vpx_codec.h>
|
|
|
|
#include "libvpx.h"
|
2015-03-26 02:10:16 +02:00
|
|
|
#include "config.h"
|
2022-02-23 14:56:49 +02:00
|
|
|
#include "config_components.h"
|
2015-03-26 02:10:16 +02:00
|
|
|
|
|
|
|
#if CONFIG_LIBVPX_VP9_ENCODER
|
|
|
|
#include <vpx/vpx_encoder.h>
|
|
|
|
#include <vpx/vp8cx.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const enum AVPixelFormat vp9_pix_fmts_def[] = {
|
|
|
|
AV_PIX_FMT_YUV420P,
|
2016-07-01 01:16:31 +02:00
|
|
|
AV_PIX_FMT_YUVA420P,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
#if CONFIG_LIBVPX_VP9_ENCODER
|
|
|
|
static const enum AVPixelFormat vp9_pix_fmts_highcol[] = {
|
|
|
|
AV_PIX_FMT_YUV420P,
|
2016-07-01 01:16:31 +02:00
|
|
|
AV_PIX_FMT_YUVA420P,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_YUV422P,
|
2015-05-20 22:52:47 +02:00
|
|
|
AV_PIX_FMT_YUV440P,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_YUV444P,
|
2016-02-19 22:06:26 +02:00
|
|
|
AV_PIX_FMT_GBRP,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
static const enum AVPixelFormat vp9_pix_fmts_highbd[] = {
|
|
|
|
AV_PIX_FMT_YUV420P,
|
2016-07-01 01:16:31 +02:00
|
|
|
AV_PIX_FMT_YUVA420P,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_YUV422P,
|
2015-05-20 22:52:47 +02:00
|
|
|
AV_PIX_FMT_YUV440P,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_YUV444P,
|
2016-02-19 22:02:42 +02:00
|
|
|
AV_PIX_FMT_YUV420P10,
|
|
|
|
AV_PIX_FMT_YUV422P10,
|
|
|
|
AV_PIX_FMT_YUV440P10,
|
|
|
|
AV_PIX_FMT_YUV444P10,
|
|
|
|
AV_PIX_FMT_YUV420P12,
|
|
|
|
AV_PIX_FMT_YUV422P12,
|
|
|
|
AV_PIX_FMT_YUV440P12,
|
|
|
|
AV_PIX_FMT_YUV444P12,
|
2016-02-19 22:06:26 +02:00
|
|
|
AV_PIX_FMT_GBRP,
|
|
|
|
AV_PIX_FMT_GBRP10,
|
|
|
|
AV_PIX_FMT_GBRP12,
|
2015-03-26 02:10:16 +02:00
|
|
|
AV_PIX_FMT_NONE
|
|
|
|
};
|
|
|
|
#endif
|
2013-11-16 01:28:30 +03:00
|
|
|
|
2022-03-16 22:09:54 +02:00
|
|
|
av_cold void ff_vp9_init_static(FFCodec *codec)
|
2013-11-16 01:28:30 +03:00
|
|
|
{
|
2022-03-16 22:09:54 +02:00
|
|
|
codec->p.pix_fmts = vp9_pix_fmts_def;
|
2015-03-26 02:10:16 +02:00
|
|
|
#if CONFIG_LIBVPX_VP9_ENCODER
|
2017-11-18 03:25:21 +02:00
|
|
|
{
|
2015-03-26 02:10:16 +02:00
|
|
|
vpx_codec_caps_t codec_caps = vpx_codec_get_caps(vpx_codec_vp9_cx());
|
|
|
|
if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH)
|
2022-03-16 22:09:54 +02:00
|
|
|
codec->p.pix_fmts = vp9_pix_fmts_highbd;
|
2015-03-26 02:10:16 +02:00
|
|
|
else
|
2022-03-16 22:09:54 +02:00
|
|
|
codec->p.pix_fmts = vp9_pix_fmts_highcol;
|
2015-03-26 02:10:16 +02:00
|
|
|
}
|
|
|
|
#endif
|
2013-11-16 01:28:30 +03:00
|
|
|
}
|