`
lobin
  • 浏览: 427199 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

音视频图像编解码

 
阅读更多
写道
图像处理
https://www.iteye.com/blog/lobin-2508589

 

写道
音视频处理
https://www.iteye.com/blog/lobin-2439912

 

音视频编解码

离散傅立叶变换



根据殴拉公式,离散傅立叶变换还可以写成以下形式。

 

殴拉公式

 

 

 

其中∑表示求和,读作"sigma"。

 

 

∑求和的例子

求矩形面积

 

 

 

∑求和的例子

求圆面积

 

 

 

 

 

编码格式

MPEG

 

MPEG1

 

MPEG2

 

MPEG4

 

Part 2: Visual

 

 

写道
* ——————————————————————————————————————————————————————————————+—————————————+—————————
* VisualObjectSequence() { | No. of bits | Mnemonic
* do { | |
* visual_object_sequence_start_code | 32 | bslbf
* profile_and_level_indication | 8 | uimsbf
* while ( next_bits()== user_data_start_code){ | |
* user_data() | |
* } | |
* VisualObject() | |
* } while ( next_bits() != visual_object_sequence_end_code) | |
* visual_object_sequence_end_code | 32 | bslbf
* } | |
* ——————————————————————————————————————————————————————————————+—————————————+—————————

* User data
* ——————————————————————————————————————————————————————————————+—————————————+—————————
* user_data() { | No. of bits | Mnemonic
* user_data_start_code | 32 | bslbf
* while( next_bits() != ‘0000 0000 0000 0000 0000 0001’ ) { | |
* user_data | 8 | uimsbf
* } | |
* } | |
* ——————————————————————————————————————————————————————————————+—————————————+—————————

 

 

写道
* —————————————————————————————————————————————————————————————————————————————————+—————————————+—————————
* VisualObject() { | No. of bits | Mnemonic
* visual_object_start_code | 32 | bslbf
* is_visual_object_identifier | 1 | uimsbf
* if (is_visual_object_identifier) { | |
* visual_object_verid | 4 | uimsbf
* visual_object_priority | 3 | uimsbf
* } | |
* visual_object_type | 4 | uimsbf
* if (visual_object_type == “video ID” || visual_object_type == “still texture | |
* ID“) { | |
* video_signal_type() | |
* } | |
* next_start_code() | |
* while ( next_bits()== user_data_start_code){ | |
* user_data() | |
* } | |
* if (visual_object_type == “video ID”) { | |
* video_object_start_code | 32 | bslbf
* VideoObjectLayer() | |
* } | |
* else if (visual_object_type == “still texture ID”) { | |
* StillTextureObject() | |
* } | |
* else if (visual_object_type == “mesh ID”) { | |
* MeshObject() | |
* } | |
* else if (visual_object_type == “FBA ID”) { | |
* FBAObject() | |
* } | |
* else if (visual_object_type == “3D mesh ID”) { | |
* 3D_Mesh_Object() | |
* } | |
* if (next_bits() != “0000 0000 0000 0000 0000 0001”) | |
* next_start_code() | |
* } | |
* —————————————————————————————————————————————————————————————————————————————————+—————————————+—————————

 

 

写道
* ——————————————————————————————————————————————————————————————+—————————————+—————————
* video_signal_type() { | No. of bits | Mnemonic
* video_signal_type | 1 | bslbf
* if (video_signal_type) { | |
* video_format | 3 | uimsbf
* video_range | 1 | bslbf
* colour_description | 1 | bslbf
* if (colour_description) { | |
* colour_primaries | 8 | uimsbf
* transfer_characteristics | 8 | uimsbf
* matrix_coefficients | 8 | uimsbf
* } | |
* } | |
* } | |
* ——————————————————————————————————————————————————————————————+—————————————+—————————

 

 

 

ASF

ASF对象

ASF对象全局唯一ID(GUID)

  // Top-level ASF object GUIDS
  {
    "75B22630-668E-11CF-A6D9-00AA0062CE6C", 
    "ASF_Header_Object"
  }, {
    "75B22636-668E-11CF-A6D9-00AA0062CE6C", 
    "ASF_Data_Object"
  }, {
    "33000890-E5B1-11CF-89F4-00A0C90349CB", 
    "ASF_Simple_Index_Object"
  }, {
    "D6E229D3-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Index_Object"
  }, {
    "FEB103F8-12AD-4C64-840F-2A1D2F7AD48C", 
    "ASF_Media_Object_Index_Object"
  }, {
    "3CB73FD0-0C4A-4803-953D-EDF7B6228F0C", 
    "ASF_Timecode_Index_Object"
  }, 
  
  // Header Object GUIDs
  {
    "8CABDCA1-A947-11CF-8EE4-00C00C205365", 
    "ASF_File_Properties_Object"
  }, {
    "B7DC0791-A9B7-11CF-8EE6-00C00C205365", 
    "ASF_Stream_Properties_Object"
  }, {
    "5FBF03B5-A92E-11CF-8EE3-00C00C205365", 
    "ASF_Header_Extension_Object"
  }, {
    "86D15240-311D-11D0-A3A4-00A0C90348F6", 
    "ASF_Codec_List_Object"
  }, {
    "1EFB1A30-0B62-11D0-A39B-00A0C90348F6", 
    "ASF_Script_Command_Object"
  }, {
    "F487CD01-A951-11CF-8EE6-00C00C205365", 
    "ASF_Marker_Object"
  }, {
    "D6E229DC-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Bitrate_Mutual_Exclusion_Object"
  }, {
    "75B22635-668E-11CF-A6D9-00AA0062CE6C", 
    "ASF_Error_Correction_Object"
  }, {
    "75B22633-668E-11CF-A6D9-00AA0062CE6C", 
    "ASF_Content_Description_Object"
  }, {
    "D2D0A440-E307-11D2-97F0-00A0C95EA850", 
    "ASF_Extended_Content_Description_Object"
  }, {
    "2211B3FA-BD23-11D2-B4B7-00A0C955FC6E", 
    "ASF_Content_Branding_Object"
  }, {
    "7BF875CE-468D-11D1-8D82-006097C9A2B2", 
    "ASF_Stream_Bitrate_Properties_Object"
  }, {
    "2211B3FB-BD23-11D2-B4B7-00A0C955FC6E", 
    "ASF_Content_Encryption_Object"
  }, {
    "298AE614-2622-4C17-B935-DAE07EE9289C", 
    "ASF_Extended_Content_Encryption_Object"
  }, {
    "2211B3FC-BD23-11D2-B4B7-00A0C955FC6E", 
    "ASF_Digital_Signature_Object"
  }, {
    "1806D474-CADF-4509-A4BA-9AABCB96AAE8", 
    "ASF_Padding_Object"
  }, 
  
  // Header Extension Object GUIDs
  {
    "14E6A5CB-C672-4332-8399-A96952065B5A", 
    "ASF_Extended_Stream_Properties_Object"
  }, {
    "A08649CF-4775-4670-8A16-6E35357566CD", 
    "ASF_Advanced_Mutual_Exclusion_Object"
  }, {
    "D1465A40-5A79-4338-B71B-E36B8FD6C249", 
    "ASF_Group_Mutual_Exclusion_Object"
  }, {
    "D4FED15B-88D3-454F-81F0-ED5C45999E24", 
    "ASF_Stream_Prioritization_Object"
  }, {
    "A69609E6-517B-11D2-B6AF-00C04FD908E9", 
    "ASF_Bandwidth_Sharing_Object"
  }, {
    "7C4346A9-EFE0-4BFC-B229-393EDE415C85", 
    "ASF_Language_List_Object"
  }, {
    "C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA", 
    "ASF_Metadata_Object"
  }, {
    "44231C94-9498-49D1-A141-1D134E457054", 
    "ASF_Metadata_Library_Object"
  }, {
    "D6E229DF-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Index_Parameters_Object"
  }, {
    "6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7", 
    "ASF_Media_Object_Index_Parameters_Object"
  }, {
    "F55E496D-9797-4B5D-8C8B-604DFE9BFB24", 
    "ASF_Timecode_Index_Parameters_Object"
  }, {
    "75B22630-668E-11CF-A6D9-00AA0062CE6C", 
    "ASF_Compatibility_Object"
  }, {
    "43058533-6981-49E6-9B74-AD12CB86D58C", 
    "ASF_Advanced_Content_Encryption_Object"
  }, 
  
  // Stream Properties Object Stream Type GUIDs
  {
    "F8699E40-5B4D-11CF-A8FD-00805F5C442B", 
    "ASF_Audio_Media"
  }, {
    "BC19EFC0-5B4D-11CF-A8FD-00805F5C442B", 
    "ASF_Video_Media"
  }, {
    "59DACFC0-59E6-11D0-A3AC-00A0C90348F6", 
    "ASF_Command_Media"
  }, {
    "B61BE100-5B4E-11CF-A8FD-00805F5C442B", 
    "ASF_JFIF_Media"
  }, {
    "35907DE0-E415-11CF-A917-00805F5C442B", 
    "ASF_Degradable_JPEG_Media"
  }, {
    "91BD222C-F21C-497A-8B6D-5AA86BFC0185", 
    "ASF_File_Transfer_Media"
  }, {
    "3AFB65E2-47EF-40F2-AC2C-70A90D71D343", 
    "ASF_Binary_Media"
  }, 

  // Web stream Type-Specific Data GUIDs
  {
    "776257D4-C627-41CB-8F81-7AC7FF1C40CC", 
    "ASF_Web_Stream_Media_Subtype"
  }, {
    "DA1E6B13-8359-4050-B398-388E965BF00C", 
    "ASF_Web_Stream_Format"
  }, 
  
  // Stream Properties Object Error Correction Type GUIDs 
  {
    "20FB5700-5B55-11CF-A8FD-00805F5C442B", 
    "ASF_No_Error_Correction"
  }, {
    "BFC3CD50-618F-11CF-8BB2-00AA00B4E220", 
    "ASF_Audio_Spread"
  },
  
  // Header Extension Object GUIDs
  {
    "ABD3D211-A9BA-11cf-8EE6-00C00C205365", 
    "ASF_Reserved_1"
  }, 
    
  // Advanced Content Encryption Object System ID GUIDs
  {
    "7A079BB6-DAA4-4e12-A5CA-91D38DC11A8D", 
    "ASF_Content_Encryption_System_Windows_Media_DRM_Network_Devices"
  }, 

  // Codec List Object GUIDs
  {
    "86D15241-311D-11D0-A3A4-00A0C90348F6", 
    "ASF_Reserved_2"
  }, 
  
  // Script Command Object GUIDs
  {
    "4B1ACBE3-100B-11D0-A39B-00A0C90348F6", 
    "ASF_Reserved_3"
  }, 

  // Marker Object GUIDs
  {
    "4CFEDB20-75F6-11CF-9C0F-00A0C90349CB", 
    "ASF_Reserved_4"
  }, 

  // Mutual Exclusion Object Exclusion Type GUIDs
  {
    "D6E22A00-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Mutex_Language"
  }, {
    "D6E22A01-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Mutex_Bitrate"
  }, {
    "D6E22A02-35DA-11D1-9034-00A0C90349BE", 
    "ASF_Mutex_Unknown"
  }, 

  // Bandwidth Sharing Object GUIDs
  {
    "AF6060AA-5197-11D2-B6AF-00C04FD908E9", 
    "ASF_Bandwidth_Sharing_Exclusive"
  }, {
    "AF6060AB-5197-11D2-B6AF-00C04FD908E9", 
    "ASF_Bandwidth_Sharing_Partial"
  }, 

  // Standard Payload Extension System GUIDs
  {
    "399595EC-8667-4E2D-8FDB-98814CE76C1E", 
    "ASF_Payload_Extension_System_Timecode"
  }, {
    "E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B", 
    "ASF_Payload_Extension_System_File_Name"
  }, {
    "D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC", 
    "ASF_Payload_Extension_System_Content_Type"
  }, {
    "1B1EE554-F9EA-4BC8-821A-376B74E4C4B8", 
    "ASF_Payload_Extension_System_Pixel_Aspect_Ratio"
  }, {
    "C6BD9450-867F-4907-83A3-C77921B733AD", 
    "ASF_Payload_Extension_System_Sample_Duration"
  }, {
    "6698B84E-0AFA-4330-AEB2-1C0A98D7A44D", 
    "ASF_Payload_Extension_System_Encryption_Sample_ID"
  }

GUID

/**
 * struct { 
 *   unsigned long Data1; 
 *   unsigned short Data2; 
 *   unsigned short Data3; 
 *   unsigned char Data4[8]; 
 * } GUID;
 * 
 * see https://docs.microsoft.com/zh-tw/previous-versions/bb415594(v=msdn.10)
 * 
 * 30 26 B2 75 8E 66 CF 11  A6 D9 00 AA 00 62 CE 6C
 * Data1 -> 30 26 B2 75 -> 75B22630
 * Data2 -> 8E 66 -> 668E
 * Data3 -> CF 11 -> 11CF
 * Data4 -> A6 D9 00 AA 00 62 CE 6C -> A6D9-00AA0062CE6C
 * 75B22630-668E-11CF-A6D9-00AA0062CE6C
 */
struct guid { 
  unsigned long data1; 
  unsigned short data2; 
  unsigned short data3; 
  unsigned char data4[8]; 
};

GUID相关的几个函数

int guid(unsigned long data1, unsigned short data2, unsigned short data3, unsigned char data4[8], struct guid *out)
{
  out->data1 = data1;
  out->data2 = data2;
  out->data3 = data3;
  memcpy(out->data4, data4, 8);
  return 0;
}

// param s, guid with string format. for example: 75B22630-668E-11CF-A6D9-00AA0062CE6C
int guid_from(unsigned char s[36], struct guid *out)
{
  unsigned char data5[17];
  sscanf(s, "%lx-%hx-%hx-%s", &out->data1, &out->data2, &out->data3, data5);

  sscanf(data5, 
    "%2hhx%2hhx-%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", 
    &out->data4[0], &out->data4[1], &out->data4[2], &out->data4[3], 
    &out->data4[4], &out->data4[5], &out->data4[6], &out->data4[7]);
  return 0;
}

// param s, guid with string format. for example: 75B22630-668E-11CF-A6D9-00AA0062CE6C
int guid_to(struct guid *out, unsigned char s[36])
{
  sprintf(s, "%.8X-%.4X-%.4X-%.2hhX%.2hhX-%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX%.2hhX", 
    out->data1, out->data2, out->data3, 
    out->data4[0], out->data4[1], out->data4[2], out->data4[3], 
    out->data4[4], out->data4[5], out->data4[6], out->data4[7]);
  return 0;
}

 

 

WMV

 

AVI

Codec

 

FMP4

 

 

MPG

 

MP4

 

FLV

int flv_std_read_body(FILE *fp)
{
  unsigned int pre_tag_size;

  fread(&pre_tag_size, 1, 4, fp); // PreviousTagSize0(4 bytes)
  pre_tag_size = htonl(pre_tag_size);
  printf("pre_tag_size=%u\n", pre_tag_size);

  while (! feof(fp))
  {
    struct flv_tag_header *tag_header = malloc(sizeof(struct flv_tag_header));
    struct flv_tag *tag;
    
    fread(tag_header, 1, sizeof(struct flv_tag_header), fp); // (11 bytes)

    tag = realloc(tag_header, sizeof(struct flv_tag_header) + __data_size__(tag_header));
    tag_header = (struct flv_tag_header *) tag;
    fread(tag->data, 1, __data_size__(tag_header), fp); // (data_size bytes)

    fread(&pre_tag_size, 1, 4, fp); // PreviousTagSize1, 2, ..., n(4 bytes)
    pre_tag_size = htonl(pre_tag_size);

    printf("pre_tag_size=%u, type=%u, data_size=%u, timestamp=%u, timestamp_extended=%u, stream_id=%u\n", 
      pre_tag_size, tag_header->type, __data_size__(tag_header), tag_header->timestamp, tag_header->timestamp_extended, __stream_id__(tag_header));

    switch (tag_header->type)
    {
      case AUDIO_TAG: // 8
      {
        printf("tag: audio\n");
        parse_audio(tag->data, __data_size__(tag_header));
        break;
      }
      case VIDEO_TAG: // 9
      {
        printf("tag: video\n");
        parse_video(tag->data, __data_size__(tag_header));
        break;
      }
      case SCRIPT_DATA_TAG: // 18
      {
        printf("tag: script data\n");

        parse_script_data(tag->data, __data_size__(tag_header));
        break;
      }
      default: // all others(tag) reserved.
      {
        break;
      }
    }
  }
}

int flv_std_load(FILE *fp)
{
  struct flv_header header;
  
  fread(&header, 1, sizeof(struct flv_header), fp); // (9 bytes)
  header.data_offset = htonl(header.data_offset);
  printf("signature=%.3s, version=%u, reserved0=%u, audio=%u, reserved1=%u, video=%u, data_offset=%u\n", 
    header.signature, header.version, header.reserved0, header.audio, header.reserved1, header.video, header.data_offset);
  if (header.data_offset > sizeof(struct flv_header))
  {

  }

  flv_std_read_body(fp);
  return 0;
}

 

F4V

 

音频编解码

AUDIO

frame

 * frame()
 * {
 *  header()
 *  error_check()
 *  audio_data()
 *  ancillary_data()
 * }

header

 * header()
 * {
 *    syncword	12	bits	bslbf
 *    ID	1	bit	bslbf
 *    layer	2	bits	bslbf
 *    protection_bit	1	bit	bslbf
 *    bitrate_index	4	bits	bslbf
 *    sampling_frequency	2	bits	bslbf
 *    padding_bit	1	bit	bslbf
 *    private_bit	1	bit	bslbf
 *    mode	2	bits	bslbf
 *    mode_extension	2	bits	bslbf
 *    copyright	1	bit	bslbf
 *    original/home	1	bit	bslbf
 *    emphasis	2	bits	bslbf
 * }

// layer

// 

// "11"Layer I

// "10"Layer II

// "01"Layer III

// "00"reserved

 

 * mode

 *

 * '00'stereo(also known as 立体声)

 * '01'joint_stereo(also known as 联合立体声) (intensity_stereo al-

 *        so known as 强度立体声 and/or ms_stereo) 

 *        In Layer I and II the joint_stereo mode is intensity_stereo, 

 *        in Layer III it is intensity_stereo and/or ms_stereo. 

 *

 * '10'dual_channel (also known as 双通道)

 * '11'single_channel (also known as 单通道)

 

error_check

 * error_check()
 * {
 *  if  (protection_bit==0)
 *   crc_check 	 16	bits	rpchof
 * }

audio_data

- Audio data, Layer I

 * audio_data()
 * {
 *  if (mode==single_channel)
 *  {
 *   for (sb=0; sb<32; sb++) 
 *    allocation[sb]	4	bits	uimsbf
 *   for (sb=0; sb<32; sb++) 
 *    if (allocation[sb]!=0)
 *     scalefactor[sb]	6	bits	uimsbf
 *   for (s=0; s<12; s++)
 *    for (sb=0; sb<32; sb++) 
 *     if (allocation[sb]!=0)
 *      sample[sb][s]	2..15	bits	uimsbf
 *  }
 *  if (mode==stereo) || (mode==dual_channel)
 *  {
 *   for (sb=0; sb<32; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     allocation[ch][sb]	4	bits	bsmsbf
 *   for (sb=0; sb<32; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *      scalefactor[ch][sb]	6	bits	uimsbf
 *   for (s=0; s<12; s++)
 *    for (sb=0; sb<32; sb++)
 *     for (ch=0; ch<2; ch++) 
 *      if (allocation[ch][sb]!=0)
 *       sample[ch][sb][s]	2..15	bits	uimsbf
 *  }
 *  if (mode==intensity_stereo) 
 *  {
 *   for (sb=0; sb<bound; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     allocation[ch][sb]	4	bits	uimsbf
 *   for (sb=bound; sb<32; sb++) 
 *    allocation[sb]	4	bits	uimsbf
 *   for (sb=0; sb<bound; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *      scalefactor[ch][sb]	6	bits	uimsbf
 *   for (sb=bound; sb<32; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[sb]!=0)
 *      scalefactor[ch][sb]	6	bits	uimsbf
 *   for (s=0; s<12; s++)
 *   {
 *    for (sb=0; sb<bound; sb++)
 *     for (ch=0; ch<2; ch++) 
 *      if (allocation[ch][sb]!=0)
 *       sample[ch][sb][s]	2..15	bits	uimsbf
 *    for (sb=bound; sb<32; sb++)
 *     if (allocation[sb]!=0)
 *      sample[sb][s]	2..15	bits	uimsbf
 *   }
 *  }
 * }

- Audio data, Layer II

 * audio_data()
 * {
 *  if (mode==single_channel)
 *  {
 *   for (sb=0; sb<sblimit; sb++) 
 *    allocation[sb]	2..4	bits	uimsbf
 *   for (sb=0; sb<sblimit; sb++) 
 *    if (allocation[sb]!=0)
 *     scfsi[sb]	2	bits	bslbf
 *   for (sb=0; sb<sblimit; sb++) 
 *    if (allocation[sb]!=0)
 *    {
 *     if (scfsi[sb]==0) 
 *     { 
 *      scalefactor[sb][0] 	6	bits	uimsbf
 *      scalefactor[sb][1] 	6	bits	uimsbf
 *      scalefactor[sb][2] }	6	bits	uimsbf
 *     if (scfsi[sb]==1) || (scfsi[sb]==3)
 *     { 
 *      scalefactor[sb][0] 	6	bits	uimsbf
 *      scalefactor[sb][2] }	6	bits	uimsbf
 *     if (scfsi[sb]==2)
 *      scalefactor[sb][0]	6	bits	uimsbf
 *    }
 *   for (gr=0; gr<12; gr++)
 *    for (sb=0; sb<sblimit; sb++) 
 *     if (allocation[sb]!=0)
 *     {
 *      if (grouping[sb])
 *       samplecode[sb][gr]	5..10	bits	uimsbf
 *      else 
 *       for (s=0; s<3; s++)
 *        sample[sb][3*gr+s]	2..16	bits	uimsbf 
 *     }
 *  }
 *
 *  if (mode==stereo) || (mode==dual_channel)
 *  {
 *   for (sb=0; sb<sblimit; sb++)
 *    for (ch=0; ch<2; ch++)
 *     allocation[ch][sb]	2..4	bits	uimsbf
 *   for (sb=0; sb<sblimit; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *      scfsi[ch][sb]	2	bits	bslbf
 *   for (sb=0; sb<sblimit; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *     {
 *      if (scfsi[ch][sb]==0) 
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][1] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf 
 *      if (scfsi[ch][sb]==1) || (scfsi[ch][sb]==3)
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf
 *      if (scfsi[ch][sb]==2)
 *       scalefactor[ch][sb][0]	6	bits	uimsbf
 *     }
 *   for (gr=0; gr<12; gr++)
 *    for (sb=0; sb<sblimit; sb++) 
 *     for (ch=0; ch<2; ch++)
 *      if (allocation[ch][sb]!=0)
 *      {
 *       if (grouping[ch][sb])
 *        samplecode[ch][sb][gr]	5..10	bits	uimsbf
 *       else for (s=0; s<3; s++)
 *        sample[ch][sb][3*gr+s]	2..16	bits	uimsbf
 *      }
 *  }
 *
 *  if (mode==intensity_stereo) 
 *  {
 *   for (sb=0; sb<bound; sb++)
 *    for (ch=0; ch<2; ch++)
 *     allocation[ch][sb]	2..4	bits	uimsbf
 *   for (sb=bound; sb<sblimit; sb++)
 *    allocation[sb]	2..4	bits	uimsbf
 *   for (sb=0; sb<bound; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *      scfsi[ch][sb]	2	bits	bslbf
 *   for (sb=bound; sb<sblimit; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[sb]!=0)
 *      scfsi[ch][sb]	2	bits	bslbf
 *   for (sb=0; sb<bound; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[ch][sb]!=0)
 *     {
 *      if (scfsi[ch][sb]==0) 
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][1] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf
 *      if (scfsi[ch][sb]==1) || (scfsi[ch][sb]==3)
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf
 *      if (scfsi[ch][sb]==2)
 *       scalefactor[ch][sb][0]	6	bits	uimsbf
 *     }
 *   for (sb=bound; sb<sblimit; sb++) 
 *    for (ch=0; ch<2; ch++)
 *     if (allocation[sb]!=0)
 *     {
 *      if (scfsi[ch][sb]==0) 
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][1] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf
 *      if (scfsi[ch][sb]==1) || (scfsi[ch][sb]==3)
 *      { 
 *       scalefactor[ch][sb][0] 	6	bits	uimsbf
 *       scalefactor[ch][sb][2] }	6	bits	uimsbf
 *      if (scfsi[ch][sb]==2)
 *       scalefactor[ch][sb][0]	6	bits	uimsbf
 *     }
 *   for (gr=0; gr<12; gr++)
 *   {
 *    for (sb=0; sb<bound; sb++) 
 *     for (ch=0; ch<2; ch++)
 *      if (allocation[ch][sb]!=0)
 *      {
 *       if (grouping[ch][sb])
 *        samplecode[ch][sb][gr]	5..10	bits	uimsbf
 *       else for (s=0; s<3; s++)
 *        sample[ch][sb][3*gr+s]	2..16	bits	uimsbf
 *      }
 *    for (sb=bound; sb<sblimit; sb++) 
 *     if (allocation[sb]!=0)
 *     {
 *      if (grouping[sb])
 *       samplecode[sb][gr]	5..10	bits	uimsbf
 *      else for (s=0; s<3; s++)
 *       sample[sb][3*gr+s]	2..16	bits	uimsbf 
 *     }
 *   }
 *  }
 * }

- Audio data, Layer III

 * audio_data()
 * {
 *  if (mode == single_channel)
 *  {
 *   main_data_end	9	bits	uimsbf
 *   private_bits	5	bits	bslbf
 *   for (scfsi_band=0; scfsi_band<4; scfsi_band++)
 *    scfsi[scfsi_band]	1	bits	bslbf
 *   for (gr=0; gr<2; gr++) 
 *   {
 *    part2_3_length[gr]	12	bits	uimsbf
 *    big_values[gr]	9	bits	uimsbf
 *    global_gain[gr]	8	bits	uimsbf
 *    scalefac_compress[gr]	4	bits	bslbf
 *    blocksplit_flag[gr]	1	bit	bslbf
 *    if (blocksplit_flag[gr])
 *    {
 *     block_type[gr]	2	bits	bslbf
 *     switch_point[gr]	1	bits	uimsbf
 *     for (region=0; region<2; region++)
 *      table_select[region][gr]	5	bits	bslbf
 *     for (window=0; window<3; window++)
 *      subblock_gain[window][gr]	3	bits	uimsbf
 *    }
 *    else
 *    {
 *     for (region=0; region<3; region++)
 *      table_select[region][gr]	5	bits	bslbf
 *     region_address1[gr]	4	bits	bslbf
 *     region_address2[gr]	3	bits	bslbf
 *    }
 *    preflag[gr]	1	bit	bslbf
 *    scalefac_scale[gr]	1	bit	bslbf
 *    count1table_select[gr]	1	bit	bslbf
 *   }
 * 
 *   // 
 *   // The main_data follows.  It does not follow the above side information 
 *   // in the bitstream.  The main_data ends at a location in the main_data 
 *   // bitstream preceding the frame header of the following frame at an offset 
 *   // given by the value of main_data_end (see definition of main_data_end 
 *   // and 3-Annex Fig.3-A.7.1)
 *   // 
 *   for (gr=0; gr<2; gr++)
 *    if (blocksplit_flag[gr] == 1 && block_type[gr] == 2)
 *    {
 *     for (cb=0; cb<switch_point_l[gr]; cb++)
 *      if (scfsi[cb]==0) || (gr==0) 
 *       scalefac[cb][gr]	0..4	bits	uimsbf
 *     for (cb=switch_point_s[gr]; cb<cblimit_short; cb++)
 *      for (window=0; window<3; window++)
 *       if (scfsi[cb]==0) || (gr==0) 
 *        scalefac[cb][window][gr]	0..4	bits	uimsbf
 *    }
 *    else
 *     for (cb=0; cb<cblimit; cb++)
 *      if (scfsi[cb]==0) || (gr==0)
 *       scalefac[cb][gr]	0..4	bits	uimsbf
 *   Huffmancodebits  	    (part2_3_length-part2_length)	bits	bslbf
 *   while (position != main_data_end)
 *   {
 *    ancillary_bit	1	bit	bslbf
 *   }
 *
 *  }
 * 
 *  if (mode==stereo) || (mode==dual_channel) || (mode==ms_stereo)
 *  {
 *   main_data_end		9 bits	uimsbf
 *   private_bits		3 bits	bslbf
 *   for (ch=0; ch<2; ch++)
 *    for (scfsi_band=0; scfsi_band<4; scfsi_band++)
 *     scfsi[scfsi_band][ch]		1 bits	bslbf
 *   for (gr=0; gr<2; gr++)
 *    for (ch=0; ch<2; ch++}
 *     part2_3_length[gr][ch]	12	bits	uimsbf
 *   big_values[gr][ch]	9	bits	uimsbf
 *   global_gain[gr][ch]	8	bits	uimsbf
 *   scalefac_compress[gr][ch]	4	bits	bslbf
 *   blocksplit_flag[gr][ch]	1	bit	bslbf
 *   if (blocksplit_flag[gr][ch])
 *   {
 *    block_type[gr][ch]	2	bits	bslbf
 *    switch_point[gr][ch]	1	bits	uimsbf
 *    for (region=0; region<2; region++)
 *     table_select[region][gr][ch]	5	bits	bslbf
 *    for (window=0; window<3; window++)
 *     subblock_gain[window][gr][ch]	3	bits	uimsbf
 *   }
 *   else
 *   {
 *    for (region=0; region<3; region++)
 *     table_select[region][gr][ch]	5	bits	bslbf
 *    region_address1[gr][ch]	4	bits	bslbf
 *    region_address2[gr][ch]	3	bits	bslbf
 *   }
 *   preflag[gr][ch]	1	bit	bslbf
 *   scalefac_scale[gr][ch]	1	bit	bslbf
 *   count1table_select[gr][ch]	1	bit	bslbf
 *
 *   // 
 *   // The main_data follows. It does not follow the above side information 
 *   // in the bitstream. The main_data ends at a location in the main_data 
 *   // bitstream preceding the frame header of the following frame at an offset 
 *   // given by the value of main_data_end.
 *   // 
 *   for (gr=0; gr<2; gr++)
 *    for (ch=0; ch<2; ch++) {
 *     if (blocksplit_flag[gr][ch] == 1 && block_type[gr][ch] == 2)
 *     {
 *      for (cb=0; cb<switch_point_l[gr][ch]; cb++)
 *       if (scfsi[cb]==0) || (gr==0) 
 *        scalefac[cb][gr][ch]	0..4	bits	uimsbf
 *      for (cb=switch_point_s[gr][ch]; cb<cblimit_short; cb++)
 *       for (window=0; window<3; window++)
 *        if (scfsi[cb]==0) || (gr==0) 
 *         scalefac[cb][window][gr][ch]	0..4	bits	uimsbf
 *     }
 *     else
 *      for (cb=0; cb<cblimit; cb++)
 *       if (scfsi[cb]==0) || (gr==0) 
 *        scalefac[cb][gr][ch]	0..4	bits	uimsbf
 *     Huffmancodebits 	(part2_3_length-part2_length)	bits	bslbf
 *     while (position != main_data_end)
 *     {
 *      ancillary_bit	1	bit	bslbf
 *     }
 *
 *    }
 *  }
 * }

 

 

MP3

 

MPEG Audio Layer3

 

视频编解码

分享到:
评论

相关推荐

    Visual C++音视频编解码技术及实践(附光盘)

    《Visual C++音视频编解码技术及实践》是一本深入探讨如何利用Microsoft的Visual C++编程环境进行音视频处理的专业书籍。这本书涵盖了从基础知识到高级应用的全面内容,旨在帮助开发者掌握音视频编解码的核心技术和...

    Visual C++音视频编解码技术及实践随书光盘2~5章

    在音视频处理领域,Visual C++(VC++)是一种常用的语言工具,因其强大的性能和丰富的库支持,使得它成为开发音视频编解码应用的理想选择。本篇文章将深入探讨使用Visual C++进行音视频编解码的技术细节以及实践中的...

    rk3588音视频硬件编解码技术资料

    调用海康威视相机进行rk3588 ffmedia音视频硬件编解码,在官方ffmedia_release demo的基础上新增功能,包括基于海康威视sdk,读入相机图片,对图片进行单次h264编码,调用ffmedia进行硬件编码,保存为h264裸流文件,...

    音视频-编解码-《道藏》人物图像研究.pdf

    音视频-编解码-《道藏》人物图像研究 本研究论文旨在探讨《道藏》中的图像研究,涵盖历史上道教图像的造作、《道藏》中的图像、音视频数据结构和算法等方面的知识点。本文将对《道藏》中的图像进行分类、分析和解读...

    Visual C++音视频编解码技术及实践

    《Visual C++音视频编解码技术及实践》是一本深度探讨使用Visual C++进行音视频处理的专业书籍,结合了理论知识与实际操作,旨在帮助读者掌握音视频编解码的核心技术。书中不仅包含了丰富的理论内容,还提供了实战...

    音视频-编解码-协作通信关键技术研究.pdf

    编解码技术旨在减小音视频数据的大小,以便在有限带宽的通信系统中传输,同时保持尽可能高的图像和音频质量。 协作通信是论文的另一重点,这涉及到多个通信节点通过合作来改善整体网络性能。论文中提到了多跳分集...

    c/c++开发音视频编解码

    在C/C++编程环境中,音视频编解码是一项复杂但至关重要的技术,广泛应用于多媒体通信、游戏、在线教育、视频会议等领域。本压缩包提供的"TestFor_AVCodec"示例程序,旨在帮助开发者掌握音视频编解码的核心原理和实践...

    Visual C++音视频编解码技术及实践,音视频编解码基础知识,C/C++

    在音视频处理领域,Visual C++是一个常用的编程工具,它提供了强大的性能和丰富的库支持,使得开发者能够深入理解和实现音视频的编解码技术。本文将详细探讨在Visual C++中进行音视频编解码的基础知识,以及如何通过...

    音视频-编解码-高昌地区伏羲女娲图像研究宋.pdf

    4. **图像分析**:在音视频编解码领域,图像分析涉及到图像特征提取、颜色空间转换、图像质量评估等。这些技术也可以应用于古代图像的研究,帮助识别图像的特征,理解其象征意义和文化背景。 5. **非艺术因素在艺术...

    音视频-编解码-承志堂的图像.pdf

    【音视频编解码与图像处理】 音视频编解码是数字媒体技术中的核心环节,它涉及音频和视频数据的压缩、传输和还原。在音视频处理领域,图像编码是尤为重要的一个方面,因为它直接影响到数据存储、传输效率以及最终的...

    Visual+C++音视频编解码技术及实践(全)

    在音视频处理领域,Visual C++是一个常用的编程工具,它提供了强大的性能和丰富的库支持,使得开发者能够构建复杂的音视频编解码应用。本实践教程将深入探讨如何使用Visual C++进行音视频编解码技术的开发,涵盖了一...

    音视频-编解码-扫描地形图和遥感图像中的目标识别.pdf

    音视频-编解码-扫描地形图和遥感图像中的目标识别 本论文主要研究了音视频编解码技术在扫描地形图和遥感图像中的应用,特别是目标识别领域。通过对音视频编解码技术的深入研究和分析,提出了一种基于深度学习的扫描...

    音视频-编解码-高速图像数据采集与处理技术研究.pdf

    音视频-编解码-高速图像数据采集与处理技术研究 音视频技术在当今社会中扮演着非常重要的角色,特别是在高清晰度图像数据采集和处理方面,音视频技术的应用场景越来越广泛。音视频技术的发展离不开编解码技术、高速...

    音视频-编解码-图像、文字文本与灵视诗学.pdf

    图像处理在音视频编解码中占有核心地位,涉及到图像的像素操作、色彩空间转换、熵编码等步骤。常见的图像编码标准有JPEG(静态图像)和MPEG(运动图像),它们采用了离散余弦变换(DCT)、量化和熵编码等技术来实现...

    VisualCPP音视频编解码技术及实践2.pdf 后端 - C++.zip

    《VisualCPP音视频编解码技术及实践2.pdf》是一本深入探讨C++在音视频处理领域的专业书籍,尤其关注后端开发。本书的核心内容涵盖了音视频编解码的理论基础,C++编程技巧,以及实际应用案例。下面将详细阐述其中的...

    音视频-编解码-良友画报中的图像叙事研究.pdf

    【音视频编解码】与《良友》画报中的图像叙事 《良友》画报,创立于1926年,是中国现代新闻出版史上的一个重要里程碑,它以丰富的摄影图像展示了当时社会生活的多元面貌。尽管标题和描述并未直接涉及“音视频编解码...

    音视频-编解码-视频图像抗晕光研究.pdf

    音视频-编解码-视频图像抗晕光研究.pdf

    音视频-编解码-论维特根斯坦图像论思想.pdf

    【音视频编解码与维特根斯坦图像论思想】 在音视频编解码领域,理解和应用维特根斯坦的图像论思想可以帮助我们更深入地理解数据结构与信息表示的本质。维特根斯坦的图像论是他早期哲学的核心,强调了思想、命题和...

    音视频-编解码-里希特艺术的矛盾性与图像意义研究.pdf

    本文虽然标题提及“里希特艺术的矛盾性与图像意义研究”,但实际上,我们可以从中探讨与音视频编解码相关的图像处理和视觉艺术的概念。 里希特(Gerhard Richter)是一位德国艺术家,他的作品常常挑战摄影与绘画...

    音视频-编解码-猪瘟病毒基因组编码区生物信息学研究.pdf

    【音视频编解码与安全】 音视频编解码技术是数字媒体处理中的核心环节,它涉及到将音频和视频信号转化为数字格式并进行压缩、传输和解压的过程。在这个过程中,编解码器的选择和优化直接影响到音视频的质量、传输...

Global site tag (gtag.js) - Google Analytics