mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-27 05:00:37 +00:00
vp9: split header into separate struct and expose in vp9.h
This allows hwaccels to access the bitstream header information.
This commit is contained in:
parent
f2f55bd9ca
commit
b95f241b6e
717
libavcodec/vp9.c
717
libavcodec/vp9.c
File diff suppressed because it is too large
Load Diff
114
libavcodec/vp9.h
114
libavcodec/vp9.h
@ -24,6 +24,39 @@
|
||||
#ifndef AVCODEC_VP9_H
|
||||
#define AVCODEC_VP9_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum BlockLevel {
|
||||
BL_64X64,
|
||||
BL_32X32,
|
||||
BL_16X16,
|
||||
BL_8X8,
|
||||
};
|
||||
|
||||
enum BlockPartition {
|
||||
PARTITION_NONE, // [ ] <-.
|
||||
PARTITION_H, // [-] |
|
||||
PARTITION_V, // [|] |
|
||||
PARTITION_SPLIT, // [+] --'
|
||||
};
|
||||
|
||||
enum BlockSize {
|
||||
BS_64x64,
|
||||
BS_64x32,
|
||||
BS_32x64,
|
||||
BS_32x32,
|
||||
BS_32x16,
|
||||
BS_16x32,
|
||||
BS_16x16,
|
||||
BS_16x8,
|
||||
BS_8x16,
|
||||
BS_8x8,
|
||||
BS_8x4,
|
||||
BS_4x8,
|
||||
BS_4x4,
|
||||
N_BS_SIZES,
|
||||
};
|
||||
|
||||
enum TxfmMode {
|
||||
TX_4X4,
|
||||
TX_8X8,
|
||||
@ -61,6 +94,13 @@ enum IntraPredMode {
|
||||
N_INTRA_PRED_MODES
|
||||
};
|
||||
|
||||
enum InterPredMode {
|
||||
NEARESTMV = 10,
|
||||
NEARMV = 11,
|
||||
ZEROMV = 12,
|
||||
NEWMV = 13,
|
||||
};
|
||||
|
||||
enum FilterMode {
|
||||
FILTER_8TAP_SMOOTH,
|
||||
FILTER_8TAP_REGULAR,
|
||||
@ -69,4 +109,78 @@ enum FilterMode {
|
||||
FILTER_SWITCHABLE,
|
||||
};
|
||||
|
||||
enum CompPredMode {
|
||||
PRED_SINGLEREF,
|
||||
PRED_COMPREF,
|
||||
PRED_SWITCHABLE,
|
||||
};
|
||||
|
||||
typedef struct VP9BitstreamHeader {
|
||||
// bitstream header
|
||||
uint8_t profile;
|
||||
uint8_t keyframe;
|
||||
uint8_t invisible;
|
||||
uint8_t errorres;
|
||||
uint8_t intraonly;
|
||||
uint8_t resetctx;
|
||||
uint8_t refreshrefmask;
|
||||
uint8_t highprecisionmvs;
|
||||
enum FilterMode filtermode;
|
||||
uint8_t allowcompinter;
|
||||
uint8_t refreshctx;
|
||||
uint8_t parallelmode;
|
||||
uint8_t framectxid;
|
||||
uint8_t use_last_frame_mvs;
|
||||
uint8_t refidx[3];
|
||||
uint8_t signbias[3];
|
||||
uint8_t fixcompref;
|
||||
uint8_t varcompref[2];
|
||||
struct {
|
||||
uint8_t level;
|
||||
int8_t sharpness;
|
||||
} filter;
|
||||
struct {
|
||||
uint8_t enabled;
|
||||
uint8_t updated;
|
||||
int8_t mode[2];
|
||||
int8_t ref[4];
|
||||
} lf_delta;
|
||||
uint8_t yac_qi;
|
||||
int8_t ydc_qdelta, uvdc_qdelta, uvac_qdelta;
|
||||
uint8_t lossless;
|
||||
#define MAX_SEGMENT 8
|
||||
struct {
|
||||
uint8_t enabled;
|
||||
uint8_t temporal;
|
||||
uint8_t absolute_vals;
|
||||
uint8_t update_map;
|
||||
uint8_t prob[7];
|
||||
uint8_t pred_prob[3];
|
||||
struct {
|
||||
uint8_t q_enabled;
|
||||
uint8_t lf_enabled;
|
||||
uint8_t ref_enabled;
|
||||
uint8_t skip_enabled;
|
||||
uint8_t ref_val;
|
||||
int16_t q_val;
|
||||
int8_t lf_val;
|
||||
int16_t qmul[2][2];
|
||||
uint8_t lflvl[4][2];
|
||||
} feat[MAX_SEGMENT];
|
||||
} segmentation;
|
||||
enum TxfmMode txfmmode;
|
||||
enum CompPredMode comppredmode;
|
||||
struct {
|
||||
unsigned log2_tile_cols, log2_tile_rows;
|
||||
unsigned tile_cols, tile_rows;
|
||||
} tiling;
|
||||
|
||||
int uncompressed_header_size;
|
||||
int compressed_header_size;
|
||||
} VP9BitstreamHeader;
|
||||
|
||||
typedef struct VP9SharedContext {
|
||||
VP9BitstreamHeader h;
|
||||
} VP9SharedContext;
|
||||
|
||||
#endif /* AVCODEC_VP9_H */
|
||||
|
@ -36,14 +36,14 @@ static void FN(inter_pred)(AVCodecContext *ctx)
|
||||
VP9Context *s = ctx->priv_data;
|
||||
VP9Block *b = s->b;
|
||||
int row = s->row, col = s->col;
|
||||
ThreadFrame *tref1 = &s->refs[s->refidx[b->ref[0]]], *tref2;
|
||||
ThreadFrame *tref1 = &s->refs[s->s.h.refidx[b->ref[0]]], *tref2;
|
||||
AVFrame *ref1 = tref1->f, *ref2;
|
||||
int w1 = ref1->width, h1 = ref1->height, w2, h2;
|
||||
ptrdiff_t ls_y = s->y_stride, ls_uv = s->uv_stride;
|
||||
int bytesperpixel = BYTES_PER_PIXEL;
|
||||
|
||||
if (b->comp) {
|
||||
tref2 = &s->refs[s->refidx[b->ref[1]]];
|
||||
tref2 = &s->refs[s->s.h.refidx[b->ref[1]]];
|
||||
ref2 = tref2->f;
|
||||
w2 = ref2->width;
|
||||
h2 = ref2->height;
|
||||
|
@ -26,13 +26,6 @@
|
||||
|
||||
#include "vp9.h"
|
||||
|
||||
enum BlockPartition {
|
||||
PARTITION_NONE, // [ ] <-.
|
||||
PARTITION_H, // [-] |
|
||||
PARTITION_V, // [|] |
|
||||
PARTITION_SPLIT, // [+] --'
|
||||
};
|
||||
|
||||
static const int8_t vp9_partition_tree[3][2] = {
|
||||
{ -PARTITION_NONE, 1 }, // '0'
|
||||
{ -PARTITION_H, 2 }, // '10'
|
||||
@ -212,13 +205,6 @@ static const uint8_t vp9_default_kf_uvmode_probs[10][9] = {
|
||||
{ 102, 19, 66, 162, 182, 122, 35, 59, 128 } /* y = tm */
|
||||
};
|
||||
|
||||
enum InterPredMode {
|
||||
NEARESTMV = 10,
|
||||
NEARMV = 11,
|
||||
ZEROMV = 12,
|
||||
NEWMV = 13,
|
||||
};
|
||||
|
||||
static const int8_t vp9_inter_mode_tree[3][2] = {
|
||||
{ -ZEROMV, 1 }, // '0'
|
||||
{ -NEARESTMV, 2 }, // '10'
|
||||
|
Loading…
Reference in New Issue
Block a user