27 #define BITSTREAM_READER_LE
90 #define DEQUANT(val, q) ((q * val + 0x80) >> 8)
91 #define DCT1D(d0, d1, d2, d3, s0, s1, s2, s3, OP) \
92 OP(d0, 5 * ((s0) + (s1) + (s2)) + 2 * (s3)); \
93 OP(d1, 5 * ((s0) - (s2) - (s3)) + 2 * (s1)); \
94 OP(d2, 5 * ((s0) - (s2) + (s3)) - 2 * (s1)); \
95 OP(d3, 5 * ((s0) - (s1) + (s2)) - 2 * (s3)); \
97 #define COL_OP(a, b) a = b
98 #define ROW_OP(a, b) a = ((b) + 0x20) >> 6
106 for (i = 0; i < 4; i++) {
107 t0 =
DEQUANT(q[0 + (i & 1)], in[0 * 4 + i]);
108 t1 =
DEQUANT(q[1 + (i & 1)], in[1 * 4 + i]);
109 t2 =
DEQUANT(q[0 + (i & 1)], in[2 * 4 + i]);
110 t3 =
DEQUANT(q[1 + (i & 1)], in[3 * 4 + i]);
111 DCT1D(tblk[0 * 4 + i], tblk[1 * 4 + i],
112 tblk[2 * 4 + i], tblk[3 * 4 + i],
115 for (i = 0; i < 4; i++) {
116 DCT1D(dst[0], dst[1], dst[2], dst[3],
117 tblk[i * 4 + 0], tblk[i * 4 + 1],
118 tblk[i * 4 + 2], tblk[i * 4 + 3],
ROW_OP);
127 int prev_dc, dc, nc, ac, bpos, val;
133 for (i = 0; i < 8; i++, dst +=
stride)
134 memset(dst, val, 16);
138 for (i = 0; i < 8; i++) {
139 for (j = 0; j < 16; j++)
148 for (j = 0; j < 2; j++) {
149 for (k = 0; k < 4; k++) {
159 dc = (dc + prev_dc) & 0xFF;
168 memset(c->
block + 1, 0, 15 *
sizeof(*c->
block));
169 for (l = 0; l < nc; l++) {
189 const uint8_t *buf,
int buf_size)
196 for (mb_x = 0; mb_x < c->
mb_width; mb_x++) {
199 if (q == 0 || q == 3)
201 for (i = 0; i < 3; i++) {
217 int buf_size = avpkt->
size;
220 uint32_t frame_type,
size;
221 int i, val,
len, pos = 0;
226 frame_type = bytestream2_get_byte(&gb);
227 if (frame_type > 1) {
240 if (frame_type == 0) {
252 c->
quant[0] = bytestream2_get_byte(&gb);
253 c->
quant[1] = bytestream2_get_byte(&gb);
261 for (i = 0; i < 3; i++) {
268 size = bytestream2_get_le32(&gb);
274 for (i = 0; i <
size; i++) {
275 val = bytestream2_get_byte(&gb);
278 if (pos + len > num_mb) {
292 size = bytestream2_peek_byte(&gb);
294 size = bytestream2_get_byte(&gb) - 1;
296 size = bytestream2_get_le32(&gb) >> 1;