/* GMR-1 G/g matrix geneation for FACCH3 */ /* (C) 2011-2016 by Sylvain Munaut * All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ #include #include #include #include #include #include static void copy_bits(ubit_t *dst, int dst_col, int n_col, ubit_t *bits_e) { int i, j; for (i=0; i<4; i++) { for (j=0; j<96; j++) { int si = (104 * i) + ((j < 22) ? j : (j+8)); int di = dst_col + (((i*96)+j) * n_col); dst[di] = bits_e[si]; } } } static int pbm_save_bits(const char *filename, ubit_t *m, int x, int y) { FILE *fh; int i, j; fh = fopen(filename, "w"); if (!fh) return -EPERM; fprintf(fh, "P1\n%d %d\n", x, y); for (i=0; i