"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "image_utils.c" between
minidlna-1.1.4.tar.gz and minidlna-1.1.5.tar.gz

About: ReadyMedia (formerly known as MiniDLNA) is a simple media server software, with the aim of being fully compliant with DLNA/UPnP-AV clients.

image_utils.c  (minidlna-1.1.4):image_utils.c  (minidlna-1.1.5)
skipping to change at line 212 skipping to change at line 212
void void
image_free(image_s *pimage) image_free(image_s *pimage)
{ {
free(pimage->buf); free(pimage->buf);
free(pimage); free(pimage);
} }
pix pix
get_pix(image_s *pimage, int32_t x, int32_t y) get_pix(image_s *pimage, int32_t x, int32_t y)
{ {
if((x >= 0) && (y >= 0) && (x < pimage->width) && (y < pimage->height)) if (x < 0)
{ x = 0;
return(pimage->buf[(y * pimage->width) + x]); else if (x >= pimage->width)
} x = pimage->width - 1;
else
{ if (y < 0)
pix vpix = BLACK; y = 0;
return(vpix); else if (y >= pimage->height)
} y = pimage->height - 1;
return(pimage->buf[(y * pimage->width) + x]);
} }
void void
put_pix_alpha_replace(image_s *pimage, int32_t x, int32_t y, pix col) put_pix_alpha_replace(image_s *pimage, int32_t x, int32_t y, pix col)
{ {
if((x >= 0) && (y >= 0) && (x < pimage->width) && (y < pimage->height)) if((x >= 0) && (y >= 0) && (x < pimage->width) && (y < pimage->height))
pimage->buf[(y * pimage->width) + x] = col; pimage->buf[(y * pimage->width) + x] = col;
} }
int int
skipping to change at line 455 skipping to change at line 457
{ {
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
if( is_file && file ) if( is_file && file )
fclose(file); fclose(file);
return NULL; return NULL;
} }
jpeg_read_header(&cinfo, TRUE); jpeg_read_header(&cinfo, TRUE);
cinfo.scale_denom = scale; cinfo.scale_denom = scale;
cinfo.do_fancy_upsampling = FALSE; cinfo.do_fancy_upsampling = FALSE;
cinfo.do_block_smoothing = FALSE; cinfo.do_block_smoothing = FALSE;
cinfo.dct_method = JDCT_IFAST;
jpeg_start_decompress(&cinfo); jpeg_start_decompress(&cinfo);
w = cinfo.output_width; w = cinfo.output_width;
h = cinfo.output_height; h = cinfo.output_height;
vimage = (rotate & (ROTATE_90|ROTATE_270)) ? image_new(h, w) : image_new( w, h); vimage = (rotate & (ROTATE_90|ROTATE_270)) ? image_new(h, w) : image_new( w, h);
if(!vimage) if(!vimage)
{ {
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
if( is_file ) if( is_file )
fclose(file); fclose(file);
return NULL; return NULL;
skipping to change at line 524 skipping to change at line 527
rx = (rotate & (ROTATE_180|ROTATE_270)) ? (x - w + 1) * -1 : x; rx = (rotate & (ROTATE_180|ROTATE_270)) ? (x - w + 1) * -1 : x;
ofs = (rotate & (ROTATE_90|ROTATE_270)) ? ry + (r x * h) : rx + (ry * w); ofs = (rotate & (ROTATE_90|ROTATE_270)) ? ry + (r x * h) : rx + (ry * w);
if( ofs < maxbuf ) if( ofs < maxbuf )
vimage->buf[ofs] = COL(ptr[x + x + x], pt r[x + x + x + 1], ptr[x + x + x + 2]); vimage->buf[ofs] = COL(ptr[x + x + x], pt r[x + x + x + 1], ptr[x + x + x + 2]);
} }
} }
free(ptr); free(ptr);
} }
else if(cinfo.output_components == 1) else if(cinfo.output_components == 1)
{ {
int rx, ry;
ofs = 0; ofs = 0;
for(i = 0; i < cinfo.rec_outbuf_height; i++) for(i = 0; i < cinfo.rec_outbuf_height; i++)
{ {
if((line[i] = malloc(w)) == NULL) if((line[i] = malloc(w)) == NULL)
{ {
int t = 0; int t = 0;
for(t = 0; t < i; t++) free(line[t]); for(t = 0; t < i; t++) free(line[t]);
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
image_free(vimage); image_free(vimage);
if( is_file ) if( is_file )
fclose(file); fclose(file);
return NULL; return NULL;
} }
} }
for(y = 0; y < h; y += cinfo.rec_outbuf_height) for(y = 0; y < h; y += cinfo.rec_outbuf_height)
{ {
ry = (rotate & (ROTATE_90|ROTATE_180)) ? (y - h + 1) * -1 : y;
jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height ); jpeg_read_scanlines(&cinfo, line, cinfo.rec_outbuf_height );
for(i = 0; i < cinfo.rec_outbuf_height; i++) for(i = 0; i < cinfo.rec_outbuf_height; i++)
{ {
for(x = 0; x < w; x++) for(x = 0; x < w; x++)
{ {
vimage->buf[ofs++] = COL(line[i][x], line rx = (rotate & (ROTATE_180|ROTATE_270)) ?
[i][x], line[i][x]); (x - w + 1) * -1 : x;
ofs = (rotate & (ROTATE_90|ROTATE_270)) ?
ry + (rx * h) : rx + (ry * w);
if( ofs < maxbuf )
vimage->buf[ofs] =
COL(line[i][x], line[i][x
], line[i][x]);
} }
} }
} }
for(i = 0; i < cinfo.rec_outbuf_height; i++) for(i = 0; i < cinfo.rec_outbuf_height; i++)
{ {
free(line[i]); free(line[i]);
} }
} }
jpeg_finish_decompress(&cinfo); jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo); jpeg_destroy_decompress(&cinfo);
 End of changes. 5 change blocks. 
11 lines changed or deleted 22 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS