diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-04-02 22:55:30 +0300 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-04-08 02:27:33 +0300 |
commit | a66121d964558348ffcc2fb820853c9381a6a8d2 (patch) | |
tree | 867d1d0e9d7e7625e1def4dab90e5cca478161c2 /libavcodec/opus_rc.h | |
parent | 6d0b62a12b46edbb3d141c356a7bcf7856a1e351 (diff) |
opus_rc: add macros for checkpoint rollback
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Diffstat (limited to 'libavcodec/opus_rc.h')
-rw-r--r-- | libavcodec/opus_rc.h | 14 |
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 */ |