aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-04-02 20:55:30 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-04-08 00:27:33 +0100
commita66121d964558348ffcc2fb820853c9381a6a8d2 (patch)
tree867d1d0e9d7e7625e1def4dab90e5cca478161c2 /libavcodec
parent6d0b62a12b46edbb3d141c356a7bcf7856a1e351 (diff)
downloadffmpeg-a66121d964558348ffcc2fb820853c9381a6a8d2.tar.gz
opus_rc: add macros for checkpoint rollback
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/opus_rc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/opus_rc.h b/libavcodec/opus_rc.h
index 821eeadd6e..627f83229e 100644
--- a/libavcodec/opus_rc.h
+++ b/libavcodec/opus_rc.h
@@ -109,4 +109,18 @@ void ff_opus_rc_dec_raw_init(OpusRangeCoder *rc, const uint8_t *rightend, ui
void ff_opus_rc_enc_end(OpusRangeCoder *rc, uint8_t *dst, int size);
void ff_opus_rc_enc_init(OpusRangeCoder *rc);
+#define OPUS_RC_CHECKPOINT_UPDATE(rc) \
+ rc_rollback_bits = opus_rc_tell_frac(rc); \
+ rc_rollback_ctx = *rc
+
+#define OPUS_RC_CHECKPOINT_SPAWN(rc) \
+ uint32_t rc_rollback_bits = opus_rc_tell_frac(rc); \
+ OpusRangeCoder rc_rollback_ctx = *rc \
+
+#define OPUS_RC_CHECKPOINT_BITS(rc) \
+ (opus_rc_tell_frac(rc) - rc_rollback_bits)
+
+#define OPUS_RC_CHECKPOINT_ROLLBACK(rc) \
+ memcpy(rc, &rc_rollback_ctx, sizeof(OpusRangeCoder)); \
+
#endif /* AVCODEC_OPUS_RC_H */