35 #define CHARSET_CHARS 256
37 #define CROP_SCREENS 1
65 static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
73 int blockx, blocky, x,
y;
79 for (blocky = 0; blocky <
C64YRES; blocky += 8) {
80 for (blockx = 0; blockx <
C64XRES; blockx += 8) {
81 for (y = blocky; y < blocky + 8 && y <
C64YRES; y++) {
82 for (x = blockx; x < blockx + 8 && x <
C64XRES; x += 2) {
83 if(x < width && y < height) {
85 luma = (src[(x + 0 + y * p->
linesize[0])] +
86 src[(x + 1 + y * p->
linesize[0])]) / 2;
105 int lowdiff, highdiff;
115 for (a=0; a < 256; a++) {
116 if(i < c->mc_pal_size -1 && a == c->
mc_luma_vals[i + 1]) {
132 for (y = 0; y < 8; y++) {
134 for (x = 0; x < 4; x++) {
135 pix = best_cb[y * 4 + x];
138 if (index1[pix] >= 3)
148 row1 |= 3-(index2[pix] & 3);
150 row1 |= 3-(index1[pix] & 3);
153 row2 |= 3-(index2[pix] & 3);
155 row2 |= 3-(index1[pix] & 3);
159 row1 |= 3-(index2[pix] & 3);
161 row1 |= 3-(index1[pix] & 3);
164 charset[y+0x000] = row1;
168 if (highdiff > 0 && lowdiff > 0 && c->
mc_use_5col) {
169 if (lowdiff > highdiff) {
170 for (x = 0; x < 32; x++)
173 for (x = 0; x < 32; x++)
184 colrammap[charpos] = (highdiff > 0);
261 for (a = 0; a < 256; a++) {
262 temp = colram[charmap[a + 0x000]] << 0;
263 temp |= colram[charmap[a + 0x100]] << 1;
264 temp |= colram[charmap[a + 0x200]] << 2;
265 if (a < 0xe8) temp |= colram[charmap[a + 0x300]] << 3;
271 const AVFrame *pict,
int *got_packet)
297 screen_size = b_width * b_height;
335 req_size = charset_size + c->
mc_lifetime*(screen_size + colram_size);
348 memcpy(buf, charset, charset_size);
352 charset += charset_size;
358 for (y = 0; y < b_height; y++) {
359 for (x = 0; x < b_width; x++) {
360 buf[y * b_width + x] = charmap[y * b_width + x];
365 req_size += screen_size;
372 req_size += colram_size;
389 pkt->
size = req_size;
391 *got_packet = !!req_size;
396 #if CONFIG_A64MULTI_ENCODER
397 AVCodec ff_a64multi_encoder = {
410 #if CONFIG_A64MULTI5_ENCODER
411 AVCodec ff_a64multi5_encoder = {
420 .long_name =
NULL_IF_CONFIG_SMALL(
"Multicolor charset for Commodore 64, extended with 5th color (colram)"),