Commit 32deea87 authored by Jun Zhao's avatar Jun Zhao Committed by Michael Niedermayer

lavc/tests/golomb: Add unit test for set_ue_golomb_long.

Add unit test for set_ue_golomb_long.
Signed-off-by: 's avatarJun Zhao <jun.zhao@intel.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e61abe2d
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include "libavutil/internal.h"
#include "libavutil/mem.h" #include "libavutil/mem.h"
#include "libavcodec/get_bits.h" #include "libavcodec/get_bits.h"
...@@ -76,6 +77,24 @@ int main(void) ...@@ -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); init_put_bits(&pb, temp, SIZE);
for (i = 0; i < COUNT; i++) for (i = 0; i < COUNT; i++)
set_se_golomb(&pb, i - COUNT / 2); set_se_golomb(&pb, i - COUNT / 2);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment