mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
lavc/vp9: consistent use of typedef instead of struct
This commit is contained in:
parent
875f695576
commit
37814a21cb
@ -55,13 +55,13 @@ static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
sz = 64 * s->sb_cols * s->sb_rows;
|
sz = 64 * s->sb_cols * s->sb_rows;
|
||||||
f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair)));
|
f->extradata = av_buffer_allocz(sz * (1 + sizeof(VP9mvrefPair)));
|
||||||
if (!f->extradata) {
|
if (!f->extradata) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
f->segmentation_map = f->extradata->data;
|
f->segmentation_map = f->extradata->data;
|
||||||
f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
|
f->mv = (VP9mvrefPair *) (f->extradata->data + sz);
|
||||||
|
|
||||||
if (avctx->hwaccel) {
|
if (avctx->hwaccel) {
|
||||||
const AVHWAccel *hwaccel = avctx->hwaccel;
|
const AVHWAccel *hwaccel = avctx->hwaccel;
|
||||||
@ -194,7 +194,7 @@ static int update_size(AVCodecContext *avctx, int w, int h)
|
|||||||
assign(s->above_comp_ctx, uint8_t *, 8);
|
assign(s->above_comp_ctx, uint8_t *, 8);
|
||||||
assign(s->above_ref_ctx, uint8_t *, 8);
|
assign(s->above_ref_ctx, uint8_t *, 8);
|
||||||
assign(s->above_filter_ctx, uint8_t *, 8);
|
assign(s->above_filter_ctx, uint8_t *, 8);
|
||||||
assign(s->lflvl, struct VP9Filter *, 1);
|
assign(s->lflvl, VP9Filter *, 1);
|
||||||
#undef assign
|
#undef assign
|
||||||
|
|
||||||
// these will be re-allocated a little later
|
// these will be re-allocated a little later
|
||||||
@ -924,7 +924,7 @@ static int decode_frame_header(AVCodecContext *avctx,
|
|||||||
return (data2 - data) + size2;
|
return (data2 - data) + size2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_sb(AVCodecContext *avctx, int row, int col, struct VP9Filter *lflvl,
|
static void decode_sb(AVCodecContext *avctx, int row, int col, VP9Filter *lflvl,
|
||||||
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
|
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
|
||||||
{
|
{
|
||||||
VP9Context *s = avctx->priv_data;
|
VP9Context *s = avctx->priv_data;
|
||||||
@ -1003,7 +1003,7 @@ static void decode_sb(AVCodecContext *avctx, int row, int col, struct VP9Filter
|
|||||||
s->counts.partition[bl][c][bp]++;
|
s->counts.partition[bl][c][bp]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode_sb_mem(AVCodecContext *avctx, int row, int col, struct VP9Filter *lflvl,
|
static void decode_sb_mem(AVCodecContext *avctx, int row, int col, VP9Filter *lflvl,
|
||||||
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
|
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
|
||||||
{
|
{
|
||||||
VP9Context *s = avctx->priv_data;
|
VP9Context *s = avctx->priv_data;
|
||||||
@ -1204,7 +1204,7 @@ static av_always_inline void filter_plane_rows(VP9Context *s, int row, int ss_h,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void loopfilter_sb(AVCodecContext *avctx, struct VP9Filter *lflvl,
|
static void loopfilter_sb(AVCodecContext *avctx, VP9Filter *lflvl,
|
||||||
int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
|
int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
|
||||||
{
|
{
|
||||||
VP9Context *s = avctx->priv_data;
|
VP9Context *s = avctx->priv_data;
|
||||||
@ -1449,7 +1449,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
|||||||
|
|
||||||
for (row = s->tile_row_start; row < s->tile_row_end;
|
for (row = s->tile_row_start; row < s->tile_row_end;
|
||||||
row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
|
row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
|
||||||
struct VP9Filter *lflvl_ptr = s->lflvl;
|
VP9Filter *lflvl_ptr = s->lflvl;
|
||||||
ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
|
ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
|
||||||
|
|
||||||
for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
|
for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
|
||||||
|
@ -248,23 +248,22 @@ typedef struct VP9DSPContext {
|
|||||||
vp9_scaled_mc_func smc[5][4][2];
|
vp9_scaled_mc_func smc[5][4][2];
|
||||||
} VP9DSPContext;
|
} VP9DSPContext;
|
||||||
|
|
||||||
|
typedef struct VP9mvrefPair {
|
||||||
struct VP9mvrefPair {
|
|
||||||
VP56mv mv[2];
|
VP56mv mv[2];
|
||||||
int8_t ref[2];
|
int8_t ref[2];
|
||||||
};
|
} VP9mvrefPair;
|
||||||
|
|
||||||
struct VP9Filter {
|
typedef struct VP9Filter {
|
||||||
uint8_t level[8 * 8];
|
uint8_t level[8 * 8];
|
||||||
uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */]
|
uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */]
|
||||||
[8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */];
|
[8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */];
|
||||||
};
|
} VP9Filter;
|
||||||
|
|
||||||
typedef struct VP9Frame {
|
typedef struct VP9Frame {
|
||||||
ThreadFrame tf;
|
ThreadFrame tf;
|
||||||
AVBufferRef *extradata;
|
AVBufferRef *extradata;
|
||||||
uint8_t *segmentation_map;
|
uint8_t *segmentation_map;
|
||||||
struct VP9mvrefPair *mv;
|
VP9mvrefPair *mv;
|
||||||
int uses_2pass;
|
int uses_2pass;
|
||||||
|
|
||||||
AVBufferRef *hwaccel_priv_buf;
|
AVBufferRef *hwaccel_priv_buf;
|
||||||
@ -454,7 +453,7 @@ typedef struct VP9Context {
|
|||||||
|
|
||||||
// whole-frame cache
|
// whole-frame cache
|
||||||
uint8_t *intra_pred_data[3];
|
uint8_t *intra_pred_data[3];
|
||||||
struct VP9Filter *lflvl;
|
VP9Filter *lflvl;
|
||||||
DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135 * 144 * 2];
|
DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135 * 144 * 2];
|
||||||
|
|
||||||
// block reconstruction intermediates
|
// block reconstruction intermediates
|
||||||
@ -486,7 +485,7 @@ void ff_vp9_fill_mv(VP9Context *s, VP56mv *mv, int mode, int sb);
|
|||||||
void ff_vp9_adapt_probs(VP9Context *s);
|
void ff_vp9_adapt_probs(VP9Context *s);
|
||||||
|
|
||||||
void ff_vp9_decode_block(AVCodecContext *ctx, int row, int col,
|
void ff_vp9_decode_block(AVCodecContext *ctx, int row, int col,
|
||||||
struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
|
VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
|
||||||
enum BlockLevel bl, enum BlockPartition bp);
|
enum BlockLevel bl, enum BlockPartition bp);
|
||||||
|
|
||||||
#endif /* AVCODEC_VP9_H */
|
#endif /* AVCODEC_VP9_H */
|
||||||
|
@ -785,7 +785,7 @@ static void decode_mode(AVCodecContext *avctx)
|
|||||||
// FIXME kinda ugly
|
// FIXME kinda ugly
|
||||||
for (y = 0; y < h4; y++) {
|
for (y = 0; y < h4; y++) {
|
||||||
int x, o = (row + y) * s->sb_cols * 8 + col;
|
int x, o = (row + y) * s->sb_cols * 8 + col;
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[o];
|
VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[o];
|
||||||
|
|
||||||
if (b->intra) {
|
if (b->intra) {
|
||||||
for (x = 0; x < w4; x++) {
|
for (x = 0; x < w4; x++) {
|
||||||
@ -1883,7 +1883,7 @@ static av_always_inline void mask_edges(uint8_t (*mask)[8][4], int ss_h, int ss_
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ff_vp9_decode_block(AVCodecContext *avctx, int row, int col,
|
void ff_vp9_decode_block(AVCodecContext *avctx, int row, int col,
|
||||||
struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
|
VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
|
||||||
enum BlockLevel bl, enum BlockPartition bp)
|
enum BlockLevel bl, enum BlockPartition bp)
|
||||||
{
|
{
|
||||||
VP9Context *s = avctx->priv_data;
|
VP9Context *s = avctx->priv_data;
|
||||||
|
@ -135,14 +135,14 @@ static void find_ref_mvs(VP9Context *s,
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
if (row > 0) {
|
if (row > 0) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[(row - 1) * s->sb_cols * 8 + col];
|
VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[(row - 1) * s->sb_cols * 8 + col];
|
||||||
if (mv->ref[0] == ref)
|
if (mv->ref[0] == ref)
|
||||||
RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][0]);
|
RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][0]);
|
||||||
else if (mv->ref[1] == ref)
|
else if (mv->ref[1] == ref)
|
||||||
RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][1]);
|
RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][1]);
|
||||||
}
|
}
|
||||||
if (col > s->tile_col_start) {
|
if (col > s->tile_col_start) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[row * s->sb_cols * 8 + col - 1];
|
VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[row * s->sb_cols * 8 + col - 1];
|
||||||
if (mv->ref[0] == ref)
|
if (mv->ref[0] == ref)
|
||||||
RETURN_MV(s->left_mv_ctx[2 * row7 + (sb >> 1)][0]);
|
RETURN_MV(s->left_mv_ctx[2 * row7 + (sb >> 1)][0]);
|
||||||
else if (mv->ref[1] == ref)
|
else if (mv->ref[1] == ref)
|
||||||
@ -159,7 +159,7 @@ static void find_ref_mvs(VP9Context *s,
|
|||||||
|
|
||||||
if (c >= s->tile_col_start && c < s->cols &&
|
if (c >= s->tile_col_start && c < s->cols &&
|
||||||
r >= 0 && r < s->rows) {
|
r >= 0 && r < s->rows) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
|
VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
|
||||||
|
|
||||||
if (mv->ref[0] == ref)
|
if (mv->ref[0] == ref)
|
||||||
RETURN_MV(mv->mv[0]);
|
RETURN_MV(mv->mv[0]);
|
||||||
@ -170,7 +170,7 @@ static void find_ref_mvs(VP9Context *s,
|
|||||||
|
|
||||||
// MV at this position in previous frame, using same reference frame
|
// MV at this position in previous frame, using same reference frame
|
||||||
if (s->s.h.use_last_frame_mvs) {
|
if (s->s.h.use_last_frame_mvs) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
|
VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
|
||||||
|
|
||||||
if (!s->s.frames[REF_FRAME_MVPAIR].uses_2pass)
|
if (!s->s.frames[REF_FRAME_MVPAIR].uses_2pass)
|
||||||
ff_thread_await_progress(&s->s.frames[REF_FRAME_MVPAIR].tf, row >> 3, 0);
|
ff_thread_await_progress(&s->s.frames[REF_FRAME_MVPAIR].tf, row >> 3, 0);
|
||||||
@ -195,7 +195,7 @@ static void find_ref_mvs(VP9Context *s,
|
|||||||
int c = p[i][0] + col, r = p[i][1] + row;
|
int c = p[i][0] + col, r = p[i][1] + row;
|
||||||
|
|
||||||
if (c >= s->tile_col_start && c < s->cols && r >= 0 && r < s->rows) {
|
if (c >= s->tile_col_start && c < s->cols && r >= 0 && r < s->rows) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
|
VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
|
||||||
|
|
||||||
if (mv->ref[0] != ref && mv->ref[0] >= 0)
|
if (mv->ref[0] != ref && mv->ref[0] >= 0)
|
||||||
RETURN_SCALE_MV(mv->mv[0],
|
RETURN_SCALE_MV(mv->mv[0],
|
||||||
@ -211,7 +211,7 @@ static void find_ref_mvs(VP9Context *s,
|
|||||||
|
|
||||||
// MV at this position in previous frame, using different reference frame
|
// MV at this position in previous frame, using different reference frame
|
||||||
if (s->s.h.use_last_frame_mvs) {
|
if (s->s.h.use_last_frame_mvs) {
|
||||||
struct VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
|
VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
|
||||||
|
|
||||||
// no need to await_progress, because we already did that above
|
// no need to await_progress, because we already did that above
|
||||||
if (mv->ref[0] != ref && mv->ref[0] >= 0)
|
if (mv->ref[0] != ref && mv->ref[0] >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user