comparison a64multienc.c @ 12429:305987348a98 libavcodec

Clarify code/avoid possible bugs by using precalculated values that are used for extradata as well
author bindhammer
date Thu, 26 Aug 2010 10:03:06 +0000
parents 06453ad84991
children 10b5a51810f9
comparison
equal deleted inserted replaced
12428:06453ad84991 12429:305987348a98
289 289
290 /* create colorram map and a c64 readable charset */ 290 /* create colorram map and a c64 readable charset */
291 render_charset(avctx, charset, colram); 291 render_charset(avctx, charset, colram);
292 292
293 /* copy charset to buf */ 293 /* copy charset to buf */
294 memcpy(buf,charset,0x800*(INTERLACED+1)); 294 memcpy(buf,charset, charset_size);
295 295
296 /* advance pointers */ 296 /* advance pointers */
297 buf += 0x800*(INTERLACED+1); 297 buf += charset_size;
298 charset += 0x800*(INTERLACED+1); 298 charset += charset_size;
299 req_size += 0x800*(INTERLACED+1); 299 req_size += charset_size;
300 } 300 }
301 /* no charset so clean buf */ 301 /* no charset so clean buf */
302 else memset(buf,0,0x800*(INTERLACED+1)); 302 else memset(buf, 0, charset_size);
303 303
304 /* write x frames to buf */ 304 /* write x frames to buf */
305 for (frame = 0; frame < c->mc_lifetime; frame++) { 305 for (frame = 0; frame < c->mc_lifetime; frame++) {
306 /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */ 306 /* copy charmap to buf. buf is uchar*, charmap is int*, so no memcpy here, sorry */
307 for (a = 0; a < 1000; a++) { 307 for (a = 0; a < 1000; a++) {
308 buf[a] = charmap[a]; 308 buf[a] = charmap[a];
309 } 309 }
310 /* advance pointers */ 310 /* advance pointers */
311 buf += 0x400; 311 buf += screen_size;
312 req_size += 0x400; 312 req_size += screen_size;
313 313
314 /* compress and copy colram to buf */ 314 /* compress and copy colram to buf */
315 if(c->mc_use_5col) { 315 if(c->mc_use_5col) {
316 a64_compress_colram(buf,charmap,colram); 316 a64_compress_colram(buf,charmap,colram);
317 /* advance pointers */ 317 /* advance pointers */
318 buf += 0x100; 318 buf += colram_size;
319 req_size += 0x100; 319 req_size += colram_size;
320 } 320 }
321 321
322 /* advance to next charmap */ 322 /* advance to next charmap */
323 charmap += 1000; 323 charmap += 1000;
324 } 324 }