Commit c8c81ac5 authored by Mark Thompson's avatar Mark Thompson

lavc: Add coded bitstream read/write support for AV1

parent 5ee41447
...@@ -2271,6 +2271,7 @@ CONFIG_EXTRA=" ...@@ -2271,6 +2271,7 @@ CONFIG_EXTRA="
bswapdsp bswapdsp
cabac cabac
cbs cbs
cbs_av1
cbs_h264 cbs_h264
cbs_h265 cbs_h265
cbs_jpeg cbs_jpeg
...@@ -2535,6 +2536,7 @@ w32threads_deps="atomics_native" ...@@ -2535,6 +2536,7 @@ w32threads_deps="atomics_native"
threads_if_any="$THREADS_LIST" threads_if_any="$THREADS_LIST"
# subsystems # subsystems
cbs_av1_select="cbs"
cbs_h264_select="cbs golomb" cbs_h264_select="cbs golomb"
cbs_h265_select="cbs golomb" cbs_h265_select="cbs golomb"
cbs_jpeg_select="cbs" cbs_jpeg_select="cbs"
......
...@@ -63,6 +63,7 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o ...@@ -63,6 +63,7 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
OBJS-$(CONFIG_CABAC) += cabac.o OBJS-$(CONFIG_CABAC) += cabac.o
OBJS-$(CONFIG_CBS) += cbs.o OBJS-$(CONFIG_CBS) += cbs.o
OBJS-$(CONFIG_CBS_AV1) += cbs_av1.o
OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o h2645_parse.o OBJS-$(CONFIG_CBS_H264) += cbs_h2645.o h2645_parse.o
OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o h2645_parse.o OBJS-$(CONFIG_CBS_H265) += cbs_h2645.o h2645_parse.o
OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o OBJS-$(CONFIG_CBS_JPEG) += cbs_jpeg.o
......
...@@ -39,4 +39,92 @@ typedef enum { ...@@ -39,4 +39,92 @@ typedef enum {
AV1_OBU_PADDING = 15, AV1_OBU_PADDING = 15,
} AV1_OBU_Type; } AV1_OBU_Type;
// Metadata types (section 6.7.1).
enum {
AV1_METADATA_TYPE_HDR_CLL = 1,
AV1_METADATA_TYPE_HDR_MDCV = 2,
AV1_METADATA_TYPE_SCALABILITY = 3,
AV1_METADATA_TYPE_ITUT_T35 = 4,
AV1_METADATA_TYPE_TIMECODE = 5,
};
// Frame types (section 6.8.2).
enum {
AV1_FRAME_KEY = 0,
AV1_FRAME_INTER = 1,
AV1_FRAME_INTRA_ONLY = 2,
AV1_FRAME_SWITCH = 3,
};
// Reference frames (section 6.10.24).
enum {
AV1_REF_FRAME_INTRA = 0,
AV1_REF_FRAME_LAST = 1,
AV1_REF_FRAME_LAST2 = 2,
AV1_REF_FRAME_LAST3 = 3,
AV1_REF_FRAME_GOLDEN = 4,
AV1_REF_FRAME_BWDREF = 5,
AV1_REF_FRAME_ALTREF2 = 6,
AV1_REF_FRAME_ALTREF = 7,
};
// Constants (section 3).
enum {
AV1_MAX_OPERATING_POINTS = 32,
AV1_MAX_SB_SIZE = 128,
AV1_MI_SIZE = 4,
AV1_MAX_TILE_WIDTH = 4096,
AV1_MAX_TILE_AREA = 4096 * 2304,
AV1_MAX_TILE_ROWS = 64,
AV1_MAX_TILE_COLS = 64,
AV1_NUM_REF_FRAMES = 8,
AV1_REFS_PER_FRAME = 7,
AV1_TOTAL_REFS_PER_FRAME = 8,
AV1_PRIMARY_REF_NONE = 7,
AV1_MAX_SEGMENTS = 8,
AV1_SEG_LVL_MAX = 8,
AV1_SEG_LVL_ALT_Q = 0,
AV1_SEG_LVL_ALT_LF_Y_V = 1,
AV1_SEG_LVL_REF_FRAME = 5,
AV1_SEG_LVL_SKIP = 6,
AV1_SEG_LVL_GLOBAL_MV = 7,
AV1_SELECT_SCREEN_CONTENT_TOOLS = 2,
AV1_SELECT_INTEGER_MV = 2,
AV1_SUPERRES_NUM = 8,
AV1_SUPERRES_DENOM_MIN = 9,
AV1_INTERPOLATION_FILTER_SWITCHABLE = 4,
AV1_GM_ABS_ALPHA_BITS = 12,
AV1_GM_ALPHA_PREC_BITS = 15,
AV1_GM_ABS_TRANS_ONLY_BITS = 9,
AV1_GM_TRANS_ONLY_PREC_BITS = 3,
AV1_GM_ABS_TRANS_BITS = 12,
AV1_GM_TRANS_PREC_BITS = 6,
AV1_WARPEDMODEL_PREC_BITS = 16,
AV1_WARP_MODEL_IDENTITY = 0,
AV1_WARP_MODEL_TRANSLATION = 1,
AV1_WARP_MODEL_ROTZOOM = 2,
AV1_WARP_MODEL_AFFINE = 3,
};
// The main colour configuration information uses the same ISO/IEC 23001-8
// (H.273) enums as FFmpeg does, so separate definitions are not required.
// Chroma sample position.
enum {
AV1_CSP_UNKNOWN = 0,
AV1_CSP_VERTICAL = 1, // -> AVCHROMA_LOC_LEFT.
AV1_CSP_COLOCATED = 2, // -> AVCHROMA_LOC_TOPLEFT.
};
#endif /* AVCODEC_AV1_H */ #endif /* AVCODEC_AV1_H */
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
static const CodedBitstreamType *cbs_type_table[] = { static const CodedBitstreamType *cbs_type_table[] = {
#if CONFIG_CBS_AV1
&ff_cbs_type_av1,
#endif
#if CONFIG_CBS_H264 #if CONFIG_CBS_H264
&ff_cbs_type_h264, &ff_cbs_type_h264,
#endif #endif
...@@ -47,6 +50,9 @@ static const CodedBitstreamType *cbs_type_table[] = { ...@@ -47,6 +50,9 @@ static const CodedBitstreamType *cbs_type_table[] = {
}; };
const enum AVCodecID ff_cbs_all_codec_ids[] = { const enum AVCodecID ff_cbs_all_codec_ids[] = {
#if CONFIG_CBS_AV1
AV_CODEC_ID_AV1,
#endif
#if CONFIG_CBS_H264 #if CONFIG_CBS_H264
AV_CODEC_ID_H264, AV_CODEC_ID_H264,
#endif #endif
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -86,6 +86,7 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, ...@@ -86,6 +86,7 @@ int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc,
#define MAX_UINT_BITS(length) ((UINT64_C(1) << (length)) - 1) #define MAX_UINT_BITS(length) ((UINT64_C(1) << (length)) - 1)
extern const CodedBitstreamType ff_cbs_type_av1;
extern const CodedBitstreamType ff_cbs_type_h264; extern const CodedBitstreamType ff_cbs_type_h264;
extern const CodedBitstreamType ff_cbs_type_h265; extern const CodedBitstreamType ff_cbs_type_h265;
extern const CodedBitstreamType ff_cbs_type_jpeg; extern const CodedBitstreamType ff_cbs_type_jpeg;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment