[vlc-devel] [PATCH v3] codec: jpeg encoder implemented

Rafaël Carré funman at videolan.org
Fri Jan 31 12:10:12 CET 2014


On 01/29/14 17:15, Maxim Bublis wrote:

>> Really, no way to operate on the picture buffers directly?
>>
>>> +    }
>>> +
>>> +    while (p_jpeg.next_scanline < p_jpeg.image_height)
>>> +    {
>>> +        for (int i = 0; i < p_pic->i_planes; i++)
>>> +        {
>>> +            for (int j = 0; j < p_jpeg.comp_info[i].v_samp_factor *
>> DCTSIZE; j++)
>>> +            {
>>> +                p_row_pointers[i][j] = p_pic->p[i].p_pixels +
>> p_pic->p[i].i_pitch * p_jpeg.next_scanline *
>> p_jpeg.comp_info[i].v_samp_factor / p_jpeg.max_v_samp_factor + j;
>>> +            }
>>> +        }
>>> +        jpeg_write_raw_data(&p_jpeg, p_row_pointers,
>> p_jpeg.max_v_samp_factor * DCTSIZE);
>>> +    }
>>
> 
> Maybe you could advice me how to do that without additional allocations.
> JSAMPARRAY is a 3-dimensional array, top index is color component. Each
> element is a JSAMPARRAY - 2-dimensional array of row pointers.
> We are having p_pic->p[i].p_pixels, which is a plane array of pixels for
> each color component.


Something like:

p_row_pointers[i] = &p_pic->p[i].p_pixels[p_pic->p[i].i_pitch *
p_jpeg.next_scanline * p_jpeg.comp_info[i].v_samp_factor /
p_jpeg.max_v_samp_factor];

?



More information about the vlc-devel mailing list