-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP : Crop #444
base: master
Are you sure you want to change the base?
WIP : Crop #444
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
#include "tofe_eeprom.h" | ||
#include "uptime.h" | ||
#include "version.h" | ||
|
||
#include "crop.h" | ||
#include "ci.h" | ||
|
||
int status_enabled; | ||
|
@@ -97,18 +97,37 @@ static void help_heartbeat(void) | |
wputs(" heartbeat <on/off> - Turn on/off heartbeat feature"); | ||
} | ||
|
||
static void help_crop(void) | ||
{ | ||
wputs("change crop status (alias: 'cr')"); | ||
wputs(" crop <on/off> - Turn on/off crop feature"); | ||
} | ||
|
||
static void heartbeat_enable(void) | ||
{ | ||
hb_status(true); | ||
wprintf("Heartbeat enabled\n"); | ||
} | ||
|
||
static void crop_enable(void) | ||
{ | ||
crop_status(true); | ||
wprintf("crop enable\n"); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra new line |
||
static void heartbeat_disable(void) | ||
{ | ||
hb_status(false); | ||
wprintf("Heartbeat disabled\n"); | ||
} | ||
|
||
static void crop_disable(void) | ||
{ | ||
|
||
crop_status(false); | ||
wprintf("crop disabled\n"); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. extra new line |
||
#ifdef CSR_HDMI_OUT0_BASE | ||
static void help_output0(void) | ||
{ | ||
|
@@ -191,6 +210,7 @@ static void ci_help(void) | |
wputs("mdio_status - show mdio status"); | ||
#endif | ||
wputs("pattern (p) - select next pattern"); | ||
wputs("version - show firmware version"); | ||
wputs(""); | ||
help_status(); | ||
wputs(""); | ||
|
@@ -202,6 +222,9 @@ static void ci_help(void) | |
wputs(""); | ||
help_hdp_toggle(); | ||
wputs(""); | ||
help_crop(); | ||
wputs(""); | ||
|
||
#ifdef CSR_HDMI_OUT0_BASE | ||
help_output0(); | ||
wputs(""); | ||
|
@@ -1134,6 +1157,15 @@ void ci_service(void) | |
token = get_token(&str); | ||
hdp_toggle(atoi(token)); | ||
} | ||
else if((strcmp(token, "crop") == 0) || (strcmp(token, "cr") == 0)) { | ||
token = get_token(&str); | ||
if((strcmp(token, "on") == 0) ) | ||
crop_enable(); | ||
else if((strcmp(token, "off") == 0) ) | ||
crop_disable(); | ||
else | ||
help_crop(); | ||
} | ||
#ifdef CSR_HDMI_OUT0_BASE | ||
else if((strcmp(token, "output0") == 0) || (strcmp(token, "o0") == 0)) { | ||
token = get_token(&str); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
|
||
#include <generated/csr.h> | ||
#include <generated/mem.h> | ||
#include <hw/flags.h> | ||
#include <system.h> | ||
#include <time.h> | ||
|
||
#include "hdmi_in0.h" | ||
#include "hdmi_in1.h" | ||
#include "crop.h" | ||
#include "processor.h" | ||
#include "pattern.h" | ||
#include "stdio_wrap.h" | ||
|
||
static bool crop_stat = false; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra new line |
||
void crop_status(bool val) | ||
{ | ||
crop_stat = val; | ||
} | ||
|
||
void crop_service(fb_ptrdiff_t fb_offset,int top) | ||
{ | ||
static int last_event; | ||
static int counter; | ||
static bool color_v; | ||
|
||
if (crop_stat==1) { | ||
crop_fill(color_v, fb_offset,top); | ||
} | ||
} | ||
|
||
void crop_fill(bool color_v, fb_ptrdiff_t fb_offset,int top) | ||
{ | ||
int addr1,addr2,addr3,addr4, i, j,k; | ||
unsigned int color; | ||
unsigned int *framebuffer = fb_ptrdiff_to_main_ram(fb_offset); | ||
|
||
addr1 = 0 + (processor_h_active/2)*(processor_v_active-top); | ||
addr2 = 0; | ||
addr3 = 0 + (processor_h_active/2)*top + (processor_h_active/2) - top; | ||
addr4 = 0 + (processor_h_active/2)*top; | ||
|
||
for (i=0; i<processor_h_active/2; i++) | ||
{ | ||
for (j=0; j<processor_v_active - top; j++) | ||
{ | ||
framebuffer[addr1+i+(processor_h_active/2)*j] = YCBCR422_BLACK; | ||
} | ||
for (k=0; k<top; k++) | ||
{ | ||
framebuffer[addr2+i+(processor_h_active/2)*k] = YCBCR422_BLACK; | ||
} | ||
} /*Bottom clipping & top clipping*/ | ||
|
||
for (i=0; i<top; i++) | ||
{ | ||
for (j=0; j<processor_v_active - top; j++) | ||
{ | ||
framebuffer[addr3+i+(processor_h_active/2)*j] = YCBCR422_BLACK; | ||
} | ||
for (k=0; k<processor_v_active-top; k++) | ||
{ | ||
framebuffer[addr4+i+(processor_h_active/2)*k] = YCBCR422_BLACK; | ||
} | ||
|
||
} /*right clipping & left clipping*/ | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef __CROP_H | ||
#define __CROP_H | ||
|
||
#include <stdbool.h> | ||
#include "framebuffer.h" | ||
|
||
void crop_status(bool val); | ||
void crop_service(fb_ptrdiff_t fb_offset,int top) ; | ||
void crop_fill(bool color_v, fb_ptrdiff_t fb_offset,int top); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra new line here needs to be removed