comparison interplayvideo.c @ 9318:0eedaa9cb71e libavcodec

Slightly simplify ipvideo_decode_block_opcode_0xD
author reimar
date Tue, 31 Mar 2009 19:36:44 +0000
parents 2c06c31c8664
children 44de9c136513
comparison
equal deleted inserted replaced
9317:2c06c31c8664 9318:0eedaa9cb71e
498 } 498 }
499 499
500 static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s) 500 static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s)
501 { 501 {
502 int y; 502 int y;
503 unsigned char P[4]; 503 unsigned char P;
504 unsigned char index = 0;
505 504
506 /* 4-color block encoding: each 4x4 block is a different color */ 505 /* 4-color block encoding: each 4x4 block is a different color */
507 CHECK_STREAM_PTR(4); 506 CHECK_STREAM_PTR(4);
508 507
509 memcpy(P, s->stream_ptr, 4); 508 for (y = 0; y < 16; y++) {
510 s->stream_ptr += 4; 509 if (!(y & 3)) // start of block
511 510 P = *s->stream_ptr++;
512 for (y = 0; y < 8; y++) { 511 memset(s->pixel_ptr, P, 4);
513 if (y < 4)
514 index = 0;
515 else
516 index = 2;
517
518 memset(s->pixel_ptr , P[index ], 4);
519 memset(s->pixel_ptr + 4, P[index + 1], 4);
520 s->pixel_ptr += s->stride; 512 s->pixel_ptr += s->stride;
513 // switch to right half
514 if (y == 7) s->pixel_ptr -= 8 * s->stride - 4;
521 } 515 }
522 516
523 /* report success */ 517 /* report success */
524 return 0; 518 return 0;
525 } 519 }