diff --git a/CMakeLists.txt b/CMakeLists.txt index cdac3c1..1d0a994 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ project(tensorPattern) # Let's set a version number. # This file must be manually changed to effect version change. -set (VERSION_MAJOR 0) +set (VERSION_MAJOR 1) set (VERSION_MINOR 0) set (VERSION_PATCH 0) set (VERSION_PRERELEASE) @@ -23,6 +23,10 @@ add_compile_options(-Wall -g) # Libraries # find_package(SDL COMPONENTS TTF IMAGE GFX REQUIRED) - Later versions. +find_package(SDL) +if ( NOT SDL_FOUND ) + message(FATAL_ERROR "SDL not found! Please install libsdl1.2-dev!") +endif ( NOT SDL_FOUND ) # Verbose output (or use: make VERBOSE=1) #set ( CMAKE_VERBOSE_MAKEFILE on ) diff --git a/README.txt b/README.txt index 46a7e9f..c6ad44e 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ -Tensor pattern generation - Version 0.0.0 - Test patterns. +Tensor pattern generation - Version 1.0.0 - Brief tensor / SDL demo - red / mod -These patterns output as UDP to the tensor wall. There are no previews in this -version. +These patterns output as UDP to the tensor wall. There is a preview window +using SDL. Build instructions: @@ -12,7 +12,6 @@ Build instructions: Binaries can be found in build/bin. -The script in the scripts directory was meant to run a pattern for 20 seconds, -kill it, then move on to the next. If used, it should be customized for your -environment. +There are two orphaned binaries in the bin directory. The code that produced +them doesn't seem to exist anymore. diff --git a/bin/blue-wave-left_a2 b/bin/blue-wave-left_a2 deleted file mode 100755 index 8981dfc..0000000 Binary files a/bin/blue-wave-left_a2 and /dev/null differ diff --git a/bin/blue-wave-up_a b/bin/blue-wave-up_a deleted file mode 100755 index 5121500..0000000 Binary files a/bin/blue-wave-up_a and /dev/null differ diff --git a/bin/color-cycle-ugly_colors b/bin/color-cycle-ugly_colors deleted file mode 100755 index a36302d..0000000 Binary files a/bin/color-cycle-ugly_colors and /dev/null differ diff --git a/bin/fade_mod_test_brief b/bin/fade_mod_test_brief new file mode 100755 index 0000000..e5a3de9 Binary files /dev/null and b/bin/fade_mod_test_brief differ diff --git a/bin/green-wave-up_adf b/bin/green-wave-up_adf deleted file mode 100755 index 9f58e8e..0000000 Binary files a/bin/green-wave-up_adf and /dev/null differ diff --git a/bin/magenta-green-ortho-scaler_pl b/bin/magenta-green-ortho-scaler_pl deleted file mode 100755 index 90d0eec..0000000 Binary files a/bin/magenta-green-ortho-scaler_pl and /dev/null differ diff --git a/bin/red-parabaloid-modular_a3 b/bin/red-parabaloid-modular_a3 deleted file mode 100755 index 4040b4c..0000000 Binary files a/bin/red-parabaloid-modular_a3 and /dev/null differ diff --git a/bin/red_mod_unkillable b/bin/red_mod_unkillable new file mode 100755 index 0000000..3d91f19 Binary files /dev/null and b/bin/red_mod_unkillable differ diff --git a/bin/rgb-hash-sort_ick b/bin/rgb-hash-sort_ick deleted file mode 100755 index af86960..0000000 Binary files a/bin/rgb-hash-sort_ick and /dev/null differ diff --git a/bin/tensor b/bin/tensor new file mode 100755 index 0000000..8c03933 Binary files /dev/null and b/bin/tensor differ diff --git a/bin/test1_bayard b/bin/test1_bayard deleted file mode 100755 index 116c37a..0000000 Binary files a/bin/test1_bayard and /dev/null differ diff --git a/scripts/tensor.sh b/scripts/tensor.sh deleted file mode 100644 index 9096485..0000000 --- a/scripts/tensor.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash -# -# Make tensor easier. -# Joshua Krueger -# 05_19_2008 - -export TENSOR_PATH="/home/sherman/tensor" - -stopit() { - ps -fea | while read -r bline ; do - if [[ ! -z "$(echo $bline | grep $TENSOR_PATH)" ]] ; then - this="$(echo $bline | while read -r bl bl bl bl bl bl bl oi ; do echo $oi ; done)" - killall -9 $this 1>&2 2>/dev/null - fi - done - exit 1 -} - -trap stopit 2 - -# Check the net -if [[ -z "$(ifconfig | grep eth0:0)" ]] ; then - sudo ifconfig eth0 add 10.5.1.99 - if [[ -z "$(ifconfig | grep eth0:0)" ]] ; then - echo "Josh sucks. This won't work." - exit 1 - else - sudo ifconfig eth0:0 netmask 255.255.255.0 - fi -fi - -if [[ "$#" == "0" ]] ; then - echo "Usage: tensor " - echo " tensor all []" - echo - echo " Available patterns:" - ls ${TENSOR_PATH} | while read -r aline ; do - echo " $aline" - done - echo - exit 1 -fi - -if [[ "$1" == "all" ]] ; then - if [[ "$#" == "2" ]] ; then - second="${2}" - fi - - while [[ 1 ]] ; do - ls ${TENSOR_PATH} | while read -r aline ; do - ${TENSOR_PATH}/${aline} & - sleep ${second:-20} - killall -9 ${TENSOR_PATH}/${aline} 1>&2 2>/dev/null - done - done -fi - - -if [[ -e "${TENSOR_PATH}/${1}" ]] ; then - $TENSOR_PATH/${1} -else - echo "Pattern \"$1\" not recognized. Valid patterns are:" - ls ${TENSOR_PATH} | while read -r aline ; do - echo " $aline" - done - echo - exit 1 -fi - - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9e1ef4..1820cbf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,31 +2,17 @@ # Created 2014_11_14 by Argyle # Define the executable source - same as project name. -add_executable (blue-wave-left_a2 blue-wave-left_a2.c) -add_executable (blue-wave-up_a blue-wave-up_a.c) -add_executable (color-cycle-ugly_colors color-cycle-ugly_colors.c) -add_executable (green-wave-up_adf green-wave-up_adf.c) -add_executable (magenta-green-ortho-scaler_pl magenta-green-ortho-scaler_pl.c) -add_executable (red-parabaloid-modular_a3 red-parabaloid-modular_a3.c) -add_executable (rgb-hash-sort_ick rgb-hash-sort_ick.c) -add_executable (test1_bayard test1_bayard.c) +add_executable (tensor test1.c) # Configure the version header - not used yet. configure_file("version.h.in" "version.h") add_library(drv-tensor drv-tensor.c) # Included directories -include_directories(${PROJECT_BINARY_DIR}/bin) +include_directories(${PROJECT_BINARY_DIR}/bin ${SDL_INCLUDE_DIR}) # Linked Libraries -target_link_libraries(blue-wave-left_a2 drv-tensor) -target_link_libraries(blue-wave-up_a drv-tensor) -target_link_libraries(color-cycle-ugly_colors drv-tensor) -target_link_libraries(green-wave-up_adf drv-tensor) -target_link_libraries(magenta-green-ortho-scaler_pl drv-tensor) -target_link_libraries(red-parabaloid-modular_a3 drv-tensor) -target_link_libraries(rgb-hash-sort_ick drv-tensor) -target_link_libraries(test1_bayard drv-tensor) +target_link_libraries(tensor drv-tensor ${SDL_LIBRARY}) # file(COPY font.ttf Fbyte-01.jpg DESTINATION ${PROJECT_BINARY_DIR}/bin) - not yet diff --git a/src/Makefile.old b/src/Makefile.old deleted file mode 100644 index 5c85404..0000000 --- a/src/Makefile.old +++ /dev/null @@ -1,34 +0,0 @@ -SRCS = drv-tensor.c -OBJS = $(SRCS:.c=.o) - -.c.o: - $(CC) $(CFLAGS) $(INCLUDES) -c $*.c - -blue-wave-left_a2: $(OBJS) blue-wave-left_a2.o - $(CC) $(CFLAGS) $(OBJS) blue-wave-left_a2.o -o blue-wave-left_a2 - -blue-wave-up_a: $(OBJS) blue-wave-up_a.o - $(CC) $(CFLAGS) $(OBJS) blue-wave-up_a.o -o blue-wave-up_a - -color-cycle-ugly_colors: $(OBJS) color-cycle-ugly_colors.o - $(CC) $(CFLAGS) $(OBJS) color-cycle-ugly_colors.o -o color-cycle-ugly_colors - -green-wave-up_adf: $(OBJS) green-wave-up_adf.o - $(CC) $(CFLAGS) $(OBJS) green-wave-up_adf.o -o green-wave-up_adf - -magenta-green-ortho-scaler_pl: $(OBJS) magenta-green-ortho-scaler_pl.o - $(CC) $(CFLAGS) $(OBJS) magenta-green-ortho-scaler_pl.o -o magenta-green-ortho-scaler_pl - -red-parabaloid-modular_a3: $(OBJS) red-parabaloid-modular_a3.o - $(CC) $(CFLAGS) $(OBJS) red-parabaloid-modular_a3.o -o red-parabaloid-modular_a3 - -rgb-hash-sort_ick: $(OBJS) rgb-hash-sort_ick.o - $(CC) $(CFLAGS) $(OBJS) rgb-hash-sort_ick.o -o rgb-hash-sort_ick - -test1_bayard: $(OBJS) test1_bayard.o - $(CC) $(CFLAGS) $(OBJS) test1_bayard.o -o test1_bayard - -all: rgb-hash-sort_ick red-parabaloid-modular_a3 magenta-green-ortho-scaler_pl green-wave-up_adf color-cycle-ugly_colors blue-wave-up_a blue-wave-left_a2 test1_bayard - -clean:; - rm -f core core.* *.o blue-wave-left_a2 blue-wave-up_a color-cycle-ugly_colors green-wave-up_adf magenta-green-ortho-scaler_pl red-parabaloid-modular_a3 rgb-hash-sort_ick test1_bayard diff --git a/src/blue-wave-left_a2.c b/src/blue-wave-left_a2.c deleted file mode 100644 index d21cf16..0000000 --- a/src/blue-wave-left_a2.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count += 1; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - - for(x=0;x -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count += 1; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - for(y=0;y -#include -#include -#include -#include "drv-tensor.h" - -typedef struct { - unsigned char r; - unsigned char g; - unsigned char b; -} color_t; - -void blit(int x, int y, unsigned char *fb, color_t color); -void reset(unsigned char *fb, color_t color); - - -int main(void) -{ - int i,count; - // color_t black = {0, 0, 0}; - // color_t white = {255, 255, 255}; - color_t red = {255, 0, 0}; - color_t green = {0,255,0}; - color_t blue = {0,0,255}; - color_t purple = {255, 0, 255}; - color_t cyan = {0, 255,255}; - color_t yellow = {255, 255, 0}; - color_t orange = {255,127,0}; - - color_t array[7] = { red, orange, yellow, green, cyan, blue, purple}; - - // unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - //unsigned char fb[TENSOR_BYTES]; - unsigned char fb[TENSOR_WIDTH][TENSOR_HEIGHT][3]; - unsigned char *fb2 = &fb[0][0][0]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - - printf("Height: %i, Width: %i, Bytes: %i\n", TENSOR_HEIGHT, TENSOR_WIDTH, TENSOR_BYTES); - - printf("H x W: %i, /3: %i\n", TENSOR_HEIGHT * TENSOR_WIDTH, (TENSOR_HEIGHT * TENSOR_WIDTH) / 3); - count = 0; - while(1) { - count ++; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - - for(i=0; i<7; i++) { - reset(fb2, array[i]); - tensor_send(fb2); - usleep(500000); - } - - /* after you've completed a frame buffer, call tensor_send() with - * that framebuffer */ - - } - return(0); -} - - -void blit(int x, int y, unsigned char *fb, color_t color) { -} - -void reset(unsigned char *fb, color_t color) { - int i; - for (i = 0; i < (20 * 9 * 3) ; i+=3) { - fb[i+0] = color.r; - fb[i+1] = color.g; - fb[i+2] = color.b; - } -} diff --git a/src/green-wave-up_adf.c b/src/green-wave-up_adf.c deleted file mode 100644 index a3be9bd..0000000 --- a/src/green-wave-up_adf.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - //int i; - unsigned char r,g,b; - //double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count++; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - for(y=0;y -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - unsigned char r,g,b; - //double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count++; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - for(y=0;y -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count += 1; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - - for(x=0;x -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - // int i; - unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count++; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - for(y=0;y +#include +#include +#include +#include "drv-tensor.h" +#ifdef USE_SDL + #include "SDL.h" +#endif + +// Use 1/3 +#define TENSOR_WIDTH_EFF (TENSOR_HEIGHT) +#define TENSOR_HEIGHT_EFF (TENSOR_WIDTH / 3) +#define TENSOR_BYTES_EFF (TENSOR_WIDTH_EFF * TENSOR_HEIGHT_EFF * 3) +#define TENSOR_PREVIEW_WIDTH (TENSOR_WIDTH_EFF * PSIZE_X) +#define TENSOR_PREVIEW_HEIGHT (TENSOR_HEIGHT_EFF * PSIZE_Y) + +// Typedefs +typedef struct { + unsigned char r; + unsigned char g; + unsigned char b; +} color_t; + +typedef enum { + UP, DOWN, LEFT, RIGHT +} dir_t; + + +// Globals +unsigned char fb[TENSOR_BYTES_EFF]; // Tensor frame buffer +const color_t white = {.r = 255, .g = 255, .b = 255}; +const color_t black = {.r = 0, .g = 0, .b = 0}; +#ifdef USE_SDL +SDL_Surface *screen; +#endif + + +// Protos +void SetPixel(int x, int y, color_t color); +color_t GetPixel(int x, int y); +void ColorAll(color_t color); +void Update(void); +void FadeAll(int dec); +#ifdef USE_SDL + void UpdatePreview(void); +#endif + + + +// Functions +int main(void) { + int x,y,count; + color_t pixel_color; + color_t oldColor; + + // Init the display window. + #ifdef USE_SDL + if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) { + fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } else { + atexit(SDL_Quit); + } + + screen = SDL_SetVideoMode(TENSOR_PREVIEW_WIDTH + (BORDER * 2), TENSOR_PREVIEW_HEIGHT + (BORDER * 2), 32, SDL_SWSURFACE); + if (screen == NULL) { + fprintf(stderr, "Unable to set video size: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + #endif + + // Init tensor. + tensor_init(); + tensor_landscape_p = 1; // Landscape mode. + + + // Pattern loop. + ColorAll(white); + Update(); + + int i; + for (i = 0; i < 255; i+=4) { + FadeAll(4); + Update(); + } + + count = 0; + while(count < 200) { + count++; + + // Give each pixel a color value. + for(x = 0 ; x < TENSOR_WIDTH_EFF ; x++) { + for(y = 0 ; y < TENSOR_HEIGHT_EFF ; y++) { + oldColor = GetPixel(x,y); + + pixel_color.r = ((x * y) - count) + (oldColor.r / 2); + pixel_color.g = oldColor.g + pixel_color.r; + pixel_color.b = 0; + + SetPixel(x, y, pixel_color); + } + } + + Update(); + } + + + for (i = 0; i < 255; i+=4) { + FadeAll(4); + Update(); + } + + exit(EXIT_SUCCESS); +} + + + +void ColorAll(color_t color) { + int x,y; + for (x = 0; x < TENSOR_WIDTH_EFF; x++) { + for (y = 0; y < TENSOR_HEIGHT_EFF; y++) { + SetPixel(x,y,color); + } + } +} + +void FadeAll(int dec) { + int x,y; + color_t oldColor; + + for (x = 0; x < TENSOR_WIDTH_EFF; x++) { + for (y = 0; y < TENSOR_HEIGHT_EFF; y++) { + oldColor = GetPixel(x,y); + if (oldColor.r < dec) { + oldColor.r = 0; + } else { + oldColor.r -= dec; + } + + if (oldColor.g < dec) { + oldColor.g = 0; + } else { + oldColor.g -= dec; + } + + if (oldColor.b < dec) { + oldColor.b = 0; + } else { + oldColor.b -= dec; + } + + SetPixel(x,y,oldColor); + } + } + + return; +} + +void SetPixel(int x, int y, color_t color) { + fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 0] = color.r; + fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 1] = color.g; + fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 2] = color.b; +} + + + +color_t GetPixel(int x, int y) { + color_t colorTemp; + + colorTemp.r = fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 0]; + colorTemp.g = fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 1]; + colorTemp.b = fb[(y * TENSOR_WIDTH_EFF * 3) + (x * 3) + 2]; + + return colorTemp; +} + + +void Update(void) { + #ifdef USE_SDL + UpdatePreview(); + #endif + + #ifdef USE_TENSOR + tensor_send(fb); + #endif + + usleep(50000); + return; +} + + + +#ifdef USE_SDL +void UpdatePreview(void) { + Uint32 color_sdl; + Uint32 *bufp; + color_t thisColor; + int x,y; + int i,j; + + if (SDL_MUSTLOCK(screen)) { + if (SDL_LockSurface(screen) < 0) { + return; + } + } + + for (x = 0; x < TENSOR_WIDTH_EFF; x++) { + for (y = 0; y < TENSOR_HEIGHT_EFF; y++) { + thisColor = GetPixel(x,y); + color_sdl = SDL_MapRGB(screen->format, (Uint8) thisColor.r, (Uint8) thisColor.g, (Uint8) thisColor.b); + for (i = 0; i < PSIZE_X; i++) { + for (j = 0; j < PSIZE_Y; j++) { + bufp = (Uint32 *) screen->pixels + ( (((y * PSIZE_Y) + j + BORDER) * screen->pitch / 4) + ((x * PSIZE_X) + i + BORDER)); + *bufp = color_sdl; + } + } + } + } + + if (SDL_MUSTLOCK(screen)) { + SDL_UnlockSurface(screen); + } + + SDL_Flip(screen); +} +#endif diff --git a/src/test1_bayard.c b/src/test1_bayard.c deleted file mode 100644 index 6d1cdae..0000000 --- a/src/test1_bayard.c +++ /dev/null @@ -1,54 +0,0 @@ -#include -#include -#include -#include -#include "drv-tensor.h" - -int main(void) -{ - int x,y,count; - unsigned char r,g,b; - // double f; - - /* this is how you should declare your tensor frame buffer */ - - unsigned char fb[TENSOR_BYTES]; - - /* call tensor_init() once, before you call tensor_send() */ - - tensor_init(); - - /* set this flag if you're going to use tensor in landscape mode */ - - tensor_landscape_p = 1; - - count = 0; - while(1) { - count += 1; - - /* NOTICE: in landscape mode, x ranges between 0 and TENSOR_HEIGHT. - * normally, when not in landscape mode, x would range between 0 - * and TENSOR_HEIGHT. similarly, y is constrained by TENSOR_WIDTH - * instead of TENSOR_HEIGHT. */ - - for(x=0;x