Mercurial > libavcodec.hg
comparison dvdata.h @ 7714:f0f8bb920b24 libavcodec
Introducing video_stype for holding the value of VAUX source pack
and simplifying dv_frame_profile
| author | romansh |
|---|---|
| date | Thu, 28 Aug 2008 19:21:59 +0000 |
| parents | 685ef77c9fe5 |
| children | e8f71784062e |
comparison
equal
deleted
inserted
replaced
| 7713:f1e68b2dc389 | 7714:f0f8bb920b24 |
|---|---|
| 36 * 525/60 and 625/50, but the plans are to use it for various | 36 * 525/60 and 625/50, but the plans are to use it for various |
| 37 * DV specs as well (e.g. SMPTE314M vs. IEC 61834). | 37 * DV specs as well (e.g. SMPTE314M vs. IEC 61834). |
| 38 */ | 38 */ |
| 39 typedef struct DVprofile { | 39 typedef struct DVprofile { |
| 40 int dsf; /* value of the dsf in the DV header */ | 40 int dsf; /* value of the dsf in the DV header */ |
| 41 int video_stype; /* stype for VAUX source pack */ | |
| 41 int frame_size; /* total size of one frame in bytes */ | 42 int frame_size; /* total size of one frame in bytes */ |
| 42 int difseg_size; /* number of DIF segments per DIF channel */ | 43 int difseg_size; /* number of DIF segments per DIF channel */ |
| 43 int n_difchan; /* number of DIF channels per frame */ | 44 int n_difchan; /* number of DIF channels per frame */ |
| 44 int frame_rate; | 45 int frame_rate; |
| 45 int frame_rate_base; | 46 int frame_rate_base; |
| 2531 80, 80, 80, 80, 80, 80, 64, 64, | 2532 80, 80, 80, 80, 80, 80, 64, 64, |
| 2532 }; | 2533 }; |
| 2533 | 2534 |
| 2534 static const DVprofile dv_profiles[] = { | 2535 static const DVprofile dv_profiles[] = { |
| 2535 { .dsf = 0, | 2536 { .dsf = 0, |
| 2537 .video_stype = 0x0, | |
| 2536 .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */ | 2538 .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */ |
| 2537 .difseg_size = 10, | 2539 .difseg_size = 10, |
| 2538 .n_difchan = 1, | 2540 .n_difchan = 1, |
| 2539 .frame_rate = 30000, | 2541 .frame_rate = 30000, |
| 2540 .ltc_divisor = 30, | 2542 .ltc_divisor = 30, |
| 2550 .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */ | 2552 .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */ |
| 2551 .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ | 2553 .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ |
| 2552 .audio_shuffle = dv_audio_shuffle525, | 2554 .audio_shuffle = dv_audio_shuffle525, |
| 2553 }, | 2555 }, |
| 2554 { .dsf = 1, | 2556 { .dsf = 1, |
| 2557 .video_stype = 0x0, | |
| 2555 .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */ | 2558 .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */ |
| 2556 .difseg_size = 12, | 2559 .difseg_size = 12, |
| 2557 .n_difchan = 1, | 2560 .n_difchan = 1, |
| 2558 .frame_rate = 25, | 2561 .frame_rate = 25, |
| 2559 .frame_rate_base = 1, | 2562 .frame_rate_base = 1, |
| 2569 .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */ | 2572 .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */ |
| 2570 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, | 2573 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, |
| 2571 .audio_shuffle = dv_audio_shuffle625, | 2574 .audio_shuffle = dv_audio_shuffle625, |
| 2572 }, | 2575 }, |
| 2573 { .dsf = 1, | 2576 { .dsf = 1, |
| 2577 .video_stype = 0x0, | |
| 2574 .frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */ | 2578 .frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */ |
| 2575 .difseg_size = 12, | 2579 .difseg_size = 12, |
| 2576 .n_difchan = 1, | 2580 .n_difchan = 1, |
| 2577 .frame_rate = 25, | 2581 .frame_rate = 25, |
| 2578 .frame_rate_base = 1, | 2582 .frame_rate_base = 1, |
| 2588 .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */ | 2592 .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32Khz */ |
| 2589 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, | 2593 .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, |
| 2590 .audio_shuffle = dv_audio_shuffle625, | 2594 .audio_shuffle = dv_audio_shuffle625, |
| 2591 }, | 2595 }, |
| 2592 { .dsf = 0, | 2596 { .dsf = 0, |
| 2597 .video_stype = 0x4, | |
| 2593 .frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */ | 2598 .frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */ |
| 2594 .difseg_size = 10, /* also known as "DVCPRO50" */ | 2599 .difseg_size = 10, /* also known as "DVCPRO50" */ |
| 2595 .n_difchan = 2, | 2600 .n_difchan = 2, |
| 2596 .frame_rate = 30000, | 2601 .frame_rate = 30000, |
| 2597 .ltc_divisor = 30, | 2602 .ltc_divisor = 30, |
| 2607 .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */ | 2612 .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32Khz */ |
| 2608 .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ | 2613 .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ |
| 2609 .audio_shuffle = dv_audio_shuffle525, | 2614 .audio_shuffle = dv_audio_shuffle525, |
| 2610 }, | 2615 }, |
| 2611 { .dsf = 1, | 2616 { .dsf = 1, |
| 2617 .video_stype = 0x4, | |
| 2612 .frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */ | 2618 .frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */ |
| 2613 .difseg_size = 12, /* also known as "DVCPRO50" */ | 2619 .difseg_size = 12, /* also known as "DVCPRO50" */ |
| 2614 .n_difchan = 2, | 2620 .n_difchan = 2, |
| 2615 .frame_rate = 25, | 2621 .frame_rate = 25, |
| 2616 .frame_rate_base = 1, | 2622 .frame_rate_base = 1, |
| 2661 /* maximum number of blocks per macroblock in any DV format */ | 2667 /* maximum number of blocks per macroblock in any DV format */ |
| 2662 #define DV_MAX_BPM 8 | 2668 #define DV_MAX_BPM 8 |
| 2663 | 2669 |
| 2664 static inline const DVprofile* dv_frame_profile(const uint8_t* frame) | 2670 static inline const DVprofile* dv_frame_profile(const uint8_t* frame) |
| 2665 { | 2671 { |
| 2666 if ((frame[3] & 0x80) == 0) { /* DSF flag */ | 2672 int i; |
| 2667 /* it's an NTSC format */ | 2673 |
| 2668 if ((frame[80*5 + 48 + 3] & 0x4) && (frame[80*5 + 48] == dv_video_source)) { /* 4:2:2 sampling */ | 2674 int dsf = (frame[3] & 0x80) >> 7; |
| 2669 return &dv_profiles[3]; /* NTSC 50Mbps */ | 2675 |
| 2670 } else { /* 4:1:1 sampling */ | 2676 int stype = frame[80*5 + 48 + 3] & 0x1f; |
| 2671 return &dv_profiles[0]; /* NTSC 25Mbps */ | 2677 |
| 2672 } | 2678 /* 576i50 25Mbps 4:1:1 is a special case */ |
| 2673 } else { | 2679 if (dsf == 1 && stype == 0 && frame[5] & 0x07) { |
| 2674 /* it's a PAL format */ | 2680 return &dv_profiles[2]; |
| 2675 if ((frame[80*5 + 48 + 3] & 0x4) && (frame[80*5 + 48] == dv_video_source)) { /* 4:2:2 sampling */ | 2681 } |
| 2676 return &dv_profiles[4]; /* PAL 50Mbps */ | 2682 |
| 2677 } else if ((frame[5] & 0x07) == 0) { /* APT flag */ | 2683 for (i=0; i<sizeof(dv_profiles)/sizeof(DVprofile); i++) |
| 2678 return &dv_profiles[1]; /* PAL 25Mbps 4:2:0 */ | 2684 if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) |
| 2679 } else | 2685 return &dv_profiles[i]; |
| 2680 return &dv_profiles[2]; /* PAL 25Mbps 4:1:1 */ | 2686 |
| 2681 } | 2687 return NULL; |
| 2682 } | 2688 } |
| 2683 | 2689 |
| 2684 static inline const DVprofile* dv_codec_profile(AVCodecContext* codec) | 2690 static inline const DVprofile* dv_codec_profile(AVCodecContext* codec) |
| 2685 { | 2691 { |
| 2686 int i; | 2692 int i; |
