Craig Shelley <craig@...> writes:

> 
> However the calculations for TRANSFER_REPLACE do not multiply the colour
> components of each pixel by their opacity. See overlayframe.C line 326
> 
>               case TRANSFER_REPLACE: \
>                       r = input1; \
>                       g = input2; \
>                       b = input3; \
>                       a = input4; \
>                       break; \
> 
> This should be changed to something like...
> 
>               case TRANSFER_REPLACE: \
>                       r = input1 * pixel_opacity / max / max; \
>                       g = input2 * pixel_opacity / max / max; \
>                       b = input3 * pixel_opacity / max / max; \
>                       a = input4; \
>                       break; \
> 
> Also, there is chunk of optimisation code in overlayframe.c starting on
> line number 2336 which assumes that in REPLACE mode, the output is just
> a direct copy of the input. This assumption is incorrect when there are
> multiple layers with alpha. So the following block of code has to be
> commented out. 
> 
>       if (mode == TRANSFER_REPLACE && (out_w == in_x2 - in_x1))
>       {
> // if we have transfer replace and x direction is not scaled, PARTY!
>               char bytes_per_pixel =
> input->calculate_bytes_per_pixel(input->get_color_model());
>               int line_len = out_w * bytes_per_pixel;
>               int in_start_byte = in_x1 * bytes_per_pixel;
>               int out_start_byte = out_x1 * bytes_per_pixel;
>               for(int i = pkg->out_row1; i < pkg->out_row2; i++) 
>               {
>                       memcpy (out_rows[i] + out_start_byte, 
>                               in_rows[y_table[i - out_y1]] + in_start_byte , 
>                               line_len);
>               }
> 
>       } 

Hi!
I tried making the changes in the overlayframe.c file, but there still seem to 
be something wrong. The picture becomes sort of greenish now. The bottom layer 
is using a chroma key effect while the next layer is just a solid white png 
with 
50% transparency.

This is how it looks:
http://img546.imageshack.us/img546/6868/cinelerrawrong.png

This is how it should look:
http://img839.imageshack.us/img839/2538/cinelerracorrect.png

/Daniel Helsing


_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra

Reply via email to