This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//OpenCV Convert YUV buffer to rgb mat | |
Mat y(actual_size, CV_8UC1); | |
Mat u(half_size, CV_8UC1); | |
Mat v(half_size, CV_8UC1); | |
// | |
memcpy(y.data, frame_buffer->DataY(), actual_size.width * actual_size.height); | |
memcpy(u.data, frame_buffer->DataU(), half_size.width * half_size.height); | |
memcpy(v.data, frame_buffer->DataV(), half_size.width * half_size.height); | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//USAGE $ program.exe path\\to\\video-in.mp4 path\\to\\video-out.mp4 | |
#include <iostream> | |
#include <string> | |
#include <mfidl.h> // Media Foundation interfaces | |
#include <mfapi.h> // Media Foundation platform APIs | |
#include <mferror.h> // Media Foundation error codes | |
#include <mfreadwrite.h> | |
#include <wmcontainer.h> // ASF-specific components |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git filter-branch --env-filter ' | |
OLD_EMAIL="xxxx@gmail.com" | |
CORRECT_NAME="www" | |
CORRECT_EMAIL="www@gmail.com" | |
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//int ArmSkySegPreprocessor::resize_cpp(const VN_Image *__input, const VN_Image *__out) { | |
// const uint8_t *src = (uint8_t *) __input->data; | |
// uint8_t *dst = (uint8_t *) __out->data; | |
// uint64_t src_h = (uint64_t) __input->height; | |
// uint64_t src_w = (uint64_t) __input->width; | |
// uint64_t dst_h = (uint64_t) __out->height; | |
// uint64_t dst_w = (uint64_t) __out->width; | |
// | |
// float scale_y = static_cast<float>(src_h) / static_cast<float>(dst_h); | |
// float scale_x = static_cast<float>(src_w) / static_cast<float>(dst_w); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewCtrl_CPUEasyImageProcessing.m | |
// demo_ios | |
// | |
// Created by yyuser on 2018/10/19. | |
// | |
#import "ViewCtrl_CPUEasyImageProcessing.h" | |
#import "vn_core.h" | |
#import "vn_yuvconverter.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void resize_bilinear_c4(uint8_t *dst, const uint8_t *src, | |
uint64_t dst_h, uint64_t dst_w, uint64_t src_h, | |
uint64_t src_w) { | |
float scale_y = static_cast<float>(src_h) / static_cast<float>(dst_h); | |
float scale_x = static_cast<float>(src_w) / static_cast<float>(dst_w); | |
for (int h = 0; h < dst_h; h++) { | |
const int y = (int)MIN(static_cast<uint64_t>(h * scale_y), src_h - 1); | |
for (int w = 0; w < dst_w; w++) { | |
const int x = (int)MIN(static_cast<uint64_t>(w * scale_x), src_w - 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* How to use this funtion | |
*/ | |
- (void)videoCaptureCallback:(CVPixelBufferRef)pixelBuffer{ | |
// [self test_yuv_to_rgb:pixelBuffer]; | |
CVPixelBufferLockBaseAddress(pixelBuffer, 0); | |
int width = (int)CVPixelBufferGetWidth(pixelBuffer); | |
int height = (int)CVPixelBufferGetHeight(pixelBuffer); | |
unsigned char *yBuffer = (unsigned char*)CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0); //ybuffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
void create_mat(int height, int width, float *outMat){ | |
for (int h=0; h<height; h++){ | |
for (int w=0; w<width; w++){ | |
float value = h * width + (w+1); | |
int int_value = (int) value -1; | |
outMat[int_value] = value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import AVFoundation | |
import Accelerate | |
var customPreviewLayer: AVCaptureVideoPreviewLayer? | |
class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate { | |
var captureSession: AVCaptureSession? | |
var dataOutput: AVCaptureVideoDataOutput? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "AppDelegate.h" | |
@interface AppDelegate () | |
@end | |
@implementation AppDelegate | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |
[self neonCommandTest]; |
NewerOlder