📄 btcinit.c
字号:
/*
*********************************************************************************
* Copyright (c) National Mobile Communications Research Laboratory.
* All rights reserved.
*
* FILE NAME : BTCinit.c
* ABSTRUCT:
* This file is the C file for BTC parameter allocation.
*
* AUTHOR: Zhang Tao 2007-02-12
*
*********************************************************************************
*/
/*
*********************************************************************************
* INCLUDE FILES
*********************************************************************************
*/
#include <stdio.h>
#include "BTCstruct.h"
/*
*********************************************************************************
* Function Definition
*********************************************************************************
*/
/*
*********************************************************************************
* NAME: BTCInit
* PURPOSE: perform the BTC parameter allocation.
*
* Input: encoded_len: the length of the encoded bits.
* rate: 1 for 1/2; 3 for 3/4.
*
* Output: BTC : the parameter for the BTC.
*
* AUTHOR: Zhang Tao 2007-02-12
*
*********************************************************************************
*/
void BTCInit(int encoded_len,int rate,BTCstruct *BTC)
{
switch(encoded_len)
{
case 96:
if(rate==1)
(*BTC).msg_len = 48;
else
(*BTC).msg_len = 72;
break;
case 192:
if(rate==1)
(*BTC).msg_len = 96;
else
(*BTC).msg_len = 160;
break;
case 288:
if(rate==1)
(*BTC).msg_len = 144;
else
(*BTC).msg_len = 200;
break;
case 384:
if(rate==1)
(*BTC).msg_len = 184;
else
(*BTC).msg_len = 280;
break;
case 480:
(*BTC).msg_len = 248;
break;
case 576:
(*BTC).msg_len = 320;
break;
}
switch((*BTC).msg_len)
{
case 48:
(*BTC).kx = 7; (*BTC).ky = 26; (*BTC).nx = 8; (*BTC).ny = 32; (*BTC).r_type = 0;
(*BTC).c_type = 4; (*BTC).Ix = 4; (*BTC).Iy = 8; (*BTC).B = 0; (*BTC).Q = 6;
break;
case 72:
(*BTC).kx = 15; (*BTC).ky = 15; (*BTC).nx = 16; (*BTC).ny = 16; (*BTC).r_type = 1;
(*BTC).c_type = 1; (*BTC).Ix = 6; (*BTC).Iy = 6; (*BTC).B = 4; (*BTC).Q = 5;
break;
case 96:
(*BTC).kx = 31; (*BTC).ky = 11; (*BTC).nx = 32; (*BTC).ny = 16; (*BTC).r_type = 2;
(*BTC).c_type = 3; (*BTC).Ix = 14; (*BTC).Iy = 5; (*BTC).B = 6; (*BTC).Q = 0;
break;
case 144:
(*BTC).kx = 31; (*BTC).ky = 11; (*BTC).nx = 32; (*BTC).ny = 16; (*BTC).r_type = 2;
(*BTC).c_type = 3; (*BTC).Ix = 5; (*BTC).Iy = 5; (*BTC).B = 9; (*BTC).Q = 3;
break;
case 160:
(*BTC).kx = 15; (*BTC).ky = 15; (*BTC).nx = 16; (*BTC).ny = 16; (*BTC).r_type = 1;
(*BTC).c_type = 1; (*BTC).Ix = 2; (*BTC).Iy = 2; (*BTC).B = 4; (*BTC).Q = 5;
break;
case 200:
(*BTC).kx = 7; (*BTC).ky = 57; (*BTC).nx = 8; (*BTC).ny = 64; (*BTC).r_type = 0;
(*BTC).c_type = 5; (*BTC).Ix = 2; (*BTC).Iy = 16; (*BTC).B = 0; (*BTC).Q = 5;
break;
case 184:
(*BTC).kx = 26; (*BTC).ky = 11; (*BTC).nx = 32; (*BTC).ny = 16; (*BTC).r_type = 4;
(*BTC).c_type = 3; (*BTC).Ix = 4; (*BTC).Iy = 2; (*BTC).B = 8; (*BTC).Q = 6;
break;
case 280:
(*BTC).kx = 26; (*BTC).ky = 15; (*BTC).nx = 32; (*BTC).ny = 16; (*BTC).r_type = 4;
(*BTC).c_type = 1; (*BTC).Ix = 0; (*BTC).Iy = 4; (*BTC).B = 0; (*BTC).Q = 6;
break;
case 248:
(*BTC).kx = 26; (*BTC).ky = 26; (*BTC).nx = 32; (*BTC).ny = 32; (*BTC).r_type = 4;
(*BTC).c_type = 4; (*BTC).Ix = 10; (*BTC).Iy = 10; (*BTC).B = 4; (*BTC).Q = 4;
break;
case 320:
(*BTC).kx = 26; (*BTC).ky = 26; (*BTC).nx = 32; (*BTC).ny = 32; (*BTC).r_type = 4;
(*BTC).c_type = 4; (*BTC).Ix = 8; (*BTC).Iy = 8; (*BTC).B = 0; (*BTC).Q = 4;
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -