91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

C/C++實現(基于算法和基于查表)的G711編解碼算法,并封裝為AvG711類,簡單易用,信手拈來~

資源截圖

代碼片段和文件信息

#include?“AvG711.h“
#include?“g711.h“
#include?
#include?
#include?

AvG711::AvG711(AvG711Fmt?fmt)?{

fmt_?=?fmt;
}

AvG711::~AvG711()?{

}

int?AvG711::encode(unsigned?char?**odata?unsigned?char?*idata?int?ilen)?{

if?(ilen?>?0)?{

int?olen?=?ilen?/?2;
*odata?=?(unsigned?char?*)malloc(sizeof(unsigned?char)?*?olen);
if?(*odata)?{

if(fmt_?==?AvG711Fmt_Alaw)?
return?g711a_encode(*odata?(short?*)idata?ilen);
else?if(fmt_?==?AvG711Fmt_Ulaw)
return?g711u_encode(*odata?(short?*)idata?ilen);
}
}
return?-1;
}

int?AvG711::encode(const?char?*g711_file?const?char?*pcm_file)?{

FILE?*ifile?=?fopen(pcm_file?“rb“);
FILE?*ofile?=?fopen(g711_file?“wb“);
if?(ifile?&&?ofile)?{

int?r?=?-1;
do?{

unsigned?char?ibuf[160];
r?=?fread(ibuf?1?160?ifile);
if?(r?>?0)?{

unsigned?char?*obuf;
int?olen?=?encode(&obuf?ibuf?r);
fwrite(obuf?1?olen?ofile);
free_output_data(obuf);
memset(ibuf?0?sizeof(ibuf));
}
}?while?(r?>?0);
fclose(ifile);
fclose(ofile);
return?0;
}
return?-1;
}

int?AvG711::decode(unsigned?char?**odata?unsigned?char?*idata?int?ilen)?{

if?(ilen?>?0)?{

int?olen?=?ilen?*?2;
*odata?=?(unsigned?char?*)malloc(sizeof(unsigned?char)?*?olen);
if?(*odata)?{

if?(fmt_?==?AvG711Fmt_Alaw)
return?g711a_decode((short?*)(*odata)?idata?ilen);
else?if?(fmt_?==?AvG711Fmt_Ulaw)
return?g711u_decode((short?*)(*odata)?idata?ilen);
}
}
return?-1;
}

int?AvG711::decode(const?char?*pcm_file?const?char?*g711_file)?{

FILE?*ifile?=?fopen(g711_file?“rb“);
FILE?*ofile?=?fopen(pcm_file?“wb“);
if?(ifile?&&?ofile)?{

int?r?=?-1;
do?{

unsigned?char?ibuf[80];
r?=?fread(ibuf?1?80?ifile);
if?(r?>?0)?{

unsigned?char?*obuf;
int?olen?=?decode(&obuf?ibuf?r);
fwrite(obuf?1?olen?ofile);
free_output_data(obuf);
memset(ibuf?0?sizeof(ibuf));
}
}?while?(r?>?0);
fclose(ifile);
fclose(ofile);
return?0;
}
return?-1;
}

void?AvG711::free_output_data(unsigned?char?*odata)?{

free(odata);
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2188??2019-11-21?15:39??g711\AvG711.cpp

?????文件????????786??2019-11-21?15:38??g711\AvG711.h

?????文件?????157362??2019-11-21?15:56??g711\g711.cpp

?????文件????????908??2019-11-21?15:56??g711\g711.h

?????目錄??????????0??2019-12-02?18:59??g711

-----------?---------??----------?-----??----

???????????????161244????????????????????5


評論

共有 條評論