From 382f22f23ce5e8a0ae01ad5c3be019be3bf553d6 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Wed, 6 Jan 2016 20:40:48 +1100 Subject: [PATCH 01/13] add udp protocol support Former-commit-id: a92810f14cf2af15710a38246a742ca2b94fd3bd --- libsrc/leddevice/CMakeLists.txt | 2 + libsrc/leddevice/LedDeviceFactory.cpp | 9 ++ libsrc/leddevice/LedDeviceUdp.cpp | 165 ++++++++++++++++++++++++++ libsrc/leddevice/LedDeviceUdp.h | 44 +++++++ 4 files changed, 220 insertions(+) create mode 100644 libsrc/leddevice/LedDeviceUdp.cpp create mode 100644 libsrc/leddevice/LedDeviceUdp.h diff --git a/libsrc/leddevice/CMakeLists.txt b/libsrc/leddevice/CMakeLists.txt index d6d4682c..edbf1ba1 100755 --- a/libsrc/leddevice/CMakeLists.txt +++ b/libsrc/leddevice/CMakeLists.txt @@ -32,6 +32,7 @@ SET(Leddevice_HEADERS ${CURRENT_SOURCE_DIR}/LedDevicePiBlaster.h ${CURRENT_SOURCE_DIR}/LedDeviceSedu.h ${CURRENT_SOURCE_DIR}/LedDeviceTest.h + ${CURRENT_SOURCE_DIR}/LedDeviceUdp.h ${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.h ${CURRENT_SOURCE_DIR}/LedDeviceTpm2.h ${CURRENT_SOURCE_DIR}/LedDeviceAtmo.h @@ -53,6 +54,7 @@ SET(Leddevice_SOURCES ${CURRENT_SOURCE_DIR}/LedDevicePiBlaster.cpp ${CURRENT_SOURCE_DIR}/LedDeviceSedu.cpp ${CURRENT_SOURCE_DIR}/LedDeviceTest.cpp + ${CURRENT_SOURCE_DIR}/LedDeviceUdp.cpp ${CURRENT_SOURCE_DIR}/LedDeviceHyperionUsbasp.cpp ${CURRENT_SOURCE_DIR}/LedDevicePhilipsHue.cpp ${CURRENT_SOURCE_DIR}/LedDeviceTpm2.cpp diff --git a/libsrc/leddevice/LedDeviceFactory.cpp b/libsrc/leddevice/LedDeviceFactory.cpp index 85f665a5..6e7b3da8 100755 --- a/libsrc/leddevice/LedDeviceFactory.cpp +++ b/libsrc/leddevice/LedDeviceFactory.cpp @@ -30,6 +30,7 @@ #include "LedDevicePiBlaster.h" #include "LedDeviceSedu.h" #include "LedDeviceTest.h" +#include "LedDeviceUdp.h" #include "LedDeviceHyperionUsbasp.h" #include "LedDevicePhilipsHue.h" #include "LedDeviceTpm2.h" @@ -243,6 +244,14 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig) const std::string output = deviceConfig["output"].asString(); device = new LedDeviceTest(output); } + else if (type == "udp") + { + const std::string output = deviceConfig["output"].asString(); + const unsigned rate = deviceConfig["rate"].asInt(); + const unsigned protocol = deviceConfig["protocol"].asInt(); + const unsigned maxPacket = deviceConfig["maxpacket"].asInt(); + device = new LedDeviceUdp(output, rate, protocol, maxPacket); + } else if (type == "tpm2") { const std::string output = deviceConfig["output"].asString(); diff --git a/libsrc/leddevice/LedDeviceUdp.cpp b/libsrc/leddevice/LedDeviceUdp.cpp new file mode 100644 index 00000000..129eb47f --- /dev/null +++ b/libsrc/leddevice/LedDeviceUdp.cpp @@ -0,0 +1,165 @@ + +// Local-Hyperion includes +#include "LedDeviceUdp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct addrinfo hints, *servinfo, *p; +//char udpbuffer[1024]; +int sockfd; +int ledprotocol; +int leds_per_pkt; +int update_number; +int fragment_number; + +LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate, const unsigned protocol, const unsigned maxPacket) +//LedDeviceUdp::LedDeviceUdp(const std::string& output, const unsigned baudrate) : +// _ofs(output.empty()?"/home/pi/LedDevice.out":output.c_str()) +{ + + std::string hostname; + std::string port; + ledprotocol = protocol; + leds_per_pkt = ((maxPacket-4)/3); + if (leds_per_pkt <= 0) { + leds_per_pkt = 200; + } + +//printf ("leds_per_pkt is %d\n", leds_per_pkt); + int got_colon=0; + for (unsigned int i=0; iai_next) { + if ((sockfd = socket(p->ai_family, p->ai_socktype, + p->ai_protocol)) == -1) { + perror("talker: socket"); + continue; + } + + break; + } + + if (p == NULL) { + fprintf(stderr, "talker: failed to create socket\n"); + assert(p!=NULL); + } +} + +LedDeviceUdp::~LedDeviceUdp() +{ + // empty +} + +int LedDeviceUdp::write(const std::vector & ledValues) +{ + + char udpbuffer[4096]; + int udpPtr=0; + + update_number++; + update_number &= 0xf; + + if (ledprotocol == 0) { + int i=0; + for (const ColorRgb& color : ledValues) + { + if (i<4090) { + udpbuffer[i++] = color.red; + udpbuffer[i++] = color.green; + udpbuffer[i++] = color.blue; + } + //printf ("c.red %d sz c.red %d\n", color.red, sizeof(color.red)); + } + sendto(sockfd, udpbuffer, i, 0, p->ai_addr, p->ai_addrlen); + } + if (ledprotocol == 1) { +#define MAXLEDperFRAG 450 + int mLedCount = ledValues.size(); + + for (int frag=0; frag<4; frag++) { + udpPtr=0; + udpbuffer[udpPtr++] = 0; + udpbuffer[udpPtr++] = 0; + udpbuffer[udpPtr++] = (frag*MAXLEDperFRAG)/256; // high byte + udpbuffer[udpPtr++] = (frag*MAXLEDperFRAG)%256; // low byte + int ct=0; + for (int this_led = frag*300; ((this_led 7) + sendto(sockfd, udpbuffer, udpPtr, 0, p->ai_addr, p->ai_addrlen); + } + } + if (ledprotocol == 2) { + udpPtr = 0; + unsigned int ledCtr = 0; + fragment_number = 0; + udpbuffer[udpPtr++] = update_number & 0xf; + udpbuffer[udpPtr++] = fragment_number++; + udpbuffer[udpPtr++] = ledCtr/256; // high byte + udpbuffer[udpPtr++] = ledCtr%256; // low byte + + for (const ColorRgb& color : ledValues) + { + if (udpPtr<4090) { + udpbuffer[udpPtr++] = color.red; + udpbuffer[udpPtr++] = color.green; + udpbuffer[udpPtr++] = color.blue; + } + ledCtr++; + if ( (ledCtr % leds_per_pkt == 0) || (ledCtr == ledValues.size()) ) { + sendto(sockfd, udpbuffer, udpPtr, 0, p->ai_addr, p->ai_addrlen); + memset(udpbuffer, 0, sizeof udpbuffer); + udpPtr = 0; + udpbuffer[udpPtr++] = update_number & 0xf; + udpbuffer[udpPtr++] = fragment_number++; + udpbuffer[udpPtr++] = ledCtr/256; // high byte + udpbuffer[udpPtr++] = ledCtr%256; // low byte + } + } + + } + return 0; +} + +int LedDeviceUdp::switchOff() +{ +// return write(std::vector(mLedCount, ColorRgb{0,0,0})); + return 0; +} diff --git a/libsrc/leddevice/LedDeviceUdp.h b/libsrc/leddevice/LedDeviceUdp.h new file mode 100644 index 00000000..c8e2f119 --- /dev/null +++ b/libsrc/leddevice/LedDeviceUdp.h @@ -0,0 +1,44 @@ +#pragma once + +// STL includes0 +#include + +// Leddevice includes +#include + +/// +/// Implementation of the LedDevice that write the led-colors to an +/// ASCII-textfile('/home/pi/LedDevice.out') +/// +class LedDeviceUdp : public LedDevice +{ +public: + /// + /// Constructs the test-device, which opens an output stream to the file + /// + LedDeviceUdp(const std::string& output, const unsigned baudrate, const unsigned protocol, const unsigned maxPacket); + + /// + /// Destructor of this test-device + /// + virtual ~LedDeviceUdp(); + + /// + /// Writes the given led-color values to the output stream + /// + /// @param ledValues The color-value per led + /// + /// @return Zero on success else negative + /// + virtual int write(const std::vector & ledValues); + + /// Switch the leds off + virtual int switchOff(); + +private: + /// The outputstream +// std::ofstream _ofs; + + /// the number of leds (needed when switching off) + size_t mLedCount; +}; From 6d062adc354784a8de311ce23865df0a0f185321 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Fri, 8 Jan 2016 14:11:57 +1100 Subject: [PATCH 02/13] Added a "udp" effect that listens for UDP packets and then sets the LEDs. A good companion for the UDP led driver i also commited Former-commit-id: f9c43eab8fe1c805c32de3e3612b238b33d1d153 --- effects/udp.json | 8 ++++++++ effects/udp.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 effects/udp.json create mode 100644 effects/udp.py diff --git a/effects/udp.json b/effects/udp.json new file mode 100644 index 00000000..defd4f89 --- /dev/null +++ b/effects/udp.json @@ -0,0 +1,8 @@ +{ + "name" : "UDP listener", + "script" : "udp.py", + "args" : + { + "udpPort" : 2391 + } +} diff --git a/effects/udp.py b/effects/udp.py new file mode 100644 index 00000000..f8317a20 --- /dev/null +++ b/effects/udp.py @@ -0,0 +1,47 @@ +import hyperion +import time +import colorsys +import socket +import errno + +# Get the parameters +udpPort = int(hyperion.args.get('udpPort', 2812)) + +UDPSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) +UDPSock.setblocking(False) + +listen_addr = ("",udpPort) +print "udp.py: bind socket port:",udpPort +UDPSock.bind(listen_addr) + +hyperion.setColor(hyperion.ledCount * bytearray((int(0), int(0), int(0))) ) + +# Start the write data loop +while not hyperion.abort(): + try: + data,addr = UDPSock.recvfrom(4500) +# print data.strip(),len(data),addr + if (len(data)%3 == 0): +# print "numleds ",len(data)/3 + ledData = bytearray() + for i in range(hyperion.ledCount): + if (i<(len(data)/3)): + ledData += data[i*3+0] + ledData += data[i*3+1] + ledData += data[i*3+2] + else: + ledData += bytearray((int(0), int(0), int(0))) + + hyperion.setColor(ledData) + + else: + print "not div 3" + except IOError as e: + if e.errno == errno.EWOULDBLOCK: + pass + else: + print "errno:", e.errno + +print "udp.py: closing socket" +UDPSock.close() + From 6b0bf2ac90519d93e39b2fc4b05f3353471e6688 Mon Sep 17 00:00:00 2001 From: penfold42 Date: Fri, 8 Jan 2016 14:14:55 +1100 Subject: [PATCH 03/13] Basic documentation for the UDP led driver Former-commit-id: e5725b467e3960f84e2c4c6d5dd8e6e117f7188d --- doc/UDP_led_driver.txt | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 doc/UDP_led_driver.txt diff --git a/doc/UDP_led_driver.txt b/doc/UDP_led_driver.txt new file mode 100644 index 00000000..646abe21 --- /dev/null +++ b/doc/UDP_led_driver.txt @@ -0,0 +1,57 @@ +BACKGROUND +--------------------------------------------------------- +The UDP led device type can be used to send LED data over UDP packets. +It was originally designed to support an ESP8266 Wifi module based WS2812 +LED strip controller. + +I've used this to support : +- A string of 600 LEDs as xmas decorations + The effects development kit is great for these scenarios + +- a 61 LED collection of concentric circles + This has been used as a "night light" and a super lo-res + TV + +In each of these cases, the hyperion-remote iOS app is a great way to +control the effects. + + +CONFIG +--------------------------------------------------------- +Simple example for devices that support a raw binary protocol. + "device" : + { + "name" : "MyPi", + "type" : "udp", + "output" : "esp201-0.home:2391", "protocol" : 0, + "rate" : 1000000, + "colorOrder" : "grb" + }, + + + +If you are using an ESP8266/Arduino device with a long LED strip, you chould use this alternate protocol. +The ESP8266/Arduino doesnt support datagram re-assembly so will never see any udp packets greater than 1450. + "device" : + { + "name" : "MyPi", + "type" : "udp", +// "output" : "esp201-0.home:2392", "protocol" : 2, "maxpacket" : 1450, + "rate" : 1000000, + "colorOrder" : "rgb" + }, + +PROTOCOL +--------------------------------------------------------- +Simple UDP packets are sent. + +Packet Format protocol 0: +3 bytes per LED as R, G, B + +Packet Format protocol 2: +0: update number & 0xf; +1: fragment of this update +2: 1st led# of this update - high byte +3: 1st led# of this update - low byte +4..n 3 bytes per LED as R, G, B + From 538775928731246116afd7b42cb37ea5fd3dd7ce Mon Sep 17 00:00:00 2001 From: penfold42 Date: Mon, 18 Jan 2016 17:31:17 +1100 Subject: [PATCH 04/13] updated URLs in the installation script to reference current builds Former-commit-id: 014c31531dbc5cce74870d8f3c112fcf10f9460d --- bin/install_hyperion.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install_hyperion.sh b/bin/install_hyperion.sh index 4d3e9a2c..4c06e696 100755 --- a/bin/install_hyperion.sh +++ b/bin/install_hyperion.sh @@ -40,7 +40,7 @@ if [ $IS_OPENELEC -eq 1 ]; then if [ $IS_IMX6 -eq 1 ]; then curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz | tar -C /storage -xz else - curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz + curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz | tar -C /storage -xz fi curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz # modify the default config to have a correct effect path @@ -49,7 +49,7 @@ else if [ $IS_IMX6 -eq 1 ]; then wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz -O - | tar -C /opt -xz else - wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz + wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz -O - | tar -C /opt -xz fi fi From d6b5dc7ae65a4ce59aa1bed4fc54c1086502530f Mon Sep 17 00:00:00 2001 From: wisc17 Date: Tue, 9 Feb 2016 20:21:49 +0100 Subject: [PATCH 05/13] Revert "Update LedDeviceAPA102.cpp by pcaffardi" Former-commit-id: 493b32c03f922cc26d9fb4fce4778636f6a96e84 --- libsrc/leddevice/LedDeviceAPA102.cpp | 53 ++++++++++------------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/libsrc/leddevice/LedDeviceAPA102.cpp b/libsrc/leddevice/LedDeviceAPA102.cpp index 17bec4fc..26a21f72 100644 --- a/libsrc/leddevice/LedDeviceAPA102.cpp +++ b/libsrc/leddevice/LedDeviceAPA102.cpp @@ -1,7 +1,9 @@ + // STL includes #include #include #include +#include // Linux includes #include @@ -17,46 +19,27 @@ LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned // empty } -#define MIN(a,b) ((a)<(b)?(a):(b)) -#define MAX(a,b) ((a)>(b)?(a):(b)) - -#define APA102_START_FRAME_BYTES 4 -#define APA102_LED_BYTES 4 -#define APA102_END_FRAME_BITS_MIN 32 -#define APA102_END_FRAME_BITS(leds) MAX((((leds-1)/2)+1),APA102_END_FRAME_BITS_MIN) -#define APA102_END_FRAME_BYTES(leds) (((APA102_END_FRAME_BITS(leds)-1)/8)+1) -#define APA102_LED_HEADER 0xe0 -#define APA102_LED_MAX_INTENSITY 0x1f - int LedDeviceAPA102::write(const std::vector &ledValues) { - const unsigned int startFrameSize = APA102_START_FRAME_BYTES; - const unsigned int ledsCount = ledValues.size() ; - const unsigned int ledsSize = ledsCount * APA102_LED_BYTES ; - const unsigned int endFrameBits = APA102_END_FRAME_BITS(ledsCount) ; - const unsigned int endFrameSize = APA102_END_FRAME_BYTES(ledsCount) ; - const unsigned int transferSize = startFrameSize + ledsSize + endFrameSize ; - - if(_ledBuffer.size() != transferSize){ - _ledBuffer.resize(transferSize, 0x00); + const unsigned int startFrameSize = 4; + const unsigned int endFrameSize = std::max(((ledValues.size() + 15) / 16), 4); + const unsigned int mLedCount = (ledValues.size() * 4) + startFrameSize + endFrameSize; + if(_ledBuffer.size() != mLedCount){ + _ledBuffer.resize(mLedCount, 0xFF); + _ledBuffer[0] = 0x00; + _ledBuffer[1] = 0x00; + _ledBuffer[2] = 0x00; + _ledBuffer[3] = 0x00; } - - unsigned idx = 0, i; - for (i=0; i Date: Wed, 10 Feb 2016 16:25:08 +0100 Subject: [PATCH 06/13] corrected rpi binary filename Former-commit-id: 6e476fa8252dde2495f2808f7c76f22f09ed1e4e --- bin/install_hyperion.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install_hyperion.sh b/bin/install_hyperion.sh index 4d3e9a2c..4c06e696 100755 --- a/bin/install_hyperion.sh +++ b/bin/install_hyperion.sh @@ -40,7 +40,7 @@ if [ $IS_OPENELEC -eq 1 ]; then if [ $IS_IMX6 -eq 1 ]; then curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz | tar -C /storage -xz else - curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz + curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz | tar -C /storage -xz fi curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz # modify the default config to have a correct effect path @@ -49,7 +49,7 @@ else if [ $IS_IMX6 -eq 1 ]; then wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz -O - | tar -C /opt -xz else - wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz + wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz -O - | tar -C /opt -xz fi fi From 27557f7848b0bcb235ccaedba49521cbb83a9fb1 Mon Sep 17 00:00:00 2001 From: wisc Date: Wed, 10 Feb 2016 18:07:47 +0100 Subject: [PATCH 07/13] added missing gpio2spi Former-commit-id: 7882635b25d9568fc13ce98c136c97772e6ada03 --- deploy/hyperion_rpi.tar.gz.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/hyperion_rpi.tar.gz.REMOVED.git-id b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id index 44bbdc58..9c96bfd2 100644 --- a/deploy/hyperion_rpi.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id @@ -1 +1 @@ -5c164e4ff52076a530461cdf6966943d52cd39df \ No newline at end of file +d079238ea69f0fb1422e9d7181016d4e290c12d5 \ No newline at end of file From e10392b0c85e9b601376f4b2f37ab01a410ca1a8 Mon Sep 17 00:00:00 2001 From: wisc Date: Wed, 10 Feb 2016 18:36:04 +0100 Subject: [PATCH 08/13] added gpio2spi Former-commit-id: c04a47d0ac351a8840f3b00d7a2ab866c22c5008 --- bin/create_release.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/create_release.sh b/bin/create_release.sh index 625ff0e1..d6b9bf66 100644 --- a/bin/create_release.sh +++ b/bin/create_release.sh @@ -28,6 +28,7 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names --ignore "$builddir/bin/hyperiond" \ "$builddir/bin/hyperion-remote" \ "$builddir/bin/hyperion-v4l2" \ + "$builddir/bin/gpio2spi" \ "$builddir/bin/dispmanx2png" \ "$repodir/effects/"* \ "$repodir/bin/hyperion.init.sh" \ From 0661ad74f6402ed414749575e9f29a33ab6eadea Mon Sep 17 00:00:00 2001 From: Danimal4326 Date: Wed, 10 Feb 2016 12:22:19 -0600 Subject: [PATCH 09/13] Fx compile issue for missing ceil function Former-commit-id: f5a6ac2c19b73aa48b5f4292cfa912dc2936701b --- libsrc/blackborder/BlackBorderDetector.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libsrc/blackborder/BlackBorderDetector.cpp b/libsrc/blackborder/BlackBorderDetector.cpp index 60a57c30..669f22f9 100644 --- a/libsrc/blackborder/BlackBorderDetector.cpp +++ b/libsrc/blackborder/BlackBorderDetector.cpp @@ -1,6 +1,7 @@ #include // BlackBorders includes #include +#include using namespace hyperion; From 63ec2909eb7baa5ceeacb77d96d93ebce551f6ee Mon Sep 17 00:00:00 2001 From: wisc Date: Thu, 11 Feb 2016 15:50:51 +0100 Subject: [PATCH 10/13] added bottom right to osd mode Former-commit-id: 3972abaf30d46558d310dbc5e2d164330e9a5b63 --- include/blackborder/BlackBorderDetector.h | 28 +++++++++++++-------- libsrc/blackborder/BlackBorderProcessor.cpp | 5 +--- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/include/blackborder/BlackBorderDetector.h b/include/blackborder/BlackBorderDetector.h index a3a1c32b..7323ebd1 100644 --- a/include/blackborder/BlackBorderDetector.h +++ b/include/blackborder/BlackBorderDetector.h @@ -1,3 +1,4 @@ +//#include #pragma once // Utils includes @@ -82,10 +83,13 @@ namespace hyperion int firstNonBlackXPixelIndex = -1; int firstNonBlackYPixelIndex = -1; + width--; // remove 1 pixel to get end pixel index + height--; + // find first X pixel of the image for (int x = 0; x < width33percent; ++x) { - const Pixel_T & color1 = image( (width - 1 - x), yCenter); // right side center line check + const Pixel_T & color1 = image( (width - x), yCenter); // right side center line check const Pixel_T & color2 = image(x, height33percent); const Pixel_T & color3 = image(x, height66percent); if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) @@ -98,7 +102,7 @@ namespace hyperion // find first Y pixel of the image for (int y = 0; y < height33percent; ++y) { - const Pixel_T & color1 = image(xCenter, (height - 1 - y)); // bottom center line check + const Pixel_T & color1 = image(xCenter, (height - y)); // bottom center line check const Pixel_T & color2 = image(width33percent, y ); const Pixel_T & color3 = image(width66percent, y); if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) @@ -174,7 +178,8 @@ namespace hyperion } -// osd detection mode (find x then y at detected x to avoid changes by osd overlays) + /// + /// osd detection mode (find x then y at detected x to avoid changes by osd overlays) template BlackBorder process_osd(const Image & image) { @@ -184,20 +189,21 @@ namespace hyperion int height = image.height(); int width33percent = width / 3; int height33percent = height / 3; -// int width66percent = width33percent * 2; int height66percent = height33percent * 2; -// int xCenter = width / 2; int yCenter = height / 2; int firstNonBlackXPixelIndex = -1; int firstNonBlackYPixelIndex = -1; + width--; // remove 1 pixel to get end pixel index + height--; + // find first X pixel of the image int x; for (x = 0; x < width33percent; ++x) { - const Pixel_T & color1 = image( (width - 1 - x), yCenter); // right side center line check + const Pixel_T & color1 = image( (width - x), yCenter); // right side center line check const Pixel_T & color2 = image(x, height33percent); const Pixel_T & color3 = image(x, height66percent); if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) @@ -210,11 +216,13 @@ namespace hyperion // find first Y pixel of the image for (int y = 0; y < height33percent; ++y) { - const Pixel_T & color1 = image(x, (height - 1 - y)); // left side bottom check - const Pixel_T & color2 = image(x, y );// left side top check - const Pixel_T & color3 = image( (width - 1 - x), y); // right side top check - if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3)) + const Pixel_T & color1 = image(x, y );// left side top check + const Pixel_T & color2 = image(x, (height - y)); // left side bottom check + const Pixel_T & color3 = image( (width - x), y); // right side top check + const Pixel_T & color4 = image( (width - x), (height - y)); // right side bottom check + if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3) || !isBlack(color4)) { +// std::cout << "y " << y << " lt " << int(isBlack(color1)) << " lb " << int(isBlack(color2)) << " rt " << int(isBlack(color3)) << " rb " << int(isBlack(color4)) << std::endl; firstNonBlackYPixelIndex = y; break; } diff --git a/libsrc/blackborder/BlackBorderProcessor.cpp b/libsrc/blackborder/BlackBorderProcessor.cpp index d6678d51..e7fbc205 100644 --- a/libsrc/blackborder/BlackBorderProcessor.cpp +++ b/libsrc/blackborder/BlackBorderProcessor.cpp @@ -1,12 +1,9 @@ -//* #include /* #include -using std::cout; -using std::endl; using std::setw; -using std::left; //*/ + // Blackborder includes #include From 3996ff789cd9f954252b2fa59c405b614cf5d433 Mon Sep 17 00:00:00 2001 From: Danimal4326 Date: Thu, 11 Feb 2016 12:55:41 -0600 Subject: [PATCH 11/13] remove include of cmath lib Former-commit-id: 004c76c724b9739d977a93d3574821db2c4de2e8 --- libsrc/hyperion/ImageProcessorFactory.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libsrc/hyperion/ImageProcessorFactory.cpp b/libsrc/hyperion/ImageProcessorFactory.cpp index c85b35cd..e3e4f44c 100644 --- a/libsrc/hyperion/ImageProcessorFactory.cpp +++ b/libsrc/hyperion/ImageProcessorFactory.cpp @@ -1,7 +1,3 @@ - -// STL includes -#include - // Hyperion includes #include #include From eacc32513074946a9f601f4697b060ed80352a8b Mon Sep 17 00:00:00 2001 From: "T.van der Zwan" Date: Tue, 23 Feb 2016 21:17:03 +0100 Subject: [PATCH 12/13] Switched flag from soft to hard float Former-commit-id: 98053c8eba7f4f811cbbd63aad5b1210236b2556 --- Toolchain-imx6.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Toolchain-imx6.cmake b/Toolchain-imx6.cmake index 6ca757a7..3afbeaed 100644 --- a/Toolchain-imx6.cmake +++ b/Toolchain-imx6.cmake @@ -6,8 +6,8 @@ SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler SET(CMAKE_C_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-gcc) SET(CMAKE_CXX_COMPILER ${CUBIXCROSS_DIR}/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux/bin/arm-linux-gnueabihf-g++) -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp") -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=softfp") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv7-a -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard") # where is the target environment SET(CMAKE_FIND_ROOT_PATH ${CUBIXCROSS_DIR}/rootfs) From dea32ebc2b5482d9428e2f905493518a62b5871c Mon Sep 17 00:00:00 2001 From: "T.van der Zwan" Date: Tue, 23 Feb 2016 21:17:55 +0100 Subject: [PATCH 13/13] Updated all releases Former-commit-id: b18a9a48f977eaed128d9d641e349e98113ab24b --- deploy/hyperion_imx6.tar.gz.REMOVED.git-id | 2 +- deploy/hyperion_rpi.tar.gz.REMOVED.git-id | 2 +- deploy/hyperion_wetek.tar.gz.REMOVED.git-id | 2 +- deploy/hyperion_x32.tar.gz.REMOVED.git-id | 2 +- deploy/hyperion_x64.tar.gz.REMOVED.git-id | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deploy/hyperion_imx6.tar.gz.REMOVED.git-id b/deploy/hyperion_imx6.tar.gz.REMOVED.git-id index 99536c87..882af089 100644 --- a/deploy/hyperion_imx6.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_imx6.tar.gz.REMOVED.git-id @@ -1 +1 @@ -471d676fb66aa53e3b10d887a1d9e6d3b4afea90 \ No newline at end of file +44d552b5adb3dc5af38edd5e6fb208a0dc75d63d \ No newline at end of file diff --git a/deploy/hyperion_rpi.tar.gz.REMOVED.git-id b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id index 9c96bfd2..f3692ead 100644 --- a/deploy/hyperion_rpi.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_rpi.tar.gz.REMOVED.git-id @@ -1 +1 @@ -d079238ea69f0fb1422e9d7181016d4e290c12d5 \ No newline at end of file +5b0f057a8591d76be009018b302977faeec5159a \ No newline at end of file diff --git a/deploy/hyperion_wetek.tar.gz.REMOVED.git-id b/deploy/hyperion_wetek.tar.gz.REMOVED.git-id index 668065d1..4f6eb81f 100644 --- a/deploy/hyperion_wetek.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_wetek.tar.gz.REMOVED.git-id @@ -1 +1 @@ -d2bf44cca4e7753b53acc2ebbdb933ba8f74f93f \ No newline at end of file +7f0d60e7e0c7075cae5cef69ec5408f3087c00df \ No newline at end of file diff --git a/deploy/hyperion_x32.tar.gz.REMOVED.git-id b/deploy/hyperion_x32.tar.gz.REMOVED.git-id index 89355ddf..4866065e 100644 --- a/deploy/hyperion_x32.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_x32.tar.gz.REMOVED.git-id @@ -1 +1 @@ -7936b39302bec31b18f11a321ba6904c12b5c3ec \ No newline at end of file +511ab205cce688c5d7151087d8659905402e5015 \ No newline at end of file diff --git a/deploy/hyperion_x64.tar.gz.REMOVED.git-id b/deploy/hyperion_x64.tar.gz.REMOVED.git-id index 38e3e0b0..812ded3c 100644 --- a/deploy/hyperion_x64.tar.gz.REMOVED.git-id +++ b/deploy/hyperion_x64.tar.gz.REMOVED.git-id @@ -1 +1 @@ -774c67bd8e4e46d2ebf9c223a38fdfd93cae1100 \ No newline at end of file +e26ac1a0bf52bcd54ab00c37ff25d01a457eec9d \ No newline at end of file