Mercurial > libavcodec.hg
comparison dv.c @ 733:7da52fc20726 libavcodec
DV ntsc support, 411P colorspace added
author | arpi_esp |
---|---|
date | Mon, 07 Oct 2002 21:28:33 +0000 |
parents | a91203b34e71 |
children | 2d6b3e3d6c6f |
comparison
equal
deleted
inserted
replaced
732:bf4304c46cda | 733:7da52fc20726 |
---|---|
519 return -1; | 519 return -1; |
520 height = 480; | 520 height = 480; |
521 nb_dif_segs = 10; | 521 nb_dif_segs = 10; |
522 } | 522 } |
523 | 523 |
524 /* XXX: is it correct to assume that 420 is always used in PAL | |
525 mode ? */ | |
526 s->sampling_411 = !dsf; | |
527 if (s->sampling_411) | |
528 mb_pos_ptr = dv_place_411; | |
529 else | |
530 mb_pos_ptr = dv_place_420; | |
531 | |
524 /* (re)alloc picture if needed */ | 532 /* (re)alloc picture if needed */ |
525 if (s->width != width || s->height != height) { | 533 if (s->width != width || s->height != height) { |
526 for(i=0;i<3;i++) | 534 for(i=0;i<3;i++) |
527 av_freep(&s->current_picture[i]); | 535 av_freep(&s->current_picture[i]); |
528 for(i=0;i<3;i++) { | 536 for(i=0;i<3;i++) { |
529 size = width * height; | 537 size = width * height; |
530 s->linesize[i] = width; | 538 s->linesize[i] = width; |
531 if (i >= 1) { | 539 if (i >= 1) { |
532 size >>= 2; | 540 size >>= 2; |
533 s->linesize[i] >>= 1; | 541 s->linesize[i] >>= s->sampling_411 ? 2 : 1; |
534 } | 542 } |
535 s->current_picture[i] = av_malloc(size); | 543 s->current_picture[i] = av_malloc(size); |
536 if (!s->current_picture[i]) | 544 if (!s->current_picture[i]) |
537 return -1; | 545 return -1; |
538 } | 546 } |
539 s->width = width; | 547 s->width = width; |
540 s->height = height; | 548 s->height = height; |
541 } | 549 } |
542 | 550 |
543 /* XXX: is it correct to assume that 420 is always used in PAL | |
544 mode ? */ | |
545 s->sampling_411 = !dsf; | |
546 if (s->sampling_411) | |
547 mb_pos_ptr = dv_place_411; | |
548 else | |
549 mb_pos_ptr = dv_place_420; | |
550 | |
551 /* for each DIF segment */ | 551 /* for each DIF segment */ |
552 buf_ptr = buf; | 552 buf_ptr = buf; |
553 for (ds = 0; ds < nb_dif_segs; ds++) { | 553 for (ds = 0; ds < nb_dif_segs; ds++) { |
554 buf_ptr += 6 * 80; /* skip DIF segment header */ | 554 buf_ptr += 6 * 80; /* skip DIF segment header */ |
555 | 555 |
566 | 566 |
567 /* return image */ | 567 /* return image */ |
568 avctx->width = width; | 568 avctx->width = width; |
569 avctx->height = height; | 569 avctx->height = height; |
570 if (s->sampling_411) | 570 if (s->sampling_411) |
571 avctx->pix_fmt = PIX_FMT_YUV420P; /* XXX: incorrect, add PIX_FMT_YUV411P */ | 571 avctx->pix_fmt = PIX_FMT_YUV411P; |
572 else | 572 else |
573 avctx->pix_fmt = PIX_FMT_YUV420P; | 573 avctx->pix_fmt = PIX_FMT_YUV420P; |
574 if (dsf) | 574 if (dsf) |
575 avctx->frame_rate = 25 * FRAME_RATE_BASE; | 575 avctx->frame_rate = 25 * FRAME_RATE_BASE; |
576 else | 576 else |