100% Guaranteed Results


GPGPU Assignment #2 Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

1 Goals
Make a video with CUDA in this assignment. Be creative – this is an open-ended assignment.
2 Requirements
The requirements are very loose. You just need to render a series of frames with CUDA, with as little input data as possible. For example, you can try to render Perlin Noise, Simplex Noise, or Stable Fluid. Be more artistic and try to render fireworks, ocean or even a short movie. Google “Demoscene” and see some extreme examples about what people can do with very small executables.
2.1 Video Format
In this lab we will first call void get_info(Lab2VideoInfo &info) to get the height H, width W, FPS N/D and number of frames Nf of your video. Then we will call your void Generate(uint8_t *yuv) Nf times to get all the frames for your video.
Instead of storing RGB values directly, please use the YUV color space, which is the commonly used color space for video codecs.

Y = +0.299R + 0.587G + 0.114B
U = −0.169R −− 0.331G −+ 0.500B + 128 (1) V = +0.500R 0.419G 0.081B + 128
We also subsample U and V channels both horizontally and vertically, that is, .
The YUV channels are stored sequentially so the total size of a frame is 1.5WH.
2.2 Sample code
The sample code (Listing 1.) generates a grayscale video which is black initially and gradually becomes lighter. ”Grayscale” means R = G = B, so the YUV is:

Y = +0.299R + 0.587R + 0.114R = R
U = −0.169R −− 0.331R −+ 0.500R + 128 = 128 (2) V = +0.500R 0.419R 0.081R + 128 = 128
1We use a ratio to represent the FPS because we are using the y4m format. If you want 24 FPS, you shell returns N = 24,D = 1.
2W and H must both be even.
The Y channel is W ∗ H, so we first calculate the brightness according to the frame index then fill it into the device pointer.
The U and V channels are each, so we fill 128 to the following memory space.
Finally, we increase the frame index by one.

1 void Lab2VideoGenerator::Generate(uint8_t *yuv) {
2 cudaMemset(yuv, (impl->t)*255/NFRAME, W*H);
3 cudaMemset(yuv+W*H, 128, W*H/ );
4 ++(impl->t);
5 }

Listing 1: Sample code explanation
The output file is of the y4m raw video format (it can be very large!) and you can use software such as FFmpeg or Avconv to convert it to other compressed formats (Listing 2.).

1 avconv -i output.y4m output.mkv

Listing 2: Sample code explanation
Hints: We do not allow you to modify the header, and if you don’t know how to achieve that, please read Pimpl Idiom or Opaque Pointer.
3 Submission

Reviews

There are no reviews yet.

Be the first to review “GPGPU Assignment #2 Solved”

Your email address will not be published. Required fields are marked *

Related products