[FFmpeg-cvslog] opus_rc: add macros for checkpoint rollback
Rostislav Pehlivanov
git at videolan.org
Sat Apr 8 02:57:25 EEST 2017
ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Sun Apr 2 20:55:30 2017 +0100| [a66121d964558348ffcc2fb820853c9381a6a8d2] | committer: Rostislav Pehlivanov
opus_rc: add macros for checkpoint rollback
Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a66121d964558348ffcc2fb820853c9381a6a8d2
---
libavcodec/opus_rc.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/libavcodec/opus_rc.h b/libavcodec/opus_rc.h
index 821eead..627f832 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 */
More information about the ffmpeg-cvslog
mailing list