From 5512dbb889647c35ef229d957f3e6570a916f0bc Mon Sep 17 00:00:00 2001 From: Jingning Han Date: Wed, 22 Aug 2018 12:03:39 -0700 Subject: [PATCH] Add element stack operations for arf index control Support arf index stack operation. Change-Id: Ifcf521ffc95a520344824ffc159883b71e8fc7a0 --- vp9/encoder/vp9_encoder.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index c740eada5..9adcb4522 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -818,6 +818,22 @@ int vp9_set_size_literal(VP9_COMP *cpi, unsigned int width, void vp9_set_svc(VP9_COMP *cpi, int use_svc); +static INLINE int stack_pop(int *stack, int stack_size) { + int idx; + const int r = stack[0]; + for (idx = 1; idx < stack_size; ++idx) stack[idx - 1] = stack[idx]; + + return r; +} + +static INLINE int stack_top(const int *stack) { return stack[0]; } + +static INLINE void stack_push(int *stack, int new_item, int stack_size) { + int idx; + for (idx = stack_size; idx > 0; --idx) stack[idx] = stack[idx - 1]; + stack[0] = new_item; +} + int vp9_get_quantizer(struct VP9_COMP *cpi); static INLINE int frame_is_kf_gf_arf(const VP9_COMP *cpi) { -- 2.40.0