Closed ViktorButskikh closed 3 months ago
@ViktorButskikh the colorspace conversion example dumps a raw image buffer after converting to the nv12 colorspace, for visualization format it may need to be modified, I will check it and let you know
Dear colleagues,
I've understood the reason of "broken" image. We have two planes. It means that NV12 writing should be slightly different that we have now. I have slightly modify function for nv12 write and usage of it:
int nv12_write(const char* luma_buf, const char* chroma_buf, const char* path, int width, int height) {
int size;
FILE* file = fopen(path, "wb");
if (!file) {
fprintf(stderr, "Could not open %s\n", path);
return -1;
}
size = width * height;
fwrite(luma_buf, size, 1, file);
size = width * height / 2;
fwrite(chroma_buf, size, 1, file);
fclose(file);
return 0;
}
...........................................................
/* Write output image */
nv12_write(amlge2d.ge2dinfo.dst_info.vaddr[0], amlge2d.ge2dinfo.dst_info.vaddr[1], "./output.nv12", dst_width, dst_height);
...........................................................
For make visualisation of result I use command:
ffmpeg -pix_fmt nv21 -f rawvideo -s 1920x1080 -i output.nv12 -pix_fmt rgb24 cam001.png
Look like we have NV21 instaed of NV12. Difference between NV12 and NV12 ins swapped U V components of chroma.
@ViktorButskikh Thank you for your solution, I will test it and apply it :+1:
Solution applied in abff044bf0555af62f94afde26d8b8339d1b6163, closing this topic
Dear colleagues
During launching my ge2d-cvt I'm geting quite strange picture output.nv12 For making visualisation I use following command:
ffmpeg -pix_fmt nv12 -f rawvideo -s 1920x1080 -i output.nv12 -pix_fmt rgb24 output.png
Can be the reason in old kernel 4.9 https://github.com/khadas/linux/tree/khadas-vims-4.9.y ?
![Uploading output.png…]()