24 #define BITSTREAM_READER_LE
102 void *
data,
int *got_frame,
106 int buf_size = avpkt->
size;
112 uint8_t *old_y, *old_cb, *old_cr,
113 *new_y, *new_cb, *new_cr;
114 unsigned old_y_stride, old_cb_stride, old_cr_stride,
115 new_y_stride, new_cb_stride, new_cr_stride;
116 unsigned total_blocks = avctx->
width * avctx->
height / 4,
117 block_index, row_index = 0;
118 unsigned y[4] = {0},
cb = 16,
cr = 16;
139 new_y = new_frame.
data[0];
140 new_cb = new_frame.
data[1];
141 new_cr = new_frame.
data[2];
142 new_y_stride = new_frame.
linesize[0];
143 new_cb_stride = new_frame.
linesize[1];
144 new_cr_stride = new_frame.
linesize[2];
154 new_y_stride, new_cb_stride);
156 for (block_index = 0; block_index < total_blocks; block_index++) {
166 y[2] = old_y[old_y_stride] / 4;
167 y[3] = old_y[old_y_stride+1] / 4;
172 y_base=y[0] = y[1] = y[2] = y[3] = 0;
178 static const int8_t sign_table[64][4] =
236 unsigned sign_selector =
get_bits(&gb, 6);
237 unsigned difference_selector =
get_bits(&gb, 2);
239 for (i = 0; i < 4; i++) {
240 y[i] = av_clip((
int)y_base + offset_table[difference_selector] *
241 sign_table[sign_selector][i], 0, 63);
247 unsigned adjust_index =
get_bits(&gb, 3);
248 static const int8_t adjust[] = {-4, -3, -2, -1, 1, 2, 3, 4};
249 y_base = (y_base + adjust[adjust_index]) & 63;
251 for (i = 0; i < 4; i++)
260 unsigned adjust_index =
get_bits(&gb, 3);
261 static const int8_t adjust[2][8] =
262 { { 1, 1, 0, -1, -1, -1, 0, 1 },
263 { 0, 1, 1, 1, 0, -1, -1, -1 } };
264 cb = (
cb + adjust[0][adjust_index]) & 31;
265 cr = (
cr + adjust[1][adjust_index]) & 31;
273 new_y[new_y_stride] = y[2] * 4;
274 new_y[new_y_stride + 1] = y[3] * 4;
279 old_y += 2, old_cb++, old_cr++;
280 new_y += 2, new_cb++, new_cr++;
282 if (avctx->
width / 2 == row_index) {
285 old_y += old_y_stride * 2 - avctx->
width;
286 old_cb += old_cb_stride - avctx->
width / 2;
287 old_cr += old_cr_stride - avctx->
width / 2;
289 new_y += new_y_stride * 2 - avctx->
width;
290 new_cb += new_cb_stride - avctx->
width / 2;
291 new_cr += new_cr_stride - avctx->
width / 2;
298 "Escape sizes: %i, %i\n",