DemuxMPEG
DemuxMPEG ¶Contents
1.1. ½ÃÀÛÇϱâÀü¿¡ ¶
1.2.1. ¿ë¾î Á¤ÀÇ ¶
1.2.2. »ö»óÀÇ Ç¥Çö ¶
1.2.3. MMX ¶
1.2.4. ÁÖ»ç¹æ½Ä ¶
1.2.5. I/P/B picture ¶
1.2.6. ÇãÇÁ¸¸ºÎÈ£ (Huffman) ¶
1.2.7. DPCM (Differntial PCM) ¶
1.2.8. À̻꿩Çöº¯È¯ (DCT: Discrete Cosine Transform) ¶
1.2.9. ¾çÀÚÈ (Quantization) ¶
1.2.11. Aspect ratio (ȸéºñÀ²) ¶
1.2.12. ½Ã°£ÀÇ Ç¥Çö ¶
1.3. MPEG-1 (ISO/IEC 11172-2) ¶
1.4. MPEG-2 (ISO/IEC 13818-2, H.262) ¶
1.5. MPEG-4 (ISO/IEC 14496-2, ASP) ¶
1.6. H.264 (ISO/IEC 14496-10, AVC) ¶
1.7.1. WMV9 ¶
1.8. MP3 audio (MPEG 1/2 layer I/II/III) ¶
1.8.1. MP3 streaming ¶
1.9. AAC ¶
1.10. AC3 ¶
1.12. Demux ¶
1.12.1. Demux Á¦ÀÛÀ» À§ÇÑ Áغñ´Ü°è ¶
1.12.1.1. Bit stream Çì´õÁ¤ÀÇ (½ÃÀÛÄÚµå Á¤ÀÇ) ¶
1.12.1.2. Transport(TS) ÆÐŶ Çì´õ ¶
1.12.2. Demux PS ¶
1.12.3. Demux TS ¶
1.12.4. Demux DivX (3) ¶DIVXÀÇ Continer FormatÀº RIFF AVIÀ̸ç ÀÌ¿Í °ü·ÃµÈ ¹®¼´Â
AVI File Format (http://www.alexander-noe.com/video/documentation/avi.pdf), OpenDML AVI File Format Extensions (http://www.morgan-multimedia.com/download/odmlff2.pdf) µîÀÌ ÀÖ´Ù.
1.15. Streamming ¶
1.15.1.1. Section Filter ¶MPEG TS ÀÇ SectionFilter ¸¦ ±¸ÇöÇϴµ¥ ÀÖ¾î¼ Positive&Negative mask filter ¾Ë°í¸®ÁòÀ¸·Î ÀûÀýÇÑ H/W ÀûÀÎ Filter¿Í À¯»çÇÑ µ¿ÀÛÀ» ±¸ÇöÇÒ¼ö ÀÖ°Ô µË´Ï´Ù.
¿©±â¼ Positive mask ´Â ÁÖ¾îÁø data ¿Í mask °ªÀ» AND¿¬»êÈÄ comp ¿Í ºñ±³ÇÏ´Â ÀϹÝÀûÀÎ mask µ¿ÀÛÀ¸·Î ƯÁ¤ ºñÆ®ÆÐÅÏÀ» ÀÏÄ¡Á¶°ÇÀ¸·Î ÃëÇÏ´Â µ¿ÀÛÀÔ´Ï´Ù. ¹Ý¸é¿¡ Negative mask ´Â ÁÖ¾îÁø data ¿Í mask °ªÀ» AND¿¬»êÈÄ ÁÖ¾îÁø ºñÆ®ÆÐÅÏÀÌ ÁÖ¾îÁø comp °ª°ú ´Ù¸¥ °æ¿ì ÀÏÄ¡Á¶°ÇÀ¸·Î ÃëÇÏ´Â µ¿ÀÛÀÔ´Ï´Ù. Positive mask ´Â ƯÁ¤ ºñÆ®¿À» Åë°ú½ÃÅ°´Â ¿ëµµ·Î ±¸ÇöµÇ¸ç Negative mask ´Â ÇöÀçÁ¶°ÇÀÌ º¯°æµÇ´Â ½ÃÁ¡À» Åë°ú½ÃÅ°´Â ¿ëµµ·Î ±¸ÇöµÇ´Â°ÍÀÌÁÒ. ¾Æ·¡ÀÇ ¿¹Á¦°¡ ÃæºÐÇÒÁö´Â ¸ð¸£°ÚÁö¸¸ ´ë·« ´ÙÀ½°ú °°ÀÌ ±¸ÇöµÈ´Ù°í º¸½Ã¸é µË´Ï´Ù. ´ç¿¬È÷ H/W ¼³°èÀûÀÎ °üÁ¡¿¡¼µµ °¡´ÉÇÑ ±¸Á¶·Î µÇ¾î ÀÖ½À´Ï´Ù. °ÅÀÇ ±â´É»ó ±¸ÇöÀ¸·Î ºÃÀ»¶§´Â Positive mask ¸¸ ÀÖÀ¸¸é ÃæºÐÇÕ´Ï´Ù. ÇÏÁö¸¸ ºÒÇÊ¿äÇÑ ¹Ýº¹ÀûÀÎ data¸¦ ¹«½ÃÇÏÁö ¾Ê±â ¶§¹®¿¡ CPU°¡ °úµµÇÏ°Ô ÇÇ°ïÇØÁö°ÚÁÒ. Negative mask ´Â ÀÌ°ÍÀ» ¹æÁöÇÏ°Ô µË´Ï´Ù.
#include <stdio.h>
#include <stdlib.h> #include <memory.h> #include <unistd.h> static __inline int __mzmatch_filter(const unsigned char *s_data, const unsigned char *s_mask, const unsigned char *s_mode, const unsigned char *s_comp, size_t s_size); int mzmatch_filter(const void *s_data, const void *s_mask, const void *s_mode, const void *s_comp, size_t s_size); static __inline int __mzmatch_filter(const unsigned char *s_data, const unsigned char *s_mask, const unsigned char *s_mode, const unsigned char *s_comp, size_t s_size) { size_t s_offset = (size_t)0; unsigned char s_positive_mask, s_negative_mask; while(s_offset < s_size) { s_positive_mask = s_mask[s_offset] & s_mode[s_offset]; s_negative_mask = s_mask[s_offset] & (~s_mode[s_offset]); if(((s_positive_mask & s_data[s_offset]) != (s_positive_mask & s_comp[s_offset])) || ((s_negative_mask != ((unsigned char)0)) && ((s_negative_mask & (s_data[s_offset] ^ s_comp[s_offset])) == ((unsigned char)0)))) { return(0); } s_offset++; } return(1); } int mzmatch_filter(const void *s_data, const void *s_mask, const void *s_mode, const void *s_comp, size_t s_size) { return(__mzmatch_filter((const unsigned char *)s_data, (const unsigned char *)s_mask, (const unsigned char *)s_mode, (const unsigned char *)s_comp, s_size)); } void test(unsigned char s_mask, unsigned char s_mode, unsigned char s_comp) { int s_match_condition; unsigned int s_data_min = 0x00u, s_data_max = 0xffu; (void)fprintf(stdout, "TEST => data=%02X~%02X mask=%02X mode=%02X comp=%02X", (unsigned int)s_data_min, (unsigned int)s_data_max, (unsigned int)s_mask, (unsigned int)s_mode, (unsigned int)s_comp ); do { if((s_data_min % 0x10u) == 0x00u)(void)fputs("\n", stdout); s_match_condition = mzmatch_filter(&s_data_min, &s_mask, &s_mode, &s_comp, (size_t)1); #if defined(__linux__) /* can use ansi code(escape sequence code) */ (void)fprintf(stdout, " %s%02X\x1b[0m", (s_match_condition == 0) ? "\x1b[1;31m" : "\x1b[1;33m", (unsigned int)s_data_min); #else if(s_match_condition != 0) { (void)fprintf(stdout, " %02X", (unsigned int)s_data_min); } #endif }while((s_data_min++) < s_data_max); (void)fputs("\n", stdout); } int main(void) { test(0xffu, 0xffu, 0x80u); test(0xffu, 0x00u, 0x80u); test(0xffu, 0xf9u, 0xceu); test(0xffu, 0xf0u, 0x24u); test(0x3fu, ~((unsigned char)0x3fu), 0x04u); /* TS filter */ test(0xffu, 0xffu, 0x00u); /* PAT */ test(0xffu, 0xffu, 0x01u); /* CAT */ test(0xffu, 0xffu, 0x02u); /* PMT */ test(0xffu, 0xffu, 0x3eu); /* DSM CC */ test(0xfcu, 0xffu, 0x80u); /* ECM 0x80, 0x81, 0x82 */ return(EXIT_SUCCESS); } |
"Heck, I'm having a hard time imagining the DOM as civilized!" -- Fred L. Drake, Jr. |