2
* This file is part of Libav.
4
* Libav is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* Libav is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with Libav; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22
#include "libavutil/mem.h"
29
#define SIZE (COUNT * 4)
38
temp = av_malloc(SIZE);
42
init_put_bits(&pb, temp, SIZE);
43
for (i = 0; i < COUNT; i++)
44
set_ue_golomb(&pb, i);
47
init_get_bits(&gb, temp, 8 * SIZE);
48
for (i = 0; i < COUNT; i++) {
49
int j, s = show_bits(&gb, 25);
51
j = get_ue_golomb(&gb);
53
fprintf(stderr, "get_ue_golomb: expected %d, got %d. bits: %7x\n",
59
#define EXTEND(i) (i << 3 | i & 7)
60
init_put_bits(&pb, temp, SIZE);
61
for (i = 0; i < COUNT; i++)
62
set_ue_golomb(&pb, EXTEND(i));
65
init_get_bits(&gb, temp, 8 * SIZE);
66
for (i = 0; i < COUNT; i++) {
67
int j, s = show_bits_long(&gb, 32);
69
j = get_ue_golomb_long(&gb);
71
fprintf(stderr, "get_ue_golomb_long: expected %d, got %d. "
72
"bits: %8x\n", EXTEND(i), j, s);
77
init_put_bits(&pb, temp, SIZE);
78
for (i = 0; i < COUNT; i++)
79
set_se_golomb(&pb, i - COUNT / 2);
82
init_get_bits(&gb, temp, 8 * SIZE);
83
for (i = 0; i < COUNT; i++) {
84
int j, s = show_bits(&gb, 25);
86
j = get_se_golomb(&gb);
87
if (j != i - COUNT / 2) {
88
fprintf(stderr, "get_se_golomb: expected %d, got %d. bits: %7x\n",