Skip to content

Commit

Permalink
Update some #defines for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSB committed May 28, 2021
1 parent 756c7c3 commit 26ef6f1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5867,7 +5867,7 @@ void osd_update(uint32_t *osd_base, int bytes_per_line) {
break;
}

if (((capinfo->sizex2 & 1) && capinfo->nlines > FONT_THRESHOLD * 10) && (bufferCharWidth >= LINELEN) && allow1220font) { // if frame buffer is large enough and not 8bpp use SAA5050 font
if (((capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT) && capinfo->nlines > FONT_THRESHOLD * 10) && (bufferCharWidth >= LINELEN) && allow1220font) { // if frame buffer is large enough and not 8bpp use SAA5050 font
for (int line = 0; line <= osd_hwm; line++) {
int attr = attributes[line];
int len = (attr & ATTR_DOUBLE_SIZE) ? (LINELEN >> 1) : LINELEN;
Expand Down Expand Up @@ -6104,7 +6104,7 @@ void __attribute__ ((aligned (64))) osd_update_fast(uint32_t *osd_base, int byte
break;
}

if (((capinfo->sizex2 & 1) && capinfo->nlines > FONT_THRESHOLD * 10) && (bufferCharWidth >= LINELEN) && allow1220font) { // if frame buffer is large enough and not 8bpp use SAA5050 font
if (((capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT) && capinfo->nlines > FONT_THRESHOLD * 10) && (bufferCharWidth >= LINELEN) && allow1220font) { // if frame buffer is large enough and not 8bpp use SAA5050 font
for (int line = 0; line <= osd_hwm; line++) {
int attr = attributes[line];
int len = (attr & ATTR_DOUBLE_SIZE) ? (LINELEN >> 1) : LINELEN;
Expand Down
16 changes: 8 additions & 8 deletions src/rgb_to_fb.S
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ rgb_to_fb:
// Sanity check nlines <= fb_height
ldr r3, param_fb_height
ldr r10, param_fb_sizex2
ands r10, r10, #1
ands r10, r10, #SIZEX2_DOUBLE_HEIGHT
movne r3, r3, lsr #1
ldr r2, param_nlines
cmp r2, r3
Expand Down Expand Up @@ -228,12 +228,12 @@ skip_swap:
orreq r3, r3, r10
#endif
ldr r9, param_fb_sizex2
tst r9, #1
tst r9, #SIZEX2_DOUBLE_HEIGHT
bicne r3, r3, #BIT_NO_LINE_DOUBLE
orreq r3, r3, #BIT_NO_LINE_DOUBLE
tst r9, #4
tst r9, #SIZEX2_BASIC_SCANLINES
orrne r3, r3, #BIT_NO_LINE_DOUBLE
bicne r9, #1
bicne r9, #SIZEX2_DOUBLE_HEIGHT

ldr r8, param_video_type
cmp r8, #VIDEO_INTERLACED
Expand Down Expand Up @@ -646,8 +646,8 @@ skip_fix_vsync_jitter:
subeq r11, r11, r2
nointadj:
ldr r6, param_fb_sizex2
eor r6, r6, #1
tst r6, #1 //now 0 if double height
eor r6, r6, #SIZEX2_DOUBLE_HEIGHT
tst r6, #SIZEX2_DOUBLE_HEIGHT //now 0 if double height
tsteq r3, #BIT_INTERLACED_VIDEO
addeq r11, r11, r2
tst r3, #BIT_ELK
Expand Down Expand Up @@ -788,7 +788,7 @@ process_line_loop:
strne r0, total_hsync_period

ldr r10, param_fb_sizex2
tst r10, #1
tst r10, #SIZEX2_DOUBLE_HEIGHT
// Skip a whole line to maintain aspect ratio
addne r11, r11, r2, lsl #1
addeq r11, r11, r2
Expand Down Expand Up @@ -824,7 +824,7 @@ skip_all_lines:
bne check_dpms

ldr r8, param_fb_sizex2
tst r8, #2
tst r8, #SIZEX2_DOUBLE_WIDTH
moveq r8, #ARTIFACT_DETECTED_LINE_COUNT
movne r8, #(ARTIFACT_DETECTED_LINE_COUNT << 1)

Expand Down
22 changes: 11 additions & 11 deletions src/rgb_to_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,15 @@ static int last_height = -1;
if (get_gscaling() == GSCALING_INTEGER) {
if (!((capinfo->video_type == VIDEO_TELETEXT && get_m7scaling() == SCALING_UNEVEN)
||(capinfo->video_type != VIDEO_TELETEXT && get_normalscaling() == SCALING_UNEVEN))) {
int width = adjusted_width >> ((capinfo->sizex2 & 2) >> 1);
int width = adjusted_width >> ((capinfo->sizex2 & SIZEX2_DOUBLE_WIDTH) >> 1);
int hscale = h_size / width;
h_overscan = h_size - (hscale * width);
adj_h_overscan = h_overscan;
if ((hscale & 1) != 0 && hscale > 1) { // add 1 when scale is odd number to work around pixel column duplication scaler rounding error
adj_h_overscan++;
}
}
int height = capinfo->height >> (capinfo->sizex2 & 1);
int height = capinfo->height >> (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT);
int vscale = v_size / height;
v_overscan = v_size - (vscale * height);
adj_v_overscan = v_overscan;
Expand Down Expand Up @@ -1756,7 +1756,7 @@ int extra_flags() {
if (autoswitch != AUTOSWITCH_PC || !sub_profiles_available(profile)) {
extra |= BIT_NO_AUTOSWITCH;
}
if (!scanlines || ((capinfo->sizex2 & 1) == 0) || (capinfo->video_type == VIDEO_TELETEXT) || osd_active()) {
if (!scanlines || ((capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT) == 0) || (capinfo->video_type == VIDEO_TELETEXT) || osd_active()) {
extra |= BIT_NO_SCANLINES;
}
if (osd_active()) {
Expand Down Expand Up @@ -1884,11 +1884,11 @@ int *diff_N_frames_by_sample(capture_info_t *capinfo, int n, int mode7, int elk)
// Compare the frames
uint32_t *fbp = (uint32_t *)(capinfo->fb + ((ret >> OFFSET_LAST_BUFFER) & 3) * capinfo->height * capinfo->pitch + capinfo->v_adjust * capinfo->pitch);
uint32_t *lastp = (uint32_t *)last + capinfo->v_adjust * (capinfo->pitch >> 2);
for (int y = 0; y < (capinfo->nlines << (capinfo->sizex2 & 1)); y++) {
for (int y = 0; y < (capinfo->nlines << (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT)); y++) {
int skip = 0;
// Calculate the capture scan line number (allowing for a double hight framebuffer)
// (capinfo->height is the framebuffer height after any doubling)
int line = (capinfo->sizex2 & 1) ? (y >> 1) : y;
int line = (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT) ? (y >> 1) : y;
// As v_offset increases, e.g. by one, the screen image moves up one capture line
// (the hardcoded constant of 21 relates to the BBC video format)
line += (capinfo->v_offset - 21);
Expand Down Expand Up @@ -2083,7 +2083,7 @@ signed int analyze_mode7_alignment(capture_info_t *capinfo) {
// Count the pixels
uint32_t *fbp_line;

for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & 1); line++) {
for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT); line++) {
int index = 0;
fbp_line = fbp;
for (int byte = 0; byte < (capinfo->chars_per_line << 2); byte += 4) {
Expand Down Expand Up @@ -2171,7 +2171,7 @@ signed int analyze_default_alignment(capture_info_t *capinfo) {
if (capinfo->bpp == 4)
{

for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & 1); line++) {
for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT); line++) {
int index = 0;
fbp_line = fbp;
for (int byte = 0; byte < (capinfo->chars_per_line << 2); byte += 4) {
Expand All @@ -2189,7 +2189,7 @@ signed int analyze_default_alignment(capture_info_t *capinfo) {
}

} else {
for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & 1); line++) {
for (int line = 0; line < capinfo->nlines << (capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT); line++) {
int index = 0;
fbp_line = fbp;
for (int byte = 0; byte < (capinfo->chars_per_line << 2); byte += 4) {
Expand Down Expand Up @@ -2854,7 +2854,7 @@ int is_genlocked() {
}

void calculate_fb_adjustment() {
int double_height = capinfo->sizex2 & 1;
int double_height = capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT;
capinfo->v_adjust = (capinfo->height >> double_height) - capinfo->nlines;
if (capinfo->v_adjust < 0) {
capinfo->v_adjust = 0;
Expand Down Expand Up @@ -3359,8 +3359,8 @@ int show_detected_status(int line) {
osd_set(line++, 0, message);
sprintf(message, " Pixel Aspect: %d:%d", get_haspect(), get_vaspect());
osd_set(line++, 0, message);
int double_width = (capinfo->sizex2 & 2) >> 1;
int double_height = capinfo->sizex2 & 1;
int double_width = (capinfo->sizex2 & SIZEX2_DOUBLE_WIDTH) >> 1;
int double_height = capinfo->sizex2 & SIZEX2_DOUBLE_HEIGHT;
sprintf(message, " Capture Size: %d x %d (%d x %d)", capinfo->chars_per_line << (3 - double_width), capinfo->nlines, capinfo->chars_per_line << 3, capinfo->nlines << double_height );
osd_set(line++, 0, message);
sprintf(message, " H & V range: %d-%d x %d-%d", capinfo->h_offset, capinfo->h_offset + (capinfo->chars_per_line << (3 - double_width)) - 1, capinfo->v_offset, capinfo->v_offset + capinfo->nlines - 1);
Expand Down

0 comments on commit 26ef6f1

Please sign in to comment.