[FFmpeg-devel] [PATCH 1/3] lavc: Add coded bitstream read/write support for VP9

James Almer jamrial at gmail.com
Mon Apr 9 22:33:01 EEST 2018


On 4/8/2018 2:48 PM, Mark Thompson wrote:
> ---
>  configure                            |   2 +
>  libavcodec/Makefile                  |   1 +
>  libavcodec/cbs.c                     |   6 +
>  libavcodec/cbs_internal.h            |   1 +
>  libavcodec/cbs_vp9.c                 | 666 +++++++++++++++++++++++++++++++++++
>  libavcodec/cbs_vp9.h                 | 171 +++++++++
>  libavcodec/cbs_vp9_syntax_template.c | 388 ++++++++++++++++++++
>  7 files changed, 1235 insertions(+)
>  create mode 100644 libavcodec/cbs_vp9.c
>  create mode 100644 libavcodec/cbs_vp9.h
>  create mode 100644 libavcodec/cbs_vp9_syntax_template.c

[...]

> diff --git a/libavcodec/cbs_vp9.h b/libavcodec/cbs_vp9.h
> new file mode 100644
> index 0000000000..a678f7f478
> --- /dev/null
> +++ b/libavcodec/cbs_vp9.h
> @@ -0,0 +1,171 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * 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.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * 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
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +#ifndef AVCODEC_CBS_VP9_H
> +#define AVCODEC_CBS_VP9_H
> +
> +#include <stddef.h>
> +#include <stdint.h>
> +
> +#include "cbs.h"
> +
> +
> +enum {
> +    VP9_MAX_SEGMENTS = 8,
> +    VP9_SEG_LVL_MAX  = 4,
> +    VP9_MIN_TILE_WIDTH_B64 = 4,
> +    VP9_MAX_TILE_WIDTH_B64 = 64,
> +
> +    VP9_FRAME_SYNC_0 = 0x49,
> +    VP9_FRAME_SYNC_1 = 0x83,
> +    VP9_FRAME_SYNC_2 = 0x42,
> +
> +    VP9_SUPERFRAME_MARKER = 6,
> +};
> +
> +enum {
> +    VP9_CS_UNKNOWN   = 0,
> +    VP9_CS_BT_601    = 1,
> +    VP9_CS_BT_709    = 2,
> +    VP9_CS_SMPTE_170 = 3,
> +    VP9_CS_SMPTE_240 = 4,
> +    VP9_CS_BT_2020   = 5,
> +    VP9_CS_RESERVED  = 6,
> +    VP9_CS_RGB       = 7,
> +};

Ideally, standard codec defines like this would be in a header used by
the decoder and de/muxers as well. Think {h264,hevc}.h {h264,hevc}_ps.h,
{h264,hevc}_sei.h. Only the stuff below is cbs implementation specific.
It's a nit in any case, no need to change that before committing this.

No comments about the bitstream parsing code since i don't know it well
enough.


More information about the ffmpeg-devel mailing list