Mercurial > libavcodec.hg
comparison truemotion1.c @ 2979:bfabfdf9ce55 libavcodec
COSMETICS: tabs --> spaces, some prettyprinting
author | diego |
---|---|
date | Thu, 22 Dec 2005 01:10:11 +0000 |
parents | ef2149182f1c |
children | 0b546eab515d |
comparison
equal
deleted
inserted
replaced
2978:403183bbb505 | 2979:bfabfdf9ce55 |
---|---|
332 s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3; | 332 s->mb_change_bits_row_size = ((s->avctx->width >> 2) + 7) >> 3; |
333 | 333 |
334 header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; | 334 header.header_size = ((s->buf[0] >> 5) | (s->buf[0] << 3)) & 0x7f; |
335 if (s->buf[0] < 0x10) | 335 if (s->buf[0] < 0x10) |
336 { | 336 { |
337 av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]); | 337 av_log(s->avctx, AV_LOG_ERROR, "invalid header size (%d)\n", s->buf[0]); |
338 return -1; | 338 return -1; |
339 } | 339 } |
340 | 340 |
341 /* unscramble the header bytes with a XOR operation */ | 341 /* unscramble the header bytes with a XOR operation */ |
342 memset(header_buffer, 0, 128); | 342 memset(header_buffer, 0, 128); |
343 for (i = 1; i < header.header_size; i++) | 343 for (i = 1; i < header.header_size; i++) |
344 header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; | 344 header_buffer[i - 1] = s->buf[i] ^ s->buf[i + 1]; |
345 | 345 |
346 header.compression = header_buffer[0]; | 346 header.compression = header_buffer[0]; |
347 header.deltaset = header_buffer[1]; | 347 header.deltaset = header_buffer[1]; |
348 header.vectable = header_buffer[2]; | 348 header.vectable = header_buffer[2]; |
349 header.ysize = LE_16(&header_buffer[3]); | 349 header.ysize = LE_16(&header_buffer[3]); |
369 s->flags = FLAG_KEYFRAME; | 369 s->flags = FLAG_KEYFRAME; |
370 } else /* Version 1 */ | 370 } else /* Version 1 */ |
371 s->flags = FLAG_KEYFRAME; | 371 s->flags = FLAG_KEYFRAME; |
372 | 372 |
373 if (s->flags & FLAG_SPRITE) { | 373 if (s->flags & FLAG_SPRITE) { |
374 av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n"); | 374 av_log(s->avctx, AV_LOG_INFO, "SPRITE frame found, please report the sample to the developers\n"); |
375 s->w = header.width; | 375 s->w = header.width; |
376 s->h = header.height; | 376 s->h = header.height; |
377 s->x = header.xoffset; | 377 s->x = header.xoffset; |
378 s->y = header.yoffset; | 378 s->y = header.yoffset; |
379 } else { | 379 } else { |
380 s->w = header.xsize; | 380 s->w = header.xsize; |
381 s->h = header.ysize; | 381 s->h = header.ysize; |
382 if (header.header_type < 2) { | 382 if (header.header_type < 2) { |
383 if ((s->w < 213) && (s->h >= 176)) | 383 if ((s->w < 213) && (s->h >= 176)) |
384 { | 384 { |
385 s->flags |= FLAG_INTERPOLATED; | 385 s->flags |= FLAG_INTERPOLATED; |
386 av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n"); | 386 av_log(s->avctx, AV_LOG_INFO, "INTERPOLATION selected, please report the sample to the developers\n"); |
387 } | 387 } |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 if (header.compression > 17) { | 391 if (header.compression > 17) { |
392 av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression); | 392 av_log(s->avctx, AV_LOG_ERROR, "invalid compression type (%d)\n", header.compression); |
410 | 410 |
411 // FIXME: where to place this ?!?! | 411 // FIXME: where to place this ?!?! |
412 if (compression_types[header.compression].algorithm == ALGO_RGB24H) | 412 if (compression_types[header.compression].algorithm == ALGO_RGB24H) |
413 s->avctx->pix_fmt = PIX_FMT_RGBA32; | 413 s->avctx->pix_fmt = PIX_FMT_RGBA32; |
414 else | 414 else |
415 s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported aswell | 415 s->avctx->pix_fmt = PIX_FMT_RGB555; // RGB565 is supported aswell |
416 | 416 |
417 if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) | 417 if ((header.deltaset != s->last_deltaset) || (header.vectable != s->last_vectable)) |
418 { | 418 { |
419 if (compression_types[header.compression].algorithm == ALGO_RGB24H) | 419 if (compression_types[header.compression].algorithm == ALGO_RGB24H) |
420 gen_vector_table24(s, sel_vector_table); | 420 gen_vector_table24(s, sel_vector_table); |
421 else | 421 else |
422 if (s->avctx->pix_fmt == PIX_FMT_RGB555) | 422 if (s->avctx->pix_fmt == PIX_FMT_RGB555) |
423 gen_vector_table15(s, sel_vector_table); | 423 gen_vector_table15(s, sel_vector_table); |
424 else | 424 else |
425 gen_vector_table16(s, sel_vector_table); | 425 gen_vector_table16(s, sel_vector_table); |
426 } | 426 } |
427 | 427 |
428 /* set up pointers to the other key data chunks */ | 428 /* set up pointers to the other key data chunks */ |
429 s->mb_change_bits = s->buf + header.header_size; | 429 s->mb_change_bits = s->buf + header.header_size; |
443 s->block_width = compression_types[header.compression].block_width; | 443 s->block_width = compression_types[header.compression].block_width; |
444 s->block_height = compression_types[header.compression].block_height; | 444 s->block_height = compression_types[header.compression].block_height; |
445 s->block_type = compression_types[header.compression].block_type; | 445 s->block_type = compression_types[header.compression].block_type; |
446 | 446 |
447 if (s->avctx->debug & FF_DEBUG_PICT_INFO) | 447 if (s->avctx->debug & FF_DEBUG_PICT_INFO) |
448 av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n", | 448 av_log(s->avctx, AV_LOG_INFO, "tables: %d / %d c:%d %dx%d t:%d %s%s%s%s\n", |
449 s->last_deltaset, s->last_vectable, s->compression, s->block_width, | 449 s->last_deltaset, s->last_vectable, s->compression, s->block_width, |
450 s->block_height, s->block_type, | 450 s->block_height, s->block_type, |
451 s->flags & FLAG_KEYFRAME ? " KEY" : "", | 451 s->flags & FLAG_KEYFRAME ? " KEY" : "", |
452 s->flags & FLAG_INTERFRAME ? " INTER" : "", | 452 s->flags & FLAG_INTERFRAME ? " INTER" : "", |
453 s->flags & FLAG_SPRITE ? " SPRITE" : "", | 453 s->flags & FLAG_SPRITE ? " SPRITE" : "", |
454 s->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); | 454 s->flags & FLAG_INTERPOLATED ? " INTERPOL" : ""); |
455 | 455 |
456 return header.header_size; | 456 return header.header_size; |
457 } | 457 } |
458 | 458 |
459 static int truemotion1_decode_init(AVCodecContext *avctx) | 459 static int truemotion1_decode_init(AVCodecContext *avctx) |
462 | 462 |
463 s->avctx = avctx; | 463 s->avctx = avctx; |
464 | 464 |
465 // FIXME: it may change ? | 465 // FIXME: it may change ? |
466 // if (avctx->bits_per_sample == 24) | 466 // if (avctx->bits_per_sample == 24) |
467 // avctx->pix_fmt = PIX_FMT_RGB24; | 467 // avctx->pix_fmt = PIX_FMT_RGB24; |
468 // else | 468 // else |
469 // avctx->pix_fmt = PIX_FMT_RGB555; | 469 // avctx->pix_fmt = PIX_FMT_RGB555; |
470 | 470 |
471 avctx->has_b_frames = 0; | 471 avctx->has_b_frames = 0; |
472 s->frame.data[0] = s->prev_frame.data[0] = NULL; | 472 s->frame.data[0] = s->prev_frame.data[0] = NULL; |
473 | 473 |
474 /* there is a vertical predictor for each pixel in a line; each vertical | 474 /* there is a vertical predictor for each pixel in a line; each vertical |