[FFmpeg-devel] [PATCH V2] avcodec/libvpxenc: add ROI-based encoding support for VP8/VP9 support

James Zern jzern at google.com
Wed Aug 14 02:31:59 EEST 2019


Hi,

On Tue, Aug 13, 2019 at 1:18 AM Guo, Yejun <yejun.guo at intel.com> wrote:
>
> example command line to verify it:
> ./ffmpeg -i input.stream -vf addroi=0:0:iw/3:ih/3:-0.8 -c:v libvpx -b:v 2M tmp.webm
>
> Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
> ---
>  configure              |   7 ++
>  libavcodec/libvpxenc.c | 197 +++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 204 insertions(+)
>
> diff --git a/configure b/configure
> index 3fb8f35..e549e26 100755
> --- a/configure
> +++ b/configure
> @@ -6300,6 +6300,13 @@ enabled libvpx            && {
>          check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
>              check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs $pthreads_extralibs"
>      }
> +    enabled libvpx_vp9_encoder && {
> +        test_cc <<EOF && add_cflags -DSUPPORT_LIBVPX_VP9_ROI
> +#include <vpx/vp8cx.h>
> +void foo(void){ int i = VP9E_SET_ROI_MAP; }
> +EOF
> +    }
> +

This can be removed after addressing the comment below.

> [...].
> +
> +static int vp9_encode_set_roi(AVCodecContext *avctx, int frame_width, int frame_height, const AVFrameSideData *sd)
> +{
> +    int roi_supported = 0;
> +    VPxContext *ctx = avctx->priv_data;
> +
> +#ifdef SUPPORT_LIBVPX_VP9_ROI

You can use VPX_CTRL_VP9E_SET_ROI_MAP to check availability. All
controls have a corresponding VPX_CTRL_<control> define (see the
bottom of vpx/vp8cx.h).


More information about the ffmpeg-devel mailing list