T1 - Algorithm

Bearbeiten

Exercise

Bearbeiten
  • Describe one of the following activities verbally as an algorithm, i.e. as an ordered sequence of 10-20 steps.
  • Use procedures for useful groups of steps.
  • You are free to choose either the top down approach, finding the main steps first (procedures) first and refining them into smaller steps, or the bottom up approach, grouping detailed steps to form more complex ones.
1. Mending the back tyre of a bicycle.
2. Cooking Spaghetti Bolognese (or some other typical student recipe)
3. Adding another memory unit to your pc.
4. Editing a video.

Editing a video

Bearbeiten
1. Open/Import Video
Bearbeiten
1.1. Get the video file from the video editor or show open dialog
1.2. Check the type of file (video- and audio stream)
1.2.1. If the type is not supported then display a warning message and exit algorithm
1.3. Check the type of video- and audio codec (decoder)
1.3.1. If the type is not supported then display a warning message and exit algorithm
2. Editing Process (Video & Audio)
Bearbeiten
Loop: While the selected frame range or the maximal frame range is not reached do: { // Start Frame-Capturing-Loop
2.1. Decode varCount-Frame (Open/Import Frame) // varCount = Frame Counter
2.1.1. If the Frame is compressed then pass the frame through the decompressing codec
Else decode frame
2.2. Edit varCount-Frame (Video)
2.2.1. Call Resize
2.2.1.1. Check the aspect ratio of the new resolution
2.2.1.2. Resize the frame with the bicubic algorithm
2.2.2. Call Denoise
2.2.3. Call Sharpen
2.2.4. Call Gamma
2.2.5. Call Brightness / Contrast
2.2.6. Call Hue / Saturation
...
2.2. Edit varCount-Frame (Audio)
2.2.1. Call Balance
2.2.2. Call Treble / Bass
2.2.3. Call NoiseReduction
...
2. 3. Encode varCount-Frame (Save/Export Frame)
2.3.1. If output-compression is active then send the frame to the compression codec
Else encode frame
}
3. Check Process
Bearbeiten
3.1. Check progress and various parameters from the generated file ---> If an error is occurred then get an error message
Else get a success message