📄 v34gen.c
字号:
/* * V34 constant data generator * * Copyright (c) 1999,2000 Fabrice Bellard. * * This code is released under the GNU General Public License version * 2. Please read the file COPYING to know the exact terms of the * license. */#include <stdlib.h>#include <stdio.h>#include <math.h>#include <assert.h>#include "dsp.h"#define V34_SAMPLE_RATE_NUM 10#define V34_SAMPLE_RATE_DEN 3#define V34_SAMPLE_RATE ((2400*V34_SAMPLE_RATE_NUM)/V34_SAMPLE_RATE_DEN)#define V22_TX_FILTER_SIZE (20 * 40)#define RC_FILTER_SIZE 40void find_data_rot(int *data_ptr, int *rot_ptr, int x0, int y0){ int xx,yy,data,rot,x,y; /* find the data & rotation */ for(data=0;data<4;data++) { x = -3 + (data & 1) * 4; y = -3 + (data >> 1) * 4; for(rot=0;rot<4;rot++) { if (x == x0 && y == y0) { *data_ptr = data; *rot_ptr = rot; return; } /* rotate by 90 */ xx = y; yy = -x; x = xx; y = yy; } }}/* 0 : rotation by 180, 1 = rotation by 90 */int classify(int x[2][2]){ int x0, y0, x1, y1,d0,d1,r0,r1; x0 = 2 * x[0][0] - 3; y0 = 2 * x[0][1] - 3; x1 = 2 * x[1][0] - 3; y1 = 2 * x[1][1] - 3; find_data_rot(&d0,&r0,x0,y0); find_data_rot(&d1,&r1,x1,y1); if (((r0 - r1) & 1) == 0) return 0; else return 1;}void gen_table(int nb_trans){ int Y[5],Yt[5], trans, ss[2][3], xx[2][2]; int res, i, y0; printf("u8 trellis_trans_%d[256][4] = {\n", nb_trans); for(y0=0;y0<2;y0++) { for(trans=0;trans<nb_trans;trans++) { printf(" /* trans=%d y0=%d */\n", trans, y0); Yt[1] = trans & 1; Yt[2] = (trans >> 1) & 1; Yt[4] = (trans >> 2) & 1; Yt[3] = (trans >> 3) & 1; for(xx[0][0] = 0; xx[0][0] < 4; xx[0][0]++) for(xx[0][1] = 0; xx[0][1] < 4; xx[0][1]++) for(xx[1][0] = 0; xx[1][0] < 4; xx[1][0]++) for(xx[1][1] = 0; xx[1][1] < 4; xx[1][1]++) { /* (
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -