25 #define BITSTREAM_READER_LE
101 static const int8_t
luma_adjust[] = { -4, -3, -2, -1, 1, 2, 3, 4 };
104 { 1, 1, 0, -1, -1, -1, 0, 1 },
105 { 0, 1, 1, 1, 0, -1, -1, -1 }
109 20, 28, 36, 44, 52, 60, 68, 76,
110 84, 92, 100, 106, 112, 116, 120, 124,
111 128, 132, 136, 140, 144, 150, 156, 164,
112 172, 180, 188, 196, 204, 212, 220, 228
122 "Dimensions should be a multiple of two.\n");
195 int buf_size = avpkt->
size;
201 uint8_t *old_y, *old_cb, *old_cr,
202 *new_y, *new_cb, *new_cr;
204 unsigned old_y_stride, old_cb_stride, old_cr_stride,
205 new_y_stride, new_cb_stride, new_cr_stride;
206 unsigned total_blocks = avctx->
width * avctx->
height / 4,
207 block_index, block_x = 0;
208 unsigned y[4] = { 0 },
cb = 0x10,
cr = 0x10;
209 int skip = -1, y_avg = 0, i, j;
213 if (buf_size <= 16) {
236 for (block_index = 0; block_index < total_blocks; block_index++) {
249 y[2] = old_y[old_y_stride];
250 y[3] = old_y[old_y_stride + 1];
256 unsigned sign_selector =
get_bits(&gb, 6);
257 unsigned difference_selector =
get_bits(&gb, 2);
259 for (i = 0; i < 4; i++) {
260 y[i] = av_clip(y_avg +
offset_table[difference_selector] *
267 unsigned adjust_index =
get_bits(&gb, 3);
270 for (i = 0; i < 4; i++)
279 unsigned adjust_index =
get_bits(&gb, 3);
289 new_y[new_y_stride] = y[2];
290 new_y[new_y_stride + 1] = y[3];
301 if (block_x * 2 == avctx->
width) {
303 old_y += old_y_stride * 2 - avctx->
width;
304 old_cb += old_cb_stride - avctx->
width / 2;
305 old_cr += old_cr_stride - avctx->
width / 2;
306 new_y += new_y_stride * 2 - avctx->
width;
307 new_cb += new_cb_stride - avctx->
width / 2;
308 new_cr += new_cr_stride - avctx->
width / 2;
320 for (j = 0; j < avctx->
height; j++) {
321 for (i = 0; i < avctx->
width; i++)
322 dstY[i] = new_y[i] << 2;
324 new_y += new_y_stride;
326 for (j = 0; j < avctx->
height / 2; j++) {
327 for (i = 0; i < avctx->
width / 2; i++) {
333 new_cb += new_cb_stride;
334 new_cr += new_cr_stride;
337 av_dlog(avctx,
"Frame data: provided %d bytes, used %d bytes\n",