Revision 90a3ffe2 libavcodec/a64multienc.c

View differences:

libavcodec/a64multienc.c
33 33
#define DITHERSTEPS   8
34 34
#define CHARSET_CHARS 256
35 35
#define INTERLACED    1
36
#define CROP_SCREENS  1
36 37

  
37 38
/* gray gradient */
38 39
static const int mc_colors[5]={0x0,0xb,0xc,0xf,0x1};
......
245 246
    AVFrame *const p = (AVFrame *) & c->picture;
246 247

  
247 248
    int frame;
248
    int a;
249
    int x, y;
250
    int b_height;
251
    int b_width;
249 252

  
250 253
    int req_size;
251 254
    int num_frames = c->mc_lifetime;
......
257 260
    int *best_cb         = c->mc_best_cb;
258 261

  
259 262
    int charset_size = 0x800 * (INTERLACED + 1);
260
    int screen_size  = 0x400;
263
    int screen_size;
261 264
    int colram_size  = 0x100 * c->mc_use_5col;
262 265

  
266
    if(CROP_SCREENS) {
267
        b_height = FFMIN(avctx->height,C64YRES) >> 3;
268
        b_width  = FFMIN(avctx->width ,C64XRES) >> 3;
269
        screen_size = b_width * b_height;
270
    } else {
271
        b_height = C64YRES >> 3;
272
        b_width  = C64XRES >> 3;
273
        screen_size = 0x400;
274
    }
275

  
263 276
    /* no data, means end encoding asap */
264 277
    if (!data) {
265 278
        /* all done, end encoding */
......
312 325
        /* write x frames to buf */
313 326
        for (frame = 0; frame < c->mc_lifetime; frame++) {
314 327
            /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */
315
            for (a = 0; a < 1000; a++) {
316
                buf[a] = charmap[a];
328
            for (y = 0; y < b_height; y++) {
329
                for (x = 0; x < b_width; x++) {
330
                    buf[y * b_width + x] = charmap[y * b_width + x];
331
                }
317 332
            }
318 333
            /* advance pointers */
319 334
            buf += screen_size;

Also available in: Unified diff