forked from M-Labs/artiq
1
0
Fork 0

grabber: fix frame size off-by-1

This commit is contained in:
Robert Jördens 2018-09-07 15:30:04 +02:00
parent ec62eb9373
commit 312256a18d
2 changed files with 12 additions and 6 deletions

View File

@ -134,8 +134,12 @@ pub fn tick() {
if clock_pattern_ok(g) {
let last_xy = get_last_pixels(g);
if last_xy != unsafe { INFO[g].frame_size } {
// x capture is on ~LVAL which is after
// the last increment on DVAL
// y capture is on ~FVAL which coincides with the
// last increment on ~LVAL
info!("grabber{} frame size: {}x{}",
g, last_xy.0 + 1, last_xy.1 + 1);
g, last_xy.0, last_xy.1 + 1);
unsafe { INFO[g].frame_size = last_xy }
}
State::Watch

View File

@ -89,14 +89,16 @@ class Parser(Module, AutoCSR):
pix.x.eq(pix.x + 1),
),
If(~lval,
If(last_lval, last_x.eq(pix.x)),
pix.x.eq(0),
If(last_fval & last_lval,
If(last_lval,
last_x.eq(pix.x),
pix.y.eq(pix.y + 1)
)
),
pix.x.eq(0)
),
If(~fval,
If(last_fval, last_y.eq(pix.y)),
If(last_fval,
last_y.eq(pix.y)
),
pix.y.eq(0)
)
]