Added test for tcc and license in some files
This commit is contained in:
parent
b2f43307ff
commit
c9807d3e64
9
Makefile
9
Makefile
|
@ -19,7 +19,12 @@ yaitaa: lib
|
||||||
obj/%.o: src/%.c
|
obj/%.o: src/%.c
|
||||||
$(CC) $(CFLAGS) $^ $(INCLUDES) -DVERSION="\"$(VERSION)\"" -c -o $@
|
$(CC) $(CFLAGS) $^ $(INCLUDES) -DVERSION="\"$(VERSION)\"" -c -o $@
|
||||||
|
|
||||||
testbuild:
|
testbuild: use_clang use_tcc
|
||||||
make clean all CC=clang
|
|
||||||
make clean all
|
make clean all
|
||||||
oclint src/*.c
|
oclint src/*.c
|
||||||
|
|
||||||
|
use_clang:
|
||||||
|
make clean all CC=clang
|
||||||
|
|
||||||
|
use_tcc:
|
||||||
|
make clean all CC=tcc CFLAGS="$(CFLAGS) -DSTBI_NO_SIMD"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* yaitaa - yet another image to ascii art converter
|
* yaitaa - yet another image to ascii art converter
|
||||||
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* yaitaa - yet another image to ascii art converter
|
* yaitaa - yet another image to ascii art converter
|
||||||
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*
|
||||||
|
* yaitaa - yet another image to ascii art converter
|
||||||
|
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#ifndef _FMT_STRINGS_H
|
#ifndef _FMT_STRINGS_H
|
||||||
#define _FMT_STRINGS_H
|
#define _FMT_STRINGS_H
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* yaitaa - yet another image to ascii art converter
|
* yaitaa - yet another image to ascii art converter
|
||||||
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -46,11 +46,8 @@ void mod_braille_main(asc_state_t state)
|
||||||
{
|
{
|
||||||
image_t *img = state.image;
|
image_t *img = state.image;
|
||||||
|
|
||||||
uint8_t braille_char = 0x00;
|
rgba8 bright, dark, block[8];
|
||||||
rgba8 block[8];
|
int dist_max, dist_min, dist;
|
||||||
|
|
||||||
rgba8 color_max, color_min;
|
|
||||||
int dist_max, dist_min, dist_min_d = 0xffffff, dist;
|
|
||||||
|
|
||||||
__bra_start_output(state);
|
__bra_start_output(state);
|
||||||
for (int y = 0; y < img->height; y += 4)
|
for (int y = 0; y < img->height; y += 4)
|
||||||
|
@ -60,35 +57,33 @@ void mod_braille_main(asc_state_t state)
|
||||||
for (int x = 0; x < img->width; x += 2)
|
for (int x = 0; x < img->width; x += 2)
|
||||||
{
|
{
|
||||||
__bra_update2x4(img, block, x, y);
|
__bra_update2x4(img, block, x, y);
|
||||||
color_max = color_min = block[0];
|
|
||||||
|
|
||||||
dist_max = 0;
|
bright = dark = block[0];
|
||||||
dist_min = dist_min_d;
|
dist_max = 0; dist_min = 0xFFFFFF;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
dist = color_difference(block[i], PURE_BLACK);
|
dist = color_difference(block[i], PURE_BLACK);
|
||||||
if (dist < dist_min)
|
if (dist < dist_min)
|
||||||
{
|
{
|
||||||
dist_min = dist;
|
dist_min = dist;
|
||||||
color_min = block[i];
|
dark = block[i];
|
||||||
}
|
}
|
||||||
if (dist > dist_max)
|
if (dist > dist_max)
|
||||||
{
|
{
|
||||||
dist_max = dist;
|
dist_max = dist;
|
||||||
color_max = block[i];
|
bright = block[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
braille_char = 0x00;
|
uint8_t pixel = 0x00;
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
if (__bra_best_match_i(color_min, color_max, block[i]) != 0)
|
if (__bra_best_match_i(dark, bright, block[i]) != 0)
|
||||||
{
|
{
|
||||||
braille_char |= (1 << i);
|
pixel |= (1 << i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
__bra_put_pixel(state, color_min, color_max,
|
__bra_put_pixel(state, dark, bright, pixel, x >= (img->width - 2));
|
||||||
braille_char, x >= (img->width - 2));
|
|
||||||
}
|
}
|
||||||
__bra_end_line(state, final);
|
__bra_end_line(state, final);
|
||||||
}
|
}
|
||||||
|
@ -108,11 +103,6 @@ void __bra_putc_raw(asc_state_t state, uint8_t ch)
|
||||||
fputc(0x80 | ((ccode >> 0) & 0x3f), state.out_file);
|
fputc(0x80 | ((ccode >> 0) & 0x3f), state.out_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __bra_putc_esc(asc_state_t state, uint8_t ch)
|
|
||||||
{
|
|
||||||
fprintf(state.out_file, "\\u28%02x", ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
void __bra_start_output(asc_state_t state)
|
void __bra_start_output(asc_state_t state)
|
||||||
{
|
{
|
||||||
int w = state.image->width / 2, h = state.image->height / 4;
|
int w = state.image->width / 2, h = state.image->height / 4;
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
/*
|
||||||
|
* yaitaa - yet another image to ascii art converter
|
||||||
|
* Copyright (C) 2022 hatkidchan <hatkidchan at gmail dot com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
#ifndef _VERSION_H_
|
#ifndef _VERSION_H_
|
||||||
#define _VERSION_H_
|
#define _VERSION_H_
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue