[FFmpeg-cvslog] lavc/tests/golomb: Add unit test for set_ue_golomb_long.
Jun Zhao
git at videolan.org
Sat Jun 24 23:18:52 EEST 2017
ffmpeg | branch: master | Jun Zhao <jun.zhao at intel.com> | Wed Jun 14 10:42:36 2017 +0800| [32deea87c1d60c01a99786b7206b54efab6d8f64] | committer: Michael Niedermayer
lavc/tests/golomb: Add unit test for set_ue_golomb_long.
Add unit test for set_ue_golomb_long.
Signed-off-by: Jun Zhao <jun.zhao at intel.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32deea87c1d60c01a99786b7206b54efab6d8f64
---
libavcodec/tests/golomb.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/libavcodec/tests/golomb.c b/libavcodec/tests/golomb.c
index 965367b7be..85b8a9390b 100644
--- a/libavcodec/tests/golomb.c
+++ b/libavcodec/tests/golomb.c
@@ -21,6 +21,7 @@
#include <stdint.h>
#include <stdio.h>
+#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavcodec/get_bits.h"
@@ -76,6 +77,24 @@ int main(void)
}
}
+#define EXTEND_L(i) ((i) << 4 | (i) & 15)
+ init_put_bits(&pb, temp, SIZE);
+ for (i = 0; i < COUNT; i++)
+ set_ue_golomb_long(&pb, EXTEND_L(i));
+ flush_put_bits(&pb);
+
+ init_get_bits(&gb, temp, 8 * SIZE);
+ for (i = 0; i < COUNT; i++) {
+ int j, s = show_bits_long(&gb, 32);
+
+ j = get_ue_golomb_long(&gb);
+ if (j != EXTEND_L(i)) {
+ fprintf(stderr, "get_ue_golomb_long: expected %d, got %d. "
+ "bits: %8x\n", EXTEND_L(i), j, s);
+ ret = 1;
+ }
+ }
+
init_put_bits(&pb, temp, SIZE);
for (i = 0; i < COUNT; i++)
set_se_golomb(&pb, i - COUNT / 2);
More information about the ffmpeg-cvslog
mailing list