mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-14 00:58:38 +02:00
Slightly simplify first part of ipvideo_decode_block_opcode_0xA,
hopefully allows for further simplifications in the future. Originally committed as revision 18280 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
f938cbf984
commit
5e8b83ac3b
@ -399,12 +399,10 @@ static int ipvideo_decode_block_opcode_0x9(IpvideoContext *s)
|
|||||||
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
|
static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
unsigned char P[16];
|
unsigned char P[8];
|
||||||
unsigned char B[16];
|
unsigned char B[16];
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int index;
|
|
||||||
int split;
|
int split;
|
||||||
int lower_half;
|
|
||||||
|
|
||||||
/* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
|
/* 4-color encoding for each 4x4 quadrant, or 4-color encoding on
|
||||||
* either top and bottom or left and right halves */
|
* either top and bottom or left and right halves */
|
||||||
@ -417,28 +415,23 @@ static int ipvideo_decode_block_opcode_0xA(IpvideoContext *s)
|
|||||||
|
|
||||||
/* 4-color encoding for each quadrant; need 28 more bytes */
|
/* 4-color encoding for each quadrant; need 28 more bytes */
|
||||||
CHECK_STREAM_PTR(28);
|
CHECK_STREAM_PTR(28);
|
||||||
|
s->stream_ptr -= 4;
|
||||||
|
|
||||||
memcpy(B, s->stream_ptr, 4);
|
for (y = 0; y < 16; y++) {
|
||||||
s->stream_ptr += 4;
|
// new values for each 4x4 block
|
||||||
for (y = 4; y < 16; y += 4) {
|
if (!(y & 3)) {
|
||||||
memcpy(P + y, s->stream_ptr, 4);
|
memcpy(P, s->stream_ptr, 4);
|
||||||
s->stream_ptr += 4;
|
s->stream_ptr += 4;
|
||||||
memcpy(B + y, s->stream_ptr, 4);
|
flags = bytestream_get_le32(&s->stream_ptr);
|
||||||
s->stream_ptr += 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (y = 0; y < 8; y++) {
|
|
||||||
|
|
||||||
lower_half = (y >= 4) ? 4 : 0;
|
|
||||||
flags = (B[y + 8] << 8) | B[y];
|
|
||||||
|
|
||||||
for (x = 0; x < 8; x++, flags >>= 2) {
|
|
||||||
split = (x >= 4) ? 8 : 0;
|
|
||||||
index = split + lower_half + (flags & 0x03);
|
|
||||||
*s->pixel_ptr++ = P[index];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s->pixel_ptr += s->line_inc;
|
for (x = 0; x < 4; x++, flags >>= 2) {
|
||||||
|
*s->pixel_ptr++ = P[flags & 0x03];
|
||||||
|
}
|
||||||
|
|
||||||
|
s->pixel_ptr += s->stride - 4;
|
||||||
|
// switch to right half
|
||||||
|
if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user