25 #define BITSTREAM_READER_LE
69 ((unsigned)avctx->
height / 8);
79 for (i = 0; i < 3; i++)
105 for (i = 0; i <
size; i++) {
106 unsigned mask_bits =
get_bits(gb, 4);
110 for (j = 0; j < 4; j++) {
111 if (mask_bits & (1 << j))
132 if (value != (1 + ((1 << 3) - 1)))
136 if (value != (1 + ((1 << 3) - 1)) + ((1 << 7) - 1))
143 int* codebook_index,
int superblock_index)
147 unsigned block_index,
depth;
150 static const char transitions[3][2] = { {2, 1}, {0, 2}, {1, 0} };
151 *codebook_index = transitions[*codebook_index][
get_bits1(gb)];
159 block_index = depth ?
get_bits(gb, depth) : 0;
161 if (*codebook_index == 1) {
175 uint32_t *
dst = sb->
pixels32 + index + (index & -4);
183 uint16_t* src,
unsigned src_stride)
187 for (y = 0; y < 8; y++)
188 memcpy(dest + y * dest_stride, src + y * src_stride,
189 sizeof(uint16_t) * 8);
191 for (y = 0; y < 8; y++)
192 memset(dest + y * dest_stride, 0,
sizeof(uint16_t) * 8);
196 0x4, 0x8, 0x40, 0x80,
197 0x100, 0x200, 0x1000, 0x2000,
198 0x400, 0x800, 0x4000, 0x8000};
201 void *
data,
int *got_frame,
205 int buf_size = avpkt->
size;
212 unsigned superblock_index, cb_index = 1,
213 superblock_col_index = 0,
214 superblocks_per_row = avctx->
width / 8, skip = -1;
216 uint16_t* old_frame_data, *new_frame_data;
217 unsigned old_stride, new_stride;
234 if (!(frame_flags & 0x114) || !(frame_flags & 0x7800000)) {
243 for (i = 0; i < 3; i++) {
244 if (frame_flags & (1 << (17 + i))) {
245 unsigned cb_depth, cb_size;
250 cb_depth =
av_log2(cb_size - 1) + 1;
256 cb_size = 1 << cb_depth;
277 new_frame_data = (uint16_t*)new_frame.
data[0];
278 new_stride = new_frame.
linesize[0] / 2;
279 old_frame_data = (uint16_t*)s->
frame.
data[0];
283 superblock_index++) {
286 unsigned multi_mask = 0;
296 old_frame_data, old_stride);
299 old_frame_data, old_stride);
306 for (i = 0; i < 16; i++) {
314 unsigned inv_mask =
get_bits(&gb, 4);
315 for (i = 0; i < 4; i++) {
316 if (inv_mask & (1 << i)) {
317 multi_mask ^= 0xF << i*4;
319 multi_mask ^=
get_bits(&gb, 4) << i*4;
323 for (i = 0; i < 16; i++) {
332 }
else if (frame_flags & (1 << 16)) {
342 superblock_col_index++;
346 if (superblock_col_index == superblocks_per_row) {
347 new_frame_data += new_stride * 8 - superblocks_per_row * 8;
349 old_frame_data += old_stride * 8 - superblocks_per_row * 8;
350 superblock_col_index = 0;
356 "Escape sizes: %i, %i, %i\n",