/* ANSI C Source Code
* Code_HDB3.c
* Leon 5.11.2008
*/
#include "HDB3.h"
// 判1还是0
// 1 是0
// 1.1 零的长度小于3
// 1.1.1 是第一个0并且V_frist_z_define=1(小段里面的第一个零)
// frist_z_pos=num;frist_z_pole=-uni_pole;V_frist_z_define=0;
// code=0;z_num++
// 1.2 零的长度是3
// 1.2.1 如果V不等于+-1,则V=-pole;//这是初始
// code=-V;
// V=-V;
// V_frist_z_define=1;
// z_num=0;
// 1.2.2 如果V_num是偶数
// in[frist_z_pos]=frist_z_pole;pole=V;
// if(code!=0) uni_pole;
// in[num]=code;
// 2 是1
// 2.1 code=-pole;
// pole=code;
// uni_pole=code;
// in[num]=code;
void Code_HDB(int *in,int *out,struct Code_control *state)
{
int num=0;
int code;
state->z_num=0; //开始时0的个数为0
while(in[num]!=2)
{
if(in[num]==0)
{
if(state->z_num<3)
{
if((state->z_num==0)&&(state->V_frist_z_define==1))
{
state->frist_z_pos=num;
state->frist_z_pole=-state->uni_pole;
state->V_frist_z_define=0;
}
code=0;
state->z_num++;
}
else
{
if((state->V!=1)&&(state->V!=-1)) state->V=-state->pole; //初始V
code=-state->V;
state->V*=-1;
state->V_frist_z_define=1;
state->z_num=0;
if(((state->V_num)%2==0)&&(state->V_num>=0)) {out[state->frist_z_pos]=state->frist_z_pole;state->pole=state->V;}
state->V_num=0;
}
if(code!=0) state->uni_pole=code;
out[num]=code;
}
else
{
code=-state->pole;
state->pole*=-1;
state->uni_pole=code;
state->z_num=0;
state->V_num++;
out[num]=code;
}
num++;
}
out[num]=2;
}
HDB3.rar_HDB3_hdb3 c++
版权申诉
44 浏览量
2022-09-14
15:16:02
上传
评论 1
收藏 3KB RAR 举报
![avatar](https://profile-avatar.csdnimg.cn/3b38fb294f114a0a8dfd7bc633aed231_weixin_42660494.jpg!1)
alvarocfc
- 粉丝: 114
- 资源: 1万+
最新资源
- elasticsearch数据库下载、配置、使用案例
- springboot的概要介绍与分析
- C语言的概要介绍与分析
- 第一个较大的Android项目,基于Android平台的图书管理系统(Android studio).zip
- Cisco Packet Tracer 6.2 for Windows Instructor Version
- 使⽤pyIAST计算⽓体吸附选择性
- tmp_b056727e59b8123365486983f32baa9732607ec3c6137b12.pdf
- C代码实现文件的拆分和合并,本质上就是文件的读写操作.zip
- TVMP3player.apk.1
- 出马出马出马出马出马出马出马
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)