35 #define CHARSET_CHARS 256
37 #define CROP_SCREENS 1
62 static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
70 int blockx, blocky, x,
y;
76 for (blocky = 0; blocky <
C64YRES; blocky += 8) {
77 for (blockx = 0; blockx <
C64XRES; blockx += 8) {
78 for (y = blocky; y < blocky + 8 && y <
C64YRES; y++) {
79 for (x = blockx; x < blockx + 8 && x <
C64XRES; x += 2) {
80 if(x < width && y < height) {
82 luma = (src[(x + 0 + y * p->
linesize[0])] +
83 src[(x + 1 + y * p->
linesize[0])]) / 2;
102 int lowdiff, highdiff;
112 for (a=0; a < 256; a++) {
113 if(i < c->mc_pal_size -1 && a == c->
mc_luma_vals[i + 1]) {
129 for (y = 0; y < 8; y++) {
131 for (x = 0; x < 4; x++) {
132 pix = best_cb[y * 4 + x];
135 if (index1[pix] >= 3)
145 row1 |= 3-(index2[pix] & 3);
147 row1 |= 3-(index1[pix] & 3);
150 row2 |= 3-(index2[pix] & 3);
152 row2 |= 3-(index1[pix] & 3);
156 row1 |= 3-(index2[pix] & 3);
158 row1 |= 3-(index1[pix] & 3);
161 charset[y+0x000] = row1;
165 if (highdiff > 0 && lowdiff > 0 && c->
mc_use_5col) {
166 if (lowdiff > highdiff) {
167 for (x = 0; x < 32; x++)
170 for (x = 0; x < 32; x++)
181 colrammap[charpos] = (highdiff > 0);
263 for (a = 0; a < 256; a++) {
264 temp = colram[charmap[a + 0x000]] << 0;
265 temp |= colram[charmap[a + 0x100]] << 1;
266 temp |= colram[charmap[a + 0x200]] << 2;
267 if (a < 0xe8) temp |= colram[charmap[a + 0x300]] << 3;
273 const AVFrame *pict,
int *got_packet)
299 screen_size = b_width * b_height;
337 req_size = charset_size + c->
mc_lifetime*(screen_size + colram_size);
350 memcpy(buf, charset, charset_size);
354 charset += charset_size;
360 for (y = 0; y < b_height; y++) {
361 for (x = 0; x < b_width; x++) {
362 buf[y * b_width + x] = charmap[y * b_width + x];
367 req_size += screen_size;
374 req_size += colram_size;
391 pkt->
size = req_size;
393 *got_packet = !!req_size;
398 #if CONFIG_A64MULTI_ENCODER
399 AVCodec ff_a64multi_encoder = {
412 #if CONFIG_A64MULTI5_ENCODER
413 AVCodec ff_a64multi5_encoder = {
415 .long_name =
NULL_IF_CONFIG_SMALL(
"Multicolor charset for Commodore 64, extended with 5th color (colram)"),