audio-video-blog-demos's Introduction
audio-video-blog-demos's People
Forkers
langligelanglang fj200821 srclib iamzhongjian lenkasetsong jack416 hyb1234hi xiejiulong carywei leejb1988 h-elevn tooram attackondeng yhz61010 lixbai cjzjolly lokenetwork toryder jixhua xe-131 topbigone xirwin tianmaxingkonggrant shootao hsx2117audio-video-blog-demos's Issues
请问垂直镜像参数应该怎么写 这个函数I420Mirror
在更新子模块是权限不足
子模块中的仓库,为啥用的是 [email protected]:descampsa/yuv2rgb.git
开头的呢,这样好像会导致其他人拉取子模块的时候出错。
jpeg2yuv成功,但是yuv2jpeg失败
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#include <jpeglib.h>
#include <stdbool.h>
#include <turbojpeg.h>
#include <sys/stat.h>
#include "util.h"
int tyuv2jpeg(unsigned char* yuv_buffer, int yuv_size, int width, int height, int subsample, unsigned char** jpeg_buffer, unsigned long* jpeg_size, int quality)
{
tjhandle handle = NULL;
int flags = 0;
int padding = 1; // 1或4均可,但不能是0
int need_size = 0;
int ret = 0;
handle = tjInitCompress();
flags |= 0;
need_size = tjBufSizeYUV2(width, padding, height, subsample);
if (need_size != yuv_size)
{
printf("we detect yuv size: %d, but you give: %d, check again.\n", need_size, yuv_size);
return 0;
}
ret = tjCompressFromYUV(handle, yuv_buffer, width, padding, height, subsample, jpeg_buffer, jpeg_size, quality, flags);
if (ret < 0)
{
printf("compress to jpeg failed: %s\n", tjGetErrorStr());
}
tjDestroy(handle);
return ret;
}
int main(int argc, char* argv[]) {
printf("↓↓↓↓↓↓↓↓↓↓ Encode YUV to JPEG ↓↓↓↓↓↓↓↓↓↓\n");
char *yuv420FileName = "/data/w00605528/jpeg_dataset/MCL-JCI/MCL-JCI/source_images/libjpeg-turbo-test-image.yuv420";
FILE *yuv420File = fopen(yuv420FileName, "rb");
int yuv420Width = 800, yuv420Height = 800;
int yuvSubsample = TJSAMP_420;
uint8_t *yuv2jpegBuffer;
unsigned long yuv2JpegSize;
struct stat yuv420FileStat;
stat(yuv420FileName, &yuv420FileStat);
int yuv420FileLen = yuv420FileStat.st_size;
printf("yuv420 file length: %d\n", yuv420FileLen);
uint8_t * yuv420Data = malloc(yuv420FileLen);
fread(yuv420Data, yuv420FileLen, 1, yuv420File);
printf("yuv420 read finish!\n");
tyuv2jpeg(yuv420Data, yuv420FileLen, yuv420Width, yuv420Height, yuvSubsample, &yuv2jpegBuffer, &yuv2JpegSize, 80);
printf("jpeg data size: %ld\n", yuv2JpegSize);
FILE *yuv2JpegOutFile = fopen("/data/w00605528/jpeg_dataset/MCL-JCI/MCL-JCI/source_images/libjpeg_out.jpeg", "wb");
fwrite(yuv2jpegBuffer, yuv2JpegSize, 1, yuv2JpegOutFile);
fclose(yuv420File);
fflush(yuv2JpegOutFile);
fclose(yuv2JpegOutFile);
free(yuv420Data);
printf("↑↑↑↑↑↑↑↑↑↑ Encode YUV to JPEG ↑↑↑↑↑↑↑↑↑↑\n\n");
return 0;
}
运行至tjCompressFromYUV报错,输出信息:
↓↓↓↓↓↓↓↓↓↓ Encode YUV to JPEG ↓↓↓↓↓↓↓↓↓↓
yuv420 file length: 960000
yuv420 read finish!
Segmentation fault (core dumped)
CMakeList.txt:
cmake_minimum_required(VERSION 3.14)
set(CMAKE_C_STANDARD 99)
#aux_source_directory(../3rd/libjpeg-turbo LIBJPEG_TURBO_SRC)
link_directories(/home/w00605528/workspace/libjpeg-turbo/build)
include_directories(/home/w00605528/workspace/libjpeg-turbo/build)
add_executable(yuv2jpeg rgb-to-jpeg-with-libjpeg-turbo.c util.c)
#添加链接库
target_link_libraries(yuv2jpeg libturbojpeg.so libjpeg.so)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.