Exemplo n.º 1
0
static void	wb_image_c (GstTisWhiteBalance* self, GstBuffer* buf, byte wb_r, byte wb_g, byte wb_b)
{
    guint8 *data = (guint8*)GST_BUFFER_DATA (buf);

    unsigned int dim_x = self->width;
    unsigned int dim_y = self->height;

    guint pitch = 8 * dim_x / 8;

    tBY8Pattern odd = next_line(self->pattern);

    guint y;
    for (y = 0 ; y < (dim_y - 1); y += 2)
    {
        byte* line0 = data + y * pitch;
        byte* line1 = data + (y + 1) * pitch;

        wb_line_c(line0, line0, dim_x, wb_r, wb_g, wb_b, self->pattern);
        wb_line_c(line1, line1, dim_x, wb_r, wb_g, wb_b, odd);
    }

    if (y == (dim_y - 1))
    {
        byte* line = data + y * pitch;
        wb_line_c(line, line, dim_x, wb_r, wb_g, wb_b, self->pattern);
    }
}
Exemplo n.º 2
0
static void	wb_image_c (GstTcamWhitebalance* self, GstBuffer* buf, byte wb_r, byte wb_g, byte wb_b)
{
    GstMapInfo info;
    gst_buffer_make_writable(buf);

    gst_buffer_map(buf, &info, GST_MAP_WRITE);

    guint* data = (guint*)info.data;

    unsigned int dim_x = self->image_size.width;
    unsigned int dim_y = self->image_size.height;

    guint pitch = 8 * dim_x / 8;

    tBY8Pattern odd = next_line(self->pattern);

    guint y;
    for (y = 0 ; y < (dim_y - 1); y += 2)
    {
        byte* line0 = (byte*)data + y * pitch;
        byte* line1 = (byte*)data + (y + 1) * pitch;

        wb_line_c(line0, line0, dim_x, wb_r, wb_g, wb_b, self->pattern);
        wb_line_c(line1, line1, dim_x, wb_r, wb_g, wb_b, odd);
    }

    if (y == (dim_y - 1))
    {
        byte* line = (byte*)data + y * pitch;
        wb_line_c(line, line, dim_x, wb_r, wb_g, wb_b, self->pattern);
    }

    gst_buffer_unmap(buf, &info);
}