将GPU YUV转换为RGB.值得努力? [英] GPU YUV to RGB. Worth the effort?

查看:428
本文介绍了将GPU YUV转换为RGB.值得努力?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将YUV 4:2:2的多个完整PAL视频(720x576 @ 25)实时转换为RGB,并且可能每个视频都需要自定义调整大小. 我已经考虑过使用GPU,因为我已经看到了一些可以做到这一点的示例(只是4:4:4,因此bpp在来源和命运上都是相同的)-

I have to convert several full PAL videos (720x576@25) from YUV 4:2:2 to RGB, in real time, and probably a custom resize for each. I have thought of using the GPU, as I have seen some example that does just this (except that it's 4:4:4 so the bpp is the same in source and destiny)-- http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c

但是,我没有使用GPU的经验,我不确定该怎么做.据我了解,该示例只是将视频帧转换为YUV并将其显示在屏幕上.

However, I don't have any experience with using GPU's and I'm not sure of what can be done. The example, as I understand it, just converts the video frame to YUV and displays it in the screen.

是否可以获取已处理的帧?将它发送到GPU,对其进行转换,然后再次将其发送到主内存,是否值得付出努力?还是会降低性能?

Is it possible to get the processed frame instead? Would it be worth the effort to send it to the GPU, get it transformed, and sending it again to main memory, or would it kill performance?

假设我在Windows上工作,则由于平台特定,是否可以从窗口获取OpenGL或DirectDraw曲面,以便GPU可以直接在其上绘制?

Being a bit platform-specific, assuming I work on windows, is it possible to get an OpenGL or DirectDraw surface from a window so the GPU can draw directly to it?

推荐答案

真正的问题是,您希望从中得到什么?

The real question is, what do you hope to get out of this?

以接收视频的帧速率,您可以使用诸如Intel Performance Primitives之类的功能来执行所需的几项操作,并轻松跟上视频流的步伐.

At the frame rate you are receiving video, you could use something like Intel Performance Primitives to do the couple of operations that you need and easily keep up with the stream.

如果您想学习如何进行gpu编程,这是一个可以实现的非常简单的问题.

If you want to learn how to do gpu programming, this is a nice easy problem that you could implement.

可以通过从gpu读回内存来获取处理后的帧.实际的机制会因您使用的api(OpenGL,DirectX,CUDA,OpenCL)而异.我用更高分辨率的视频来做到这一点,但仍然保持25fps的速度.但是,这完全取决于您将要使用的硬件.

It is possible to get the processed frame by doing a readback from the gpu to memory. The actual mechanic will vary depending on what api you use (OpenGL, DirectX, CUDA, OpenCL). I've done it with much greater resolution video and still kept up with a 25fps stream. However, this all depends on the hardware that you will be using.

DirectX和OpenGL都提供了有关使用Windows表面作为渲染目标的出色教程.

DirectX and OpenGL both have great tutorials on using windows surfaces as render targets.

这篇关于将GPU YUV转换为RGB.值得努力?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆