34 #define CHARSET_CHARS 256
36 #define CROP_SCREENS 1
39 static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
47 int blockx, blocky, x, y;
51 uint8_t *src = p->
data[0];
53 for (blocky = 0; blocky <
C64YRES; blocky += 8) {
54 for (blockx = 0; blockx <
C64XRES; blockx += 8) {
55 for (y = blocky; y < blocky + 8 && y <
C64YRES; y++) {
56 for (x = blockx; x < blockx + 8 && x <
C64XRES; x += 2) {
57 if(x < width && y < height) {
59 luma = (src[(x + 0 + y * p->
linesize[0])] +
60 src[(x + 1 + y * p->
linesize[0])]) / 2;
79 int lowdiff, highdiff;
81 static uint8_t index1[256];
82 static uint8_t index2[256];
83 static uint8_t
dither[256];
89 for (a=0; a < 256; a++) {
90 if(i < c->mc_pal_size -1 && a == c->
mc_luma_vals[i + 1]) {
106 for (y = 0; y < 8; y++) {
108 for (x = 0; x < 4; x++) {
109 pix = best_cb[y * 4 + x];
112 if (index1[pix] >= 3)
122 row1 |= 3-(index2[pix] & 3);
124 row1 |= 3-(index1[pix] & 3);
127 row2 |= 3-(index2[pix] & 3);
129 row2 |= 3-(index1[pix] & 3);
133 row1 |= 3-(index2[pix] & 3);
135 row1 |= 3-(index1[pix] & 3);
138 charset[y+0x000] = row1;
142 if (highdiff > 0 && lowdiff > 0 && c->
mc_use_5col) {
143 if (lowdiff > highdiff) {
144 for (x = 0; x < 32; x++)
147 for (x = 0; x < 32; x++)
158 colrammap[charpos] = (highdiff > 0);
233 for (a = 0; a < 256; a++) {
234 temp = colram[charmap[a + 0x000]] << 0;
235 temp |= colram[charmap[a + 0x100]] << 1;
236 temp |= colram[charmap[a + 0x200]] << 2;
237 if (a < 0xe8) temp |= colram[charmap[a + 0x300]] << 3;
243 int buf_size,
void *
data)
269 screen_size = b_width * b_height;
313 memcpy(buf,charset, charset_size);
317 charset += charset_size;
318 req_size += charset_size;
321 else memset(buf, 0, charset_size);
326 for (y = 0; y < b_height; y++) {
327 for (x = 0; x < b_width; x++) {
328 buf[y * b_width + x] = charmap[y * b_width + x];
333 req_size += screen_size;
340 req_size += colram_size;
354 if (req_size > buf_size) {
355 av_log(avctx,
AV_LOG_ERROR,
"buf size too small (need %d, got %d)\n", req_size, buf_size);
385 .long_name =
NULL_IF_CONFIG_SMALL(
"Multicolor charset for Commodore 64, extended with 5th color (colram)"),