comparison png.c @ 4515:a2b14c6fccfd libavcodec

consistency renaming: rgba32 --> rgb32
author diego
date Mon, 12 Feb 2007 23:07:17 +0000
parents ce643a22f049
children 6166fbf375cc
comparison
equal deleted inserted replaced
4514:790d1cb93686 4515:a2b14c6fccfd
342 break; 342 break;
343 } 343 }
344 } 344 }
345 345
346 #ifdef CONFIG_ENCODERS 346 #ifdef CONFIG_ENCODERS
347 static void convert_from_rgba32(uint8_t *dst, const uint8_t *src, int width) 347 static void convert_from_rgb32(uint8_t *dst, const uint8_t *src, int width)
348 { 348 {
349 uint8_t *d; 349 uint8_t *d;
350 int j; 350 int j;
351 unsigned int v; 351 unsigned int v;
352 352
361 } 361 }
362 } 362 }
363 #endif 363 #endif
364 364
365 #ifdef CONFIG_DECODERS 365 #ifdef CONFIG_DECODERS
366 static void convert_to_rgba32(uint8_t *dst, const uint8_t *src, int width) 366 static void convert_to_rgb32(uint8_t *dst, const uint8_t *src, int width)
367 { 367 {
368 int j; 368 int j;
369 unsigned int r, g, b, a; 369 unsigned int r, g, b, a;
370 370
371 for(j = 0;j < width; j++) { 371 for(j = 0;j < width; j++) {
390 /* need to swap bytes correctly for RGB_ALPHA */ 390 /* need to swap bytes correctly for RGB_ALPHA */
391 if (s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { 391 if (s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
392 png_filter_row(s->tmp_row, s->crow_buf[0], s->crow_buf + 1, 392 png_filter_row(s->tmp_row, s->crow_buf[0], s->crow_buf + 1,
393 s->last_row, s->row_size, s->bpp); 393 s->last_row, s->row_size, s->bpp);
394 memcpy(s->last_row, s->tmp_row, s->row_size); 394 memcpy(s->last_row, s->tmp_row, s->row_size);
395 convert_to_rgba32(ptr, s->tmp_row, s->width); 395 convert_to_rgb32(ptr, s->tmp_row, s->width);
396 } else { 396 } else {
397 /* in normal case, we avoid one copy */ 397 /* in normal case, we avoid one copy */
398 if (s->y == 0) 398 if (s->y == 0)
399 last_row = s->last_row; 399 last_row = s->last_row;
400 else 400 else
420 s->last_row, s->pass_row_size, s->bpp); 420 s->last_row, s->pass_row_size, s->bpp);
421 memcpy(s->last_row, s->tmp_row, s->pass_row_size); 421 memcpy(s->last_row, s->tmp_row, s->pass_row_size);
422 got_line = 1; 422 got_line = 1;
423 } 423 }
424 if ((png_pass_dsp_ymask[s->pass] << (s->y & 7)) & 0x80) { 424 if ((png_pass_dsp_ymask[s->pass] << (s->y & 7)) & 0x80) {
425 /* NOTE: rgba32 is handled directly in png_put_interlaced_row */ 425 /* NOTE: RGB32 is handled directly in png_put_interlaced_row */
426 png_put_interlaced_row(ptr, s->width, s->bits_per_pixel, s->pass, 426 png_put_interlaced_row(ptr, s->width, s->bits_per_pixel, s->pass,
427 s->color_type, s->last_row); 427 s->color_type, s->last_row);
428 } 428 }
429 s->y++; 429 s->y++;
430 if (s->y == s->height) { 430 if (s->y == s->height) {
880 if (pass_row_size > 0) { 880 if (pass_row_size > 0) {
881 for(y = 0; y < avctx->height; y++) { 881 for(y = 0; y < avctx->height; y++) {
882 if ((png_pass_ymask[pass] << (y & 7)) & 0x80) { 882 if ((png_pass_ymask[pass] << (y & 7)) & 0x80) {
883 ptr = p->data[0] + y * p->linesize[0]; 883 ptr = p->data[0] + y * p->linesize[0];
884 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) { 884 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
885 convert_from_rgba32(tmp_buf, ptr, avctx->width); 885 convert_from_rgb32(tmp_buf, ptr, avctx->width);
886 ptr1 = tmp_buf; 886 ptr1 = tmp_buf;
887 } else { 887 } else {
888 ptr1 = ptr; 888 ptr1 = ptr;
889 } 889 }
890 png_get_interlaced_row(crow_buf + 1, pass_row_size, 890 png_get_interlaced_row(crow_buf + 1, pass_row_size,
898 } 898 }
899 } else { 899 } else {
900 for(y = 0; y < avctx->height; y++) { 900 for(y = 0; y < avctx->height; y++) {
901 ptr = p->data[0] + y * p->linesize[0]; 901 ptr = p->data[0] + y * p->linesize[0];
902 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) 902 if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
903 convert_from_rgba32(crow_buf + 1, ptr, avctx->width); 903 convert_from_rgb32(crow_buf + 1, ptr, avctx->width);
904 else 904 else
905 memcpy(crow_buf + 1, ptr, row_size); 905 memcpy(crow_buf + 1, ptr, row_size);
906 crow_buf[0] = PNG_FILTER_VALUE_NONE; 906 crow_buf[0] = PNG_FILTER_VALUE_NONE;
907 png_write_row(s, crow_buf, row_size + 1); 907 png_write_row(s, crow_buf, row_size + 1);
908 } 908 }