static void draw_rectangle(AVFilterBufferRef *outpic, uint8_t *line[4], int line_step[4],
                           int hsub, int vsub, int x, int y, int w, int h)
{
    int i, plane;
    uint8_t *p;

    for (plane = 0; plane < 4 && outpic->data[plane]; plane++) {
        int hsub1 = plane == 1 || plane == 2 ? hsub : 0;
        int vsub1 = plane == 1 || plane == 2 ? vsub : 0;

        p = outpic->data[plane] + (y >> vsub1) * outpic->linesize[plane];
        for (i = 0; i < (h >> vsub1); i++) {
            memcpy(p + (x >> hsub1) * line_step[plane], line[plane], (w >> hsub1) * line_step[plane]);
            p += outpic->linesize[plane];
        }
    }
}