mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
videotestsrc: Simplify ARGB to Bayer conversion
Simplify the conversion to bayer pattern as suggested by Nicolas Dufresne. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4686>
This commit is contained in:
parent
d0efb05f52
commit
e569b8ba1e
1 changed files with 4 additions and 16 deletions
|
@ -1688,23 +1688,11 @@ convert_hline_bayer (paintinfo * p, GstVideoFrame * frame, int y)
|
|||
gint width = GST_VIDEO_FRAME_WIDTH (frame);
|
||||
int x_inv = p->x_invert;
|
||||
int y_inv = p->y_invert;
|
||||
int y_offset = 1 - ((y ^ y_inv) & 1);
|
||||
|
||||
if ((y ^ y_inv) & 1) {
|
||||
for (i = 0; i < width; i++) {
|
||||
if ((i ^ x_inv) & 1) {
|
||||
R[i] = argb[4 * i + 1];
|
||||
} else {
|
||||
R[i] = argb[4 * i + 2];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < width; i++) {
|
||||
if ((i ^ x_inv) & 1) {
|
||||
R[i] = argb[4 * i + 2];
|
||||
} else {
|
||||
R[i] = argb[4 * i + 3];
|
||||
}
|
||||
}
|
||||
for (i = 0; i < width; i++) {
|
||||
int x_offset = 2 - ((i ^ x_inv) & 1);
|
||||
R[i] = argb[4 * i + y_offset + x_offset];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue