[FFmpeg-devel] [PATCH] OpenEXR decoder

Diego Biurrun diego
Wed Jul 1 15:10:54 CEST 2009


On Wed, Jul 01, 2009 at 02:46:54PM +0200, Jimmy Christensen wrote:
> 
> --- libavcodec/exr.c	(revision 0)
> +++ libavcodec/exr.c	(revision 0)
> @@ -0,0 +1,275 @@
> +
> +static inline uint16_t exr_halflt2uint(uint16_t v) {

consistent K&R style for new files please.

> +    int xmin = -1;
> +    int xmax = -1;
> +    int ymin = -1;
> +    int ymax = -1;
> +    int xdelta = -1;

align

> +    uint8_t red_channel = -1;
> +    uint8_t green_channel = -1;
> +    uint8_t blue_channel = -1;

align

> +    if (magic_number != 20000630) { // As per documentation of OpenEXR it's supposed to be int 20000630 little endian

little-endian

> +        if (strcmp(variable_buffer_name, "dataWindow") == 0) {
> +            xmin = AV_RL32(buf);
> +            ymin = AV_RL32(buf+4);
> +            xmax = AV_RL32(buf+8);
> +            ymax = AV_RL32(buf+12);
> +            xdelta = (xmax-xmin)+1;

Spaces around + would make this more readable.

> +        if (strcmp(variable_buffer_name, "displayWindow") == 0) {
> +
> +        if (strcmp(variable_buffer_name, "lineOrder") == 0) {

The '== 0' is unnecessary.

> +            if(*buf != 0) {

similar

> +    switch(bits_per_color_table[bits_per_color_id]) {

switch (

> +        switch(bits_per_color_table[bits_per_color_id]) {

ditto

> +    // Zero out the end if ymax+1 is not h
> +    for(y = ymax; y < avctx->height; y++) {

for (

The rest looks OK from my side.

Diego



More information about the ffmpeg-devel mailing list