mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge branch 'master' of https://github.com/penfold42/hyperion
Former-commit-id: eb4dcbd95b97c70fd54a204a1028636237ddda0c
This commit is contained in:
commit
c30879017c
@ -6,8 +6,8 @@ SET(CMAKE_SYSTEM_VERSION 1)
|
|||||||
# specify the cross compiler
|
# 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_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_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_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=softfp")
|
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
|
# where is the target environment
|
||||||
SET(CMAKE_FIND_ROOT_PATH ${CUBIXCROSS_DIR}/rootfs)
|
SET(CMAKE_FIND_ROOT_PATH ${CUBIXCROSS_DIR}/rootfs)
|
||||||
|
@ -28,6 +28,7 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names --ignore
|
|||||||
"$builddir/bin/hyperiond" \
|
"$builddir/bin/hyperiond" \
|
||||||
"$builddir/bin/hyperion-remote" \
|
"$builddir/bin/hyperion-remote" \
|
||||||
"$builddir/bin/hyperion-v4l2" \
|
"$builddir/bin/hyperion-v4l2" \
|
||||||
|
"$builddir/bin/gpio2spi" \
|
||||||
"$builddir/bin/dispmanx2png" \
|
"$builddir/bin/dispmanx2png" \
|
||||||
"$repodir/effects/"* \
|
"$repodir/effects/"* \
|
||||||
"$repodir/bin/hyperion.init.sh" \
|
"$repodir/bin/hyperion.init.sh" \
|
||||||
|
@ -1 +1 @@
|
|||||||
471d676fb66aa53e3b10d887a1d9e6d3b4afea90
|
44d552b5adb3dc5af38edd5e6fb208a0dc75d63d
|
@ -1 +1 @@
|
|||||||
5c164e4ff52076a530461cdf6966943d52cd39df
|
5b0f057a8591d76be009018b302977faeec5159a
|
@ -1 +1 @@
|
|||||||
d2bf44cca4e7753b53acc2ebbdb933ba8f74f93f
|
7f0d60e7e0c7075cae5cef69ec5408f3087c00df
|
@ -1 +1 @@
|
|||||||
7936b39302bec31b18f11a321ba6904c12b5c3ec
|
511ab205cce688c5d7151087d8659905402e5015
|
@ -1 +1 @@
|
|||||||
774c67bd8e4e46d2ebf9c223a38fdfd93cae1100
|
e26ac1a0bf52bcd54ab00c37ff25d01a457eec9d
|
@ -1,3 +1,4 @@
|
|||||||
|
//#include <iostream>
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Utils includes
|
// Utils includes
|
||||||
@ -82,10 +83,13 @@ namespace hyperion
|
|||||||
int firstNonBlackXPixelIndex = -1;
|
int firstNonBlackXPixelIndex = -1;
|
||||||
int firstNonBlackYPixelIndex = -1;
|
int firstNonBlackYPixelIndex = -1;
|
||||||
|
|
||||||
|
width--; // remove 1 pixel to get end pixel index
|
||||||
|
height--;
|
||||||
|
|
||||||
// find first X pixel of the image
|
// find first X pixel of the image
|
||||||
for (int x = 0; x < width33percent; ++x)
|
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 & color2 = image(x, height33percent);
|
||||||
const Pixel_T & color3 = image(x, height66percent);
|
const Pixel_T & color3 = image(x, height66percent);
|
||||||
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
||||||
@ -98,7 +102,7 @@ namespace hyperion
|
|||||||
// find first Y pixel of the image
|
// find first Y pixel of the image
|
||||||
for (int y = 0; y < height33percent; ++y)
|
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 & color2 = image(width33percent, y );
|
||||||
const Pixel_T & color3 = image(width66percent, y);
|
const Pixel_T & color3 = image(width66percent, y);
|
||||||
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
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 <typename Pixel_T>
|
template <typename Pixel_T>
|
||||||
BlackBorder process_osd(const Image<Pixel_T> & image)
|
BlackBorder process_osd(const Image<Pixel_T> & image)
|
||||||
{
|
{
|
||||||
@ -184,20 +189,21 @@ namespace hyperion
|
|||||||
int height = image.height();
|
int height = image.height();
|
||||||
int width33percent = width / 3;
|
int width33percent = width / 3;
|
||||||
int height33percent = height / 3;
|
int height33percent = height / 3;
|
||||||
// int width66percent = width33percent * 2;
|
|
||||||
int height66percent = height33percent * 2;
|
int height66percent = height33percent * 2;
|
||||||
// int xCenter = width / 2;
|
|
||||||
int yCenter = height / 2;
|
int yCenter = height / 2;
|
||||||
|
|
||||||
|
|
||||||
int firstNonBlackXPixelIndex = -1;
|
int firstNonBlackXPixelIndex = -1;
|
||||||
int firstNonBlackYPixelIndex = -1;
|
int firstNonBlackYPixelIndex = -1;
|
||||||
|
|
||||||
|
width--; // remove 1 pixel to get end pixel index
|
||||||
|
height--;
|
||||||
|
|
||||||
// find first X pixel of the image
|
// find first X pixel of the image
|
||||||
int x;
|
int x;
|
||||||
for (x = 0; x < width33percent; ++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 & color2 = image(x, height33percent);
|
||||||
const Pixel_T & color3 = image(x, height66percent);
|
const Pixel_T & color3 = image(x, height66percent);
|
||||||
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
||||||
@ -210,11 +216,13 @@ namespace hyperion
|
|||||||
// find first Y pixel of the image
|
// find first Y pixel of the image
|
||||||
for (int y = 0; y < height33percent; ++y)
|
for (int y = 0; y < height33percent; ++y)
|
||||||
{
|
{
|
||||||
const Pixel_T & color1 = image(x, (height - 1 - y)); // left side bottom check
|
const Pixel_T & color1 = image(x, y );// left side top check
|
||||||
const Pixel_T & color2 = 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 - 1 - x), y); // right side top check
|
const Pixel_T & color3 = image( (width - x), y); // right side top check
|
||||||
if (!isBlack(color1) || !isBlack(color2) || !isBlack(color3))
|
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;
|
firstNonBlackYPixelIndex = y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
// BlackBorders includes
|
// BlackBorders includes
|
||||||
#include <blackborder/BlackBorderDetector.h>
|
#include <blackborder/BlackBorderDetector.h>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
using namespace hyperion;
|
using namespace hyperion;
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
//*
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
/*
|
/*
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
|
||||||
using std::setw;
|
using std::setw;
|
||||||
using std::left;
|
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
// Blackborder includes
|
// Blackborder includes
|
||||||
#include <blackborder/BlackBorderProcessor.h>
|
#include <blackborder/BlackBorderProcessor.h>
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
|
|
||||||
// STL includes
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
// Hyperion includes
|
// Hyperion includes
|
||||||
#include <hyperion/ImageProcessorFactory.h>
|
#include <hyperion/ImageProcessorFactory.h>
|
||||||
#include <hyperion/ImageProcessor.h>
|
#include <hyperion/ImageProcessor.h>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
// Linux includes
|
// Linux includes
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@ -17,46 +19,27 @@ LedDeviceAPA102::LedDeviceAPA102(const std::string& outputDevice, const unsigned
|
|||||||
// empty
|
// 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<ColorRgb> &ledValues)
|
int LedDeviceAPA102::write(const std::vector<ColorRgb> &ledValues)
|
||||||
{
|
{
|
||||||
const unsigned int startFrameSize = APA102_START_FRAME_BYTES;
|
const unsigned int startFrameSize = 4;
|
||||||
const unsigned int ledsCount = ledValues.size() ;
|
const unsigned int endFrameSize = std::max<unsigned int>(((ledValues.size() + 15) / 16), 4);
|
||||||
const unsigned int ledsSize = ledsCount * APA102_LED_BYTES ;
|
const unsigned int mLedCount = (ledValues.size() * 4) + startFrameSize + endFrameSize;
|
||||||
const unsigned int endFrameBits = APA102_END_FRAME_BITS(ledsCount) ;
|
if(_ledBuffer.size() != mLedCount){
|
||||||
const unsigned int endFrameSize = APA102_END_FRAME_BYTES(ledsCount) ;
|
_ledBuffer.resize(mLedCount, 0xFF);
|
||||||
const unsigned int transferSize = startFrameSize + ledsSize + endFrameSize ;
|
_ledBuffer[0] = 0x00;
|
||||||
|
_ledBuffer[1] = 0x00;
|
||||||
if(_ledBuffer.size() != transferSize){
|
_ledBuffer[2] = 0x00;
|
||||||
_ledBuffer.resize(transferSize, 0x00);
|
_ledBuffer[3] = 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned idx = 0, i;
|
for (unsigned iLed=1; iLed<=ledValues.size(); ++iLed) {
|
||||||
for (i=0; i<APA102_START_FRAME_BYTES; i++) {
|
const ColorRgb& rgb = ledValues[iLed-1];
|
||||||
_ledBuffer[idx++] = 0x00 ;
|
_ledBuffer[iLed*4] = 0xFF;
|
||||||
|
_ledBuffer[iLed*4+1] = rgb.red;
|
||||||
|
_ledBuffer[iLed*4+2] = rgb.green;
|
||||||
|
_ledBuffer[iLed*4+3] = rgb.blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0; i<ledsCount; i++) {
|
|
||||||
const ColorRgb& rgb = ledValues[i];
|
|
||||||
|
|
||||||
_ledBuffer[idx++] = APA102_LED_HEADER + APA102_LED_MAX_INTENSITY;
|
|
||||||
_ledBuffer[idx++] = rgb.red;
|
|
||||||
_ledBuffer[idx++] = rgb.green;
|
|
||||||
_ledBuffer[idx++] = rgb.blue;
|
|
||||||
}
|
|
||||||
for(i=0; i<endFrameSize; i++)
|
|
||||||
_ledBuffer[idx++] = 0x00 ;
|
|
||||||
|
|
||||||
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
|
return writeBytes(_ledBuffer.size(), _ledBuffer.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user