Multimedia Course Overview
Multimedia Course Overview
Multimedia
https://ro.linkedin.com/in/cotfasliviu
                                                               2
Administrative issues
Evaluation
   • Seminar – 40%
     • project (mandatory)
                             3
Administrative issues
                                                       4
           Administrative issues
Optional
                                                                              5
Definition, Characteristics, Concepts
Multimedia
Definition
   Multimedia is:
     any combination of text, graphics, video, audio, and animation
     in a distributable format that consumers can interact with using a digital
      device.
                                                                                     7
Multimedia
Triggering factors
   The development of multimedia has been made possible by the Digital
     Revolution, through:
     analog-digital conversion;
     data compression.
   The Digital Revolution represents the change from mechanical and analogue
    electronic technology to digital electronics which began anywhere from the late
    1950s to the late 1970s with the adoption and proliferation of digital computers
    and digital record keeping that continues to the present day.
                                                                                       8
Multimedia
Data Compression
 Lossless compression
 Lossy compression
                                                                               9
Compression
Lossless compression
   substitutes a more efficient encoding to reduce the file size while preserving all
     of the original data. When the file is decompressed it will be identical to the
     original.
   Run Length Encoding - RLE
     one of the simpler strategies to achieve lossless compression
     can be used to compress bitmapped image files (ex: *pcx format). Bitmapped
       images can easily become very large because each pixel is represented with a
       series of bits that provide information about its color. RLE generates a code to
       “flag” the beginning of a line of pixels of the same color. That color information
       is then recorded just once for each pixel. In effect, RLE tells the computer to
       repeat a color for a given number of adjacent pixels rather than repeating the
       same information for each pixel over and over. The RLE compressed file will be
       smaller, but it will retain all the original image data—it is “lossless.”
                                                                                            10
Compression
                            11
Compression
Lossy Compression
   the number of bits in the original file is reduced and some data is lost. Lossy
    compression is not an option for files consisting of text and numbers, so-called
    alphanumeric information. Losing a single letter or number could easily alter the
    meaning of the data.
   often possible to maintain high-quality images or sounds with less data than was
    originally present (especially useful for multimedia)
                                                                                        12
Compression
Lossy Compression
   Examples:
     JPEG – images;
     MPEG – sound and video.
   MP3 compression:
     analyzes the sound file and discards data that is not critical for high-quality
      playback;
     removes frequencies above the range of human hearing. It may also evaluate
      two sounds playing at the same time and eliminate the softer sound. These
      types of data can be eliminated without significant impact on quality;
     can reduce by a factor of 10 the amount of data required to represent digital
      audio recordings yet still sound like the original uncompressed audio to most
      listeners.                                                                        13
Multimedia
Multimedia Applications
 Characteristics:
                                                                                 14
Multimedia
                                                                                     15
Multimedia
                                                                                      16
Hardware / Software Requirements
Hardware Requirements
 Images;
 Sound;
 Video.
                                        18
Hardware Requirements
                                                                                           19
Hardware Requirements
                         20
Hardware Requirements
                                                                                      21
Hardware Requirements
                                                                                      22
Hardware Requirements
                           23
Software Requirements
 Application Software
                                                                                      24
Software Requirements
Application Software
   An application is software that performs a specific task. These programs combine
    with the operating system to make computers productive tools.
                                                                                       25
Media-specific Software
Graphics
    generate 2-D or 3-D paint and draw images.
    Categories:
      Paint programs;
 Draw programs;
                                                  26
Graphics
Paint programs
   contain tool sets to create graphics objects as well as editing tools for digital
    photos or scanned images
   offer a wide array of features such as filters (blur, emboss, pixelate), image
    adjustment settings (scale, brightness, rotate), and special effects (drop shadow,
    gradient overlay).
   provide special control over individual image elements is possible using layers
    and mask options. Text tools are used to generate graphics text with distinctive
    patterns, shapes, and 3-D effects.
                                                                                         27
Graphics
Paint programs
   Examples: Photoshop (Adobe), Gimp (open source)
                                                      28
Graphics
Draw programs
   contain a distinctive set of tools for creating basic shapes such as ovals,
    rectangles, Bezier curves, and polygons generated from mathematical formulas
   the shapes can be grouped, filled, and scaled to produce complex drawn
    images.
   such programs can be used to create unique logos, designs, and graphics
    objects that can easily be resized for specific multimedia projects.
                                                                                   29
Graphics
Draw programs
                30
Graphics
3-D imaging
   used to model 3-D objects, define surfaces, compose scenes, and render a
    completed image;
                                                                                       31
Graphics
3-D imaging
              32
Media-specific Software
Sound
 There are two major types of sound applications for multimedia development:
 sampled;
 synthesized.
                                                                                   33
Sound
Sampled
                                                                                    34
Sound
Synthesized
   the musical file is then saved and played back on a computer’s synthesizer, an
    electronic device to generate sound. MIDI applications are a good source of
    original music for multimedia applications.
                                                                                     35
Media-specific Software
Sound
                          36
Media-specific Software
Video
    an environment to combine source material called clips, synchronize clips to a
     sound track, add special effects, and save the work as a digital video.
    a video project starts by assembling film clips in a project window. The clips can
     be still images, animations, sounds, or digital video files.
    video applications provide tools to move and insert clips on a timeline, trim the
     clip, and define transitions between tracks. Sound tracks, title fields, and special
     effects such as superimposing, transparency, and lens flare add to the video
     composition. Video editing applications also define playback size and frame rate.
     When the video project is complete, the application provides settings to save it
     in specific file formats and compression schemes.
                                                                                            37
Media-specific Software
Video
    Examples: Premiere (Adobe)
                                  38
Media-specific Software
Animation
    used to create and edit animated sequences. Animation is the technique of using
     a series of rapidly displayed still images to produce the appearance of motion.
    Objects are drawn or imported into the software where they are manipulated in
     a series of still frames. Frames are played back in sequence to create an illusion
     of motion.
                                                                                           39
Media-specific Software
Animation
    Examples: Director (Adobe), Flash (Adobe), Animate (Adobe)
                                                                  40
Software Requirements
Authoring Software
   they are used to assemble media elements, synchronize content, design the user
    interface, and provide user interactivity.
                                                                                          41
Software Requirements
Authoring Software
 card-based metaphor;
 timeline;
 flow diagram.
                                                                           42
Authoring Software
Card-based metaphor
   elements are arranged much as they might be on index cards or the pages of a
    book.
   such applications are easy to use and are ideal for products such as information
    kiosks, lectures, and tutorials that do not require precise synchronization of
    individual media elements.
                                                                                       43
Authoring Software
Timeline
 such applications provide the precise control needed for advanced animations;
                                                                                    44
Authoring Software
Adobe Flash
                     45
Authoring Software
                         46
Authoring Software
Flow diagram
   use icons arranged on flow lines to quickly develop a wide range of multimedia
    products including advanced tutorials, product demonstrations, and simulations.
    Icons can represent both content (images, text, animations, video) and a wide
    range of interactions (play, stop, go to, calculate, etc.).
 example: Authorware
                                                                                      47
Web Multimedia
Web Multimedia
              http://www.cuttherope.net/basic_standalone/game.html   50
HTML5 Videos
               51
Images
Digital Images
                                                                                 53
Images
Visible light
                54
Images
Color Space
   we refer to natural sunlight as white light because it appears to the human eye
    to be colorless.
   it’s possible to separate white light into a dazzling display of various colors using
    a prism. As light travels through a prism, it’s refracted (bent), causing the beam
    of white light to break apart into its component color wavelengths
                                                                                            55
Images
    The primary and secondary colors of white light become visible when refracted
                                 by a glass prism.
                                                                                    56
Images
Color Space
The green leaf absorbs all the colors except green which it reflects back into our eyes.
                                                                                           57
     Images
Color Space
                                                                         58
[1] http://www.mstworkbooks.co.za/natural-sciences/gr8/gr8-ec-04.html.
Images
Color Space
   Although we can get black paint as a pigment, black is not a color of light. Black
    is the result of the complete absorption of light.
                                                                                         59
Images
Color Systems
                                                           60
Color Systems
Additive Model
   Additive color is color created by mixing a number of different light colors.
   Shades of red, green, and blue are the most common primary colors used in
    additive color system.
   Additive color mixing begins with black and ends with white; as more color is
    added, the result is lighter and tends to white.
   The combination of two of the standard three additive primary colors in equal
    proportions produces an additive secondary color - cyan, magenta or yellow.
                                                                                    61
Color Systems
   by adjusting the intensity of each, you can produce all the colors in the visible
    light spectrum. You get white if you add all the colors equally and black by
    removing all color entirely from the mix.
                                                                                        62
Color Systems
   The individual points of color are tiny, so our brains add the colors together into
    yellow.
                                                                                          63
Color Systems
                            64
Color Systems
                              65
Color Systems
The possible color combinations for any pixel in an eight-bit graphic (or a 24-bit display).
                                                                                                          66
Color Systems
   256 possibilities for red × 256 for green × 256 for blue - 16.8 million possible
    combinations / colors.
                                                                                       67
Color Systems
   Together with HSL (Hue, Saturation and Lightness) are the most common
    cylindrical-coordinate representations of points in an RGB color model.
                                                                                         68
Color Systems
                                     Red - 00
                                     Green - 1200
                                     Blue - 2400
                                                     69
Color Systems
                                                                                        70
Color Systems
   A subtractive color model explains the mixing of a limited set of dyes, inks, paint
    pigments or natural colorants to create a wider range of colors, each the result
    of partially or completely subtracting (that is, absorbing) some wavelengths of
    light and not others [1]
   Subtractive color mixing means that one begins with white and ends with black;
    as one adds color, the result gets darker and tends to black [2].
  [1] https://en.wikipedia.org/wiki/Subtractive_color
  [2] http://www.worqx.com/color/color_systems.htm
                                                                                          71
Color Systems
[1] https://en.wikipedia.org/wiki/Subtractive_color
                                                                                       72
Color Systems
                                                          73
   Color Systems
                                                        74
https://commons.wikimedia.org/wiki/File:NIEdot367.jpg
Color Systems
                             75
Color Systems
Color Wheel
   A color wheel (also referred to as a color circle) is a visual representation of
    colors arranged according to their chromatic relationship. Begin a color wheel by
    positioning primary hues equidistant from one another, then create a bridge
    between primaries using secondary and tertiary colors [1].
Color Wheel
                                                                       77
Color Systems
Color Wheel
                                                                 78
Color Systems
   Most often warm, saturated, light value hues are "active" and
    visually advance.
                                                                    79
Color Systems
   Cool, low saturated, dark value hues are "passive" and visually
    recede.
                                                                      80
Color Systems
Complementary Colors
   When fully saturated complements are brought together, interesting effects are
    noticeable. This may be a desirable illusion, or a problem if creating visuals that
    are to be read.
   Notice the illusion of highlighted edges and raised text. This may occur when
    opposing colors are brought together.
                                                                                          81
2-D Computer Graphics
  Computers create either 2-D (width and height) or 3-D images (width, height,
   and depth).
    bitmapped approach - particularly well suited for images with fine detail, such
     as paintings or photographs. Also called raster graphics.
    vector drawing - used for graphic designs ranging from simple drawings and
     logos to sophisticated artistic creations.
                                                                                       82
Raster Graphics
Raster Graphics
                                              84
Raster Graphics
  Every pixel in a raster image is exactly the same size and contains a single color
   value that’s typically stored as a 24-bit string of binary data.
  The total number of pixels in a raster image is fixed. In order to make a raster
   image physically larger, more pixels have to be added to the raster matrix.
  Likewise, pixels need to be discarded when making a raster image smaller. The
   width and height of a raster image is determined by how many pixels each row
   and column contains.
                                                                                        85
Raster Graphics
Mosaic
From a distance, the individual tiles forming the image are barely perceptible to the naked eye.
Up close, however, we can see that many small pieces of visual information went into forming
this 19th-century mosaic of Christ, the good shepherd. This technique of using tiny bits of
colored material to form a composite visual impression dates back to about 3,000 bc.             86
Raster Graphics
When enlarged, individual pixels appear as squares. Zooming in further, they can be
analyzed, with their colors constructed by adding the values for red, green and blue.
                                                                                        87
Raster Graphics
Formats
    BMP (Microsoft Windows Bitmap) - *.bmp
      also known as bitmap image file or device independent bitmap (DIB) file
       format or simply a bitmap
                                                                                   88
Raster Graphics
Characteristics
    Resolution
      describes the image quality of a raster image and directly relates to the size
       and quantity of the pixels the image contains.
    Pixel Dimensions
      describe the size of a raster image, expressed as the number of pixels along
       the x-axis (width) by the number of pixels along the y-axis (height).
      ex: 800 px * 600 px
    Pixel Count
      Pixel count is the total number of pixels in a raster matrix. To determine the
       pixel count, multiply the horizontal and vertical pixel dimensions.
      ex: a 30 * 18 pixel image has a pixel count of 540 pixels.
                                                                                        89
Raster Graphics
Characteristics
    Pixel Density
      We express the pixel density or resolution of a raster image in pixels per inch
       (ppi)—this is pixels per linear inch (across or down), not square inch.
      Most television and computer monitors have a display resolution of either 72
       or 96 ppi.
      The resolution determines the maximum size of an image you print. In order to
       produce a high-quality print of any size, digital photographs need a pixel
       density of at least 300 ppi—that’s 90,000 pixels in a square inch!
                                                                                         90
Raster Graphics
Characteristics
    Color-Depth (Color Resolution)
      measure of the number of different colors that can be represented by an
       individual pixel. The number of bits assigned to each pixel, or bit depth,
       determines color resolution.
      8-bits (256 colors), 24 bits (16.8 million colors)
      A drawing using 16 distinct colors, for example, would only require 4 bits per
       pixel. Using a code with greater bit depth produces a larger file with no
       increase in quality.
                                                                                        91
Raster Graphics
                                                                                         92
Raster Graphics
                                                                                        93
Raster Graphics
Formats
    while working with an image file, it should be saved it in a format that supports
     layers (*.PSD, *TIFF), so it can be changed it in the future or resaved in a new
     format for another purpose.
    when you prepare a raster image to incorporate into a multimedia project, you’ll
     need a flattened, compressed image. For lossy formats there is always a tradeoff
     between image quality and the file size.
                                                                                         94
2-D Computer Graphics
Formats
   GIF (Graphics Interchange Format) - *.gif
     maximum 256 colors and transparency (transparent pixels);
 commonly used for logos and other images with lines and solid blocks of color.
     supports interlacing, so every odd line of pixels loads, then every even line
      loads, making graphics seem to appear faster (users see the full-sized, half-
      loaded graphic before the rest of the pixels appear).
     supports animation.
                                                                                       95
2-D Computer Graphics
Formats
                  https://dl.dropboxusercontent.com/u/70618257/HTML5Multimedia/giphy.gif
                                                                                           96
2-D Computer Graphics
Formats
   JPEG (Joint Photographic Experts Group) - *.jpeg
     offers 16.8 million colors
                                                                         97
2-D Computer Graphics
Formats
   JPEG - a photo of a cat with the compression rate decreasing, and hence quality
                           increasing, from left to right [1].
                                                                                     98
2-D Computer Graphics
Formats
Formats
   PNG (Portable Network Graphics) - *.png
     the most widely used lossless image compression format on the Internet [1]
     created as an improved, non-patented replacement for Graphics Interchange
      Format (GIF) [1]
     offers 16.8 million colors and transparency, but you can choose to use fewer
      colors to save file space (PNG 8, or PNG with 8-bit color) [2]
     Lossless compression format [2]
     common for a wide range of images, including favicons (the small web page
      icons in browser tabs) [2]
     PNG files can be very small, but for photographs with many colors, they may
      be larger than comparable JPEGs [2]
     This format supports interlacing.[2]
                                                                                     100
2-D Computer Graphics
Formats
Formats
    Other formats:
      ICO - Icon Resource File;
      DIB - Device Independent Bitmap;
      PCX - PC PaintBrush File Format;
      TIFF - Tag Image File Format.
                                          102
           Raster Graphics
Optional
Huge images
 Dubai: http://gigapan.com/gigapans/48492
                                                           103
Raster Graphics
Compression
    Compression algorithms:
      Run-length encoding (RLE)
      Lempel–Ziv–Welch (LZW)
      Huffman
      JPEG
                                   104
Raster Graphics
                                                                                             105
Raster Graphics
                                          106
           Raster Graphics
Optional
               Encoding
                 Initialize the dictionary to contain all strings of length one.
                 Find the longest string W in the dictionary that matches the current input.
                 Emit the dictionary index for W to output and remove W from the input.
                 Add W followed by the next symbol in the input to the dictionary.
                 Go to Step 2.
                                                                                                107
Raster Graphics
JPEG Compression
    lossy data compression algorithm
    Steps
     1. color space transformation
     2. downsampling
     3. block splitting
     4. transformation
     5. quantization
     6. encoding
                                        108
Raster Graphics
                                                                                      109
Raster Graphics
                                                                                        110
Raster Graphics
    The transformation into the Y′CBCR color model enables the next usual step,
     which is to reduce the spatial resolution of the Cb and Cr components.
                                                                                       111
Raster Graphics
                                           112
Raster Graphics
    For the rest of the compression process, Y', Cb and Cr are processed separately
     and in a very similar manner.
                                                                                           113
Raster Graphics
                                                                                   114
Raster Graphics
    If we have chosen an image whose dimensions are 160 x 240 = 8*20 x 8*30. So
     this step creates 20 x 30 = 600 blocks.
                                                                                   115
Raster Graphics
                                                                              116
Raster Graphics
    Before computing the DCT of the 8×8 block, its values are shifted from a positive
     range to one centered on zero.
    We subtract 127 from each pixel intensity in each block. This step centers the
     intensities about the value 0 and it is done to simple the mathematics of the
     transformation and quantization steps.
                                                                                         117
Raster Graphics
                                                                                                           118
Raster Graphics
    Loosely speaking, the DCT tends to push most of the high intensity information
     (larger values) in the 8 x 8 block to the upper left-hand of C with the remaining
     values in C taking on relatively small values.
                                                                                         119
Raster Graphics
                                                                                             120
Raster Graphics
    elements near zero will converted to zero and other elements will be shrunk so
     that their values are closer to zero. All quantized values will then be rounded to
     integers.
                                                                                          121
Raster Graphics
                      16            11      10      16      24       40      51      61
                      12            12      14      19      26       58      60      55
                      14            13      16      24      40       57      69      56
                      14            17      22      29      51       87      80      62
                      18            22       37     56      68       109     103     77
24 35 55 64 81 104 113 92
   Note that the values are largest in the lower right corner of Z. These divides should produce values close to
   zero so that the rounding function will convert the quotient to zero                                            122
Raster Graphics
                     -2   -19   -15    -6   -4   -1   -1   0
                     14    4     -2   -13   0    0    -1   -2
                     -2    -2    -2    7    -1   -1   0    1
                      2    -3    -2    2    0    0    1    0
1 0 1 -1 -1 0 0 0
-3 2 1 -1 0 0 0 0
0 0 0 -1 1 0 0 0
1 0 -1 0 0 0 0 0
                                                                123
Raster Graphics
                                                                          124
Raster Graphics
                                                                                     125
Raster Graphics
HTML5 Images
    represents an image in the document.
 API: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement
                                                                              126
Raster Graphics
HTML5 Images
    Properties:
      width, height: the rendered width / height of the image in CSS pixels;
      naturalWidth, naturalHeight: unsigned long representing the intrinsic width /
       height of the image in CSS pixels;
      src: DOMString that reflects the src HTML attribute, containing the full URL of
       the image including base URI.
    Events:
      load: fired when a resource and its dependent resources have finished loading.
                                                                                         127
Raster Graphics
HTML5 Images
                                                                      128
Raster Graphics
 API: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas
                                                                              129
Raster Graphics
                                                                                        130
Raster Graphics
                                                                                         131
Raster Graphics
 API: developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D
    Drawing rectangles:
      clearRect() - sets all pixels in the rectangle defined by starting point (x, y) and
       size (width, height) to transparent black, erasing any previously drawn content.
      fillRect() - draws a filled rectangle at (x, y) position whose size is determined by
       width and height.
      strokeRect() - paints a rectangle which has a starting point at (x, y) and has a w
       width and an h height onto the canvas, using the current stroke style.                 132
Raster Graphics
    Drawing paths:
      check documentation
    Line styles:
      check documentation
                                                                                   133
Raster Graphics
    Shadows
      check documentation
                                                            134
Raster Graphics
                                                              135
Raster Graphics
                                         136
Raster Graphics
                                                             137
Raster Graphics
    Without the translate() method, all of the rectangles would be drawn at the same position (0,0).
     Using the translate() method we don’t have to manually adjust the coordinates in the fillRect()
     function.
    JSFiddle: https://jsfiddle.net/liviucotfas/9tfdegn7/
                                                                                                        138
Raster Graphics
                                                                 139
Raster Graphics
                                                                                                 140
Raster Graphics
                                                                                          141
Raster Graphics
    rectangle: scaled
    text: mirrored.
    JSFiddle: https://jsfiddle.net/liviucotfas/Lyycq7gv/
                                                            142
Raster Graphics
                    context.scale(-.5, 1);
                    context.rotate(45 * Math.PI / 180);
                    context.translate(40, 10);
      the translate, rotate, and scale methods end up affecting the values stored by
       this matrix
                        𝑥′   𝑚11                𝑚21       𝑑𝑥   𝑥
                        𝑦′ = 𝑚12                𝑚22       𝑑𝑦   𝑦
                        1     0                  0        1    1
                                                                                        143
Raster Graphics
                          𝑥′   𝑚11          𝑚21     𝑑𝑥     𝑥
                          𝑦′ = 𝑚12          𝑚22     𝑑𝑦     𝑦
                          1     0            0      1      1
                                                                                        144
Raster Graphics
                                                                               145
Raster Graphics
                          𝑥′   𝑚11          𝑚21     𝑑𝑥     𝑥
                          𝑦′ = 𝑚12          𝑚22     𝑑𝑦     𝑦
                          1     0            0      1      1
      resetTransform()
       resets the current transform to the identity matrix. This is the same as calling:
         ctx.setTransform(1, 0, 0, 1, 0, 0);
                                                                                            146
Raster Graphics
                                                                                    147
Raster Graphics
                                                                                    148
Raster Graphics
                                                                                       149
Raster Graphics
 JSFiddle: https://jsfiddle.net/liviucotfas/64fzcaea/
                                                                              150
Raster Graphics
                                                                                      151
Raster Graphics
                                                                              152
Raster Graphics
                                                                                         153
Raster Graphics
                                                                                                155
Raster Graphics
Effects
    Color Filter
      Red filter: r’ = r; g’ = 0; b’ = 0
    Negative
      r ‘ = 255 – r; g‘ = 255 – g; b‘ = 255 – b;
    Greyscale
      r ‘ = g’ = b’ = (r + g + b) / 3
      r ‘ = g’ = b’ = 0.299 * r + 0.587 * g + 0.114 * b
                                                           156
Raster Graphics
Effects
    Brightness
      r ‘ = r + value; if (r’ > 255) r’ = 255 else if (r’ < 0) r’ = 0;
      g‘ = g + value; if (g’ > 255) g’ = 255 else if (g’ < 0) g’ = 0;
      b‘ = b + value; if (b’ > 255) b’ = 255 else if (b’ < 0) b’ = 0;
    Threshold
      v = (0.2126*r + 0.7152*g + 0.0722*b >= threshold) ? 255 : 0; r’= g’ = b’ = v
                                                                                      157
           Raster Graphics
Optional
           Effects
               Further reading / examples:
                 https://developer.mozilla.org/en-
                  US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas
                 https://www.html5rocks.com/en/tutorials/canvas/imagefilters/
                                                                                       158
Raster Graphics
                                                                                        159
           Raster Graphics
Optional
                                                                                 160
           Raster Graphics
Optional
           WebGL
               Documentation: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API
 Demos: http://babylonjs.com/
                                                                                            161
Vector Graphics
Images
Vector Graphics
   In bitmapped graphics, the computer is given a detailed description of an image
    that it then matches, pixel by pixel.
                                                                                      163
Images
Vector Graphics
   Each vector path forms the outline of a geometric region containing color
    information.
                                                                                164
Images
Vector Graphics
                  165
Images
Vector Graphics
                                                                                    166
Vector Graphics
Scaling / Zoom
                  167
Vector Graphics
Scaling / Zoom
                  168
Vector Graphics
Animation
    You could also use vector graphics to create an animation, such as with Flash.
     Instead of drawing every separate frame of your project—with 24 frames
     appearing each second—you could create two different graphics for a segment
     and let your animation software mathematically interpolate the positions of the
     components in the in-between frames (a technique known as tweening).
                                                                                       169
Vector Graphics
      A draw program might use a command similar to “RECT 300, 300, RED” to
       create a red square with sides of 300 pixels. The file for this image contains 15
       bytes that encode the alphanumeric information in the command.
      The same image could also be created with a paint program as a bitmapped
       graphic. Using 8-bit color resolution (one byte per pixel), this file would require
       90,000 bytes (300 × 300). The much smaller files sizes of drawn images can be
       a significant advantage for multimedia developers.
                                                                                             170
Vector Graphics
      Images that are needed in several sizes, such as a company logo, are often
       best handled as vector-drawn graphics.
                                                                                         171
Vector Graphics
                                                                                           172
Vector Graphics
Formats
    SVG (Scalable Vector Graphics)
      XML-based vector image format for two-dimensional graphics
      provides supports for interactivity and animation
                                                                           173
Vector Graphics
Formats
    EPS (Encapsulated Post Script)
      Created by Adobe Systems for representing vector graphics
      Uses a computer language called Post Script
    SHP (Shapefile)
      eveloped and regulated by Esri as a (mostly) open specification for data
       interoperability among Esri and other GIS software products
      popular geospatial vector data format for geographic information system (GIS)
       software
                                                                                       174
Vector Graphics
Formats
                                                          175
Vector Graphics
                   <!DOCTYPE html>
                   <html>
                   <body>
                       <svg width="400" height="180">
                           <rect x="50" y="20" width="150" height="150"
                   style="fill:red;stroke:black;stroke-width:5;opacity:0.5">
                       </svg>
                   </body>
                                                                               176
Vector Graphics
                                 177
Vector Graphics
                                                                                178
Vector Graphics
    Example:
      http://www.w3schools.com/graphics/svg_line.asp
                                                                                                 179
Vector Graphics
    Example
      http://www.w3schools.com/graphics/svg_rect.asp
      <svg width="400" height="110">
       <rect width="300" height="100" style="fill:rgb(0,0,255);stroke-width:3;stroke:rgb(0,0,0)" />
      </svg>
                                                                                                      180
Vector Graphics
    Example
      http://www.w3schools.com/graphics/svg_circle.asp
                                                                                        181
Vector Graphics
    Polygon
   <polygon points=“x1,y1 x2,y2 …”/>
    Polyline
   <polyline points=“x1,y1 x2,y2 …”/>
    Text
   <text x=“start-x" y=“start-y">conținut</text>
                                                                        182
Vector Graphics
    Defining groups
   <defs>… <!– definire grupuri --> </defs>
    Reusing groups
   <use xlink:href="#id_grup" x=“30" y=“14"/>
                                                183
           Vector Graphics
Optional
                 Link: https://developer.mozilla.org/en-
                  US/docs/Web/Guide/CSS/Getting_started/SVG_and_CSS
                                                                      184
           Vector Graphics
Optional
                  Particularities
                   when creating an element we need to use the SVG namespace
document.createElementNS("http://www.w3.org/2000/svg", „TAG_SVG")
                                                                                                    185
           Vector Graphics
Optional
                  $(document.createElementNS("http://www.w3.org/2000/svg", "rect"))
                         .attr({x:160, y:160, width:12, height:12})
                         .appendTo($("#drawing"));
                                                                                      186
Digital Video
Digital Video
Definition
    Digital video is a representation of moving visual images in the form of encoded
     digital data. This is in contrast to analog video, which represents moving visual
     images with analog signals.
    Digital video was first introduced commercially in 1986 with the Sony D1 format,
     which recorded an uncompressed standard definition component video signal in
     digital form instead of the high-band analog forms that had been commonplace
     until then.
                                                                                         188
Digital Video
Advantages
    Digital video can be processed using specialized computer software.
                                                                                     189
Digital Video
Characteristics
    Screen Resolution
 Color Depth
 Frame Rate
 Interlaced / Progressive
                                  190
Digital Video
    the smaller the screen resolution of a digital video, the less processing, storage,
     and transmission it requires [2].
    Reducing display size to 176 × 144 for mobile phones yields a pixel count of
     approximately 25,000 [2].                                                             191
           Digital Video
Optional
                                                                                                                               192
Digital Video
                                      193
Digital Video
                                      194
Digital Video
    Similar to raster images, the more bits are used for storing the color, the more
     subtle variations of colors can be reproduced.
                                                                                           195
Digital Video
    Lowering the frame rate both slows the delivery of individual images and drops
     out frames of video. If the rate is low enough, viewers will experience a string of
     still images with abrupt changes of content—in other words, a jerky video.
                                                                                           196
Digital Video
 NTSC used about 30 frames per second and PAL used 25 frames per second [2].
                                                                                             197
           Digital Video
Optional
               Interlaced video
                 each frame is composed of two halves of an image. In the first pass all odd
                  numbered lines are displayed, from the top left corner to the bottom right
                  corner. The second pass displays the second and all even numbered lines,
                  filling in the gaps in the first scan.
                 the two halves are referred to individually as fields. Two consecutive fields
                  compose a full frame. If an interlaced video has a frame rate of 15 frames per
                  second the field rate is 30 fields per second.                                   198
           Digital Video
Optional
                                                        199
           Digital Video
Optional
               Benefits of interlacing
                 for a fixed bandwidth, interlace provides a video signal with twice the display
                  refresh rate for a given line count (versus progressive scan video at a similar
                  frame rate—for instance 1080i at 60 half-frames per second, vs. 1080p at 30
                  full frames per second).
                 bandwidth benefits only apply to an analog or uncompressed digital video
                  signal. With digital video compression, as used in all current digital TV
                  standards, interlacing introduces additional inefficiencies.
                                                                                                    200
           Digital Video
Optional
                                                                                                    201
Digital Video
Characteristics – Compression
                                                                                         202
Digital Video
Characteristics – Compression
    Redundancies can occur:
      within the two-dimensional space of a single frame of video (as with a
       photograph) - spatial redundancy.
      across time in a video sequence containing many frames – temporal
       redundancy.
Characteristics – Compression
                        Spatial redundancy
                                             204
Digital Video
Characteristics – Compression
Characteristics – Compression
    Intraframe (or I-frame) compression
      Eliminates spatial redundancies “within” a video frame in much the same way
       that JPEG compression is used to reduce them in a digital photograph.
      I-frames are typically compressed at a ratio of 10:1. This means that a
       compressed I-frame consumes as little as 10% of the file space of a raw
       uncompressed frame.
      Since I-frames are fully defined by information from within the frame, they can
       be easily decoded and rendered onscreen during playback and editing.
      However, the overall amount of compression that’s achieved with this approach
       is limited since temporal redundancies are not addressed.
                                                                                         206
Digital Video
Characteristics – Compression
    Interframe compression (more common method)
      exploits both spatial and temporal redundancies.
      using the previous method of intraframe compression, all of the frames in a
       video stream are turned into I-frames. Each one is intracoded to eliminate
       spatial redundancy. Thus, compression is applied evenly to all of the frames
       within a video stream.
      with interframe compression, I-frames are created at fixed intervals (typically
       every 15 frames). An I-frame marks the beginning of a packaged sequence of
       adjacent frames called a GOP (Group of Pictures). The fully defined I-frame
       serves as a keyframe or reference for other frames in the group. Its job is to
       hold repeating color values in place that will not change across the sequence.
       Basically, it creates a digital marker on the frame that says “do not change the
       color of this pixel until you are told to do so.”
                                                                                          207
Digital Video
Characteristics – Compression
    MPEG Compression
      exploits both spatial and temporal redundancies (interframe compression )
                                                                                       208
Digital Video
Characteristics – Compression
      A P-frame
       a predictive coded image that only stores data for pixels that are different
         from the preceding frame.
       Example: in a shot of a bird flying across a blue sky, only pixels related to the
         moving bird would be encoded to a P-frame. The unchanged background
         pixels simply carry forward from information stored in the previous frame.
       on average, a P-frame can be compressed twice as much as an I-frame.
                                                                                            209
Digital Video
Characteristics – Compression
      A B-frame
       a bidirectional predictive coded image. It records changes from both the
         preceding frame and the one immediately following.
       On average, a B-frame can be compressed twice as much as a P-frame.
      With interframe encoding, all frames are not equally compressed. The more
       heavily compressed P-frames and B-frames require more processing power to
       encode and decode.
                                                                                   210
Digital Video
Characteristics – Compression
                                211
Digital Video
Characteristics – Compression
                                212
Digital Video
 Container:
      exists solely for the purpose of bundling all of the audio, video, and codec files
       into one organized package.
      In addition, the container often contains chapter information for DVD or Blu-
       ray movies, metadata, subtitles, and/or additional audio files such as different
       spoken languages.
                                                                                            213
Digital Video
                                                                                            214
Digital Video
                                                                                    215
Digital Video
    Comparison:
      https://en.wikipedia.org/wiki/Comparison_of_video_container_formats
                                                                             216
Digital Video
Web Video
   "Flash was created during the PC era – for PCs and mice. Flash is a successful
   business for Adobe, and we can understand why they want to push it beyond PCs.
   But the mobile era is about low power devices, touch interfaces and open web
   standards – all areas where Flash falls short. The avalanche of media outlets offering
   their content for Apple's mobile devices demonstrates that Flash is no longer
   necessary to watch video or consume any kind of web content."
Steve Jobs
                                                                                            217
Digital Video
                                     218
Digital Video
Web Video
    <video> - HTML element used to embed video content in a document. The
     video element contains one or more video sources. To specify a video source,
     use either the src attribute or the <source> element; the browser will choose the
     most suitable one.
        <video controls>
          <source src="foo.webm" type="video/webm">
          <source src="foo.ogg" type="video/ogg">
          <source src="foo.mov" type="video/quicktime">
          I'm sorry; your browser doesn't support HTML5 video.
        </video>
                                                                                         219
Digital Video
Web Video
    <video>
      atribute: autoplay, controls, src, volume, ...
      API: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
    HTMLVideoElement (JavaScript)
      poperties: currentSrc, currentTime, duration, ended, error, paused, readyState,
       volume
      methods canPlayType, load, pause, play
      mvents: canplay, ended, pause, play, volumechange, waiting
 API: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement
                                                                                         220
Digital Video
Web Video
    <track>
      HTML element used as a child of the media elements - <audio> and <video>.
       It lets you specify timed text tracks (or time-based data), for example to
       automatically handle subtitles.
      The tracks are formatted in WebVTT format (.vtt files) - Web Video Text Tracks.
      Link: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track
                                                                                         221
Digital Video
Web Video
    <source>
      HTML element is used to specify multiple media resources for either the
       <picture>, the <audio> or the <video> element.
      It is an empty element.
      It is commonly used to serve the same media content in multiple formats
       supported by different browsers..
      Link: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source
      <video controls>
        <source src="foo.webm" type="video/webm">
        <source src="foo.ogg" type="video/ogg">
      I'm sorry; your browser doesn't support HTML5 video.
      </video>
                                                                                 222
Digital Video
Web Video
    recommended video formats:
      webm – type = video/webm
      mp4 – type = video/mp4
      .ogg – type = video/ogg
      <video controls>
        <source src="foo.webm" type="video/webm">
        <source src="foo.ogg" type="video/ogg">
      I'm sorry; your browser doesn't support HTML5 video.
      </video>
                                                             223
           Digital Video
Optional
           Web Video
               Live Demo: https://www.w3.org/2010/05/video/mediaevents.html
 API: https://www.w3.org/TR/html5/embedded-content-0.html#mediaevents
               Media Player:
                 https://developer.mozilla.org/en-
                  US/Apps/Fundamentals/Audio_and_video_delivery/Adding_captions_and_subti
                  tles_to_HTML5_video
                                                                                            224
Digital Video
Web Video
           var W = canvas.width = video.clientWidth;
           var H = canvas.height = video.clientHeight;
           context.drawImage(video, 0, 0, W, H);
           var imageData = context.getImageData(0, 0, W, H);
Web Video
                //create the video element using jQuery
                var v = $("<video></video>")
                     .attr({
                           "controls": "",
                           "autoplay": "",
                           "src": "media/movie.mp4"
                     })
                     .load()
                     .appendTo($("body"));
                                                          226
Digital Video
                $(function () {
                      var lista = ["movie.mp4", "v2.mp4"];
                      var index = 0;
                      video.on("ended", function () {
                            index = index + 1;
                            if (index >= lista.length) index = 0;
                            video[0].src = lista[index];
                            video[0].load();
                            video[0].play();
                      });
                });
                                                                    227
Audio
Sound
  The medium is usually air, though sound can also be transmitted through solids
   and liquids.
                                                                                    229
Sound
  Sound waves are often compared to the ripples produced when a stone is
   thrown into a pond. The stone displaces the water to produce high points, or
   wave peaks, and low points, or troughs. We see these alternating peaks and
   troughs as patterns of waves moving outward from the stone’s point of impact.
   The clap of the hand also produces peaks and troughs as high air pressure is
   followed by a return to lower pressure. These changes in air pressure produce
   patterns of waves spreading in all directions from the sound’s source.
                                                                                   230
Sound
  Humans can hear sound waves with frequencies between about 20 Hz and 20
   kHz
                                                                                     231
Sound
Representation
                 232
Sound
Characteristics
 amplitude
 frequency
 duration
                  233
Sound
Characteristics
   Amplitude is a measure of sound pressure or the amount of energy associated
    with the sound. This is represented by the vertical, or y-axis, of the sine wave.
    Amplitude is perceived as the sound’s volume, which is usually measured in
    decibels (dB).
   In general, sounds with higher amplitudes are experienced as louder. The range
    of human hearing is approximately 3 to 140 dB. Each 10 dB increase roughly
    doubles the perceived volume of a sound.
                                                                                        234
Sound
Characteristics
   Frequency is the number of times a waveform repeats in a given interval of time.
    It is represented on the horizontal axis as the distance between two wave peaks
    or troughs. Frequency is measured in hertz (Hz).
   One hertz is one repetition of a waveform in one second of time.
Characteristics
   The duration of the sound is the length of time it lasts. The total length of the
    horizontal axis represents duration
                                                                                        236
Sound
Digital Audio
   Digital techniques represent sound as discrete (or discontinuous) elements of
    information.
                                                                                    237
Sound
Digital Audio
   Sampled sound is a digital recording of previously existing analog sound waves.
    A file for sampled sound contains many thousands of numerical values, each of
    which is a record of the amplitude of the sound wave at a particular instant, a
    sampling of the sound.
                                                                                      238
Sound
Digital Audio
   Synthesized sound is new sound generated (or synthesized, “put together”) by
    the computer. A file for synthesized sound contains instructions that the
    computer uses to produce its own sound.
   Sampling is usually used to capture and edit naturally occurring sounds such as
    human speech, musical and dramatic performances, bird calls, rocket launches,
    and so on. Synthesized sound is generally used to create original musical
    compositions or to produce novel sound effects.
                                                                                      239
Digital Audio
Digital sampling
    capturing and storing sound in a digital format.
                                                                                        240
Digital Audio
Digital sampling
    Digital sampling replaces the continuous waveform of the original sound with a
     new wave created from a fixed number of discrete samples.
    Some information is always lost in sampling, because a continuous wave is
     infinitely divisible and sampling always yields a finite number of values.
    The quality of sampled sound is dependent on two factors directly connected to
     this sampling process: sample resolution and sample rate.
                                                                                      241
Digital Audio
Digital sampling
    Digital sampling replaces the continuous waveform of the original sound with a
     new wave created from a fixed number of discrete samples.
    Some information is always lost in sampling, because a continuous wave is
     infinitely divisible and sampling always yields a finite number of values.
    The quality of sampled sound is dependent on two factors directly connected to
     this sampling process: sample resolution and sample rate.
                                                                                      242
Digital Audio
Digital sampling
    Sample Resolution Each measurement of amplitude made by an ADC is
     recorded using a fixed number of bits. The number of bits used to encode
     amplitude is known as sample resolution.
    Sample resolutions for digital audio range from 8 to 32 bits, with the most
     common being the 16-bit CD-Audio standards and 24-bit DVD-Audio standards.
                                                                                   243
Digital Audio
Digital sampling
    Eight bits can record 256 different amplitude levels. This is adequate to capture
     the variations in limited decibel ranges, such as those between a human whisper
     and a shout, but higher sample resolutions are needed to accurately reproduce
     sounds with a wider range of amplitudes, such as musical performances. Thus,
     8-bit audio is generally used only for simple sounds or in multimedia
     applications requiring very small file sizes.
    The CD-Audio standard, with its 16 bits per sample, supports over 65 thousand
     different amplitude levels, whereas the 24-bit DVD-Audio standard can represent
     over 16 million levels.
                                                                                         244
           Digital Audio
Optional
           Digital sampling
               Inadequate sample resolution can distort sound in two different ways:
                quantization and clipping.
                                                                                                     245
           Digital Audio
Optional
           Digital sampling
               Clipping - sound-sampling equipment is designed for a selected decibel range.
                If the source sound exceeds this range (as, for instance, when someone yells into
                a microphone held close to their lips), higher amplitudes cannot be encoded,
                because no values are available to represent them. The waveform of a clipped
                sound shows square tops and bottoms marking the point at which the highest
                amplitudes could not be captured (Figure 7.5). Clipping can produce a harsh,
                distorted sound.
                                                                                                    246
           Digital Audio
Optional
           Digital sampling
               The solution to clipping is to lower the amplitude of the source sound to record
                within the limits of the ADC circuitry.
               The familiar, “Testing—one, two, three,” is often used to establish the proper
                distance and speech level when recording with a microphone.
                                                                                                   247
           Digital Audio
Optional
           Digital sampling
               Clipping can also occur during the mixing of different audio tracks.
               Mixing is the process of combining two or more sound selections, or tracks, into
                a single track. For example, a background music track might be mixed with a
                voice track of a poetry reading. This combination of two or more tracks may
                produce an amplitude that exceeds the available range. Adjustments to the
                volume of each track can eliminate the problem.
                                                                                                   248
Digital Audio
Digital sampling
    Sample rate is the number of samples taken in a fixed interval of time. A rate of
     one sample per second is designated as a Hertz.
    Because sound samples are always taken thousands of times each second,
     sample rates are usually stated in kilohertz.
    Sample rate affects sound quality by determining the range of frequencies that
     can be represented in a digital recording. At least two measurements are
     required to capture each cycle of a sound wave—one for each high value, or
     peak, and one for each low value, or trough. The highest frequency that can be
     captured is thus one-half of the sample rate.
    CD-quality sound captures 44,100 samples per second (44.1 kHz sample rate)
     and can represent frequencies as high as 22,050 Hz or 22.05 kHz. DVD-Audio
     uses a sampling frequency of 96 kHz to capture frequencies as high as 48 kHz.
                                                                                         249
Digital Audio
Digital sampling
                   250
Digital Audio
Digital sampling
    Sounds that do not contain high frequencies can be more efficiently represented
     using lower sample rates because this will produce a smaller overall file size. One
     potential problem with lower sample rates, however, is aliasing.
                                                                                           251
           Digital Audio
Optional
                                                                                                        252
Digital Audio
Sound Compression
    Lowering the sample rate and reducing sample resolution are two ways to
     reduce the size of a sampled sound file. These methods work well for sounds at
     relatively low frequencies and narrow amplitude ranges. They are not effective
     for sounds that contain wider ranges of both frequency and amplitude, such as
     musical performances. In these cases another strategy can be used:
     compression.
                                                                                             253
Digital Audio
Sound Compression
    Because lossy strategies produce much smaller files, they are the preferred
     technique for sound compression.
                                                                                          254
Digital Audio
Sound Compression
    Lossy compression also uses other techniques such as variable bit rate encoding
     (VBR). In VBR, sounds are encoded using a different number of bits per second
     depending on the complexity of the sound. For simple passages of sound with
     limited frequencies, a smaller number of bits per second is used than for more
     complex passages, such as those with many different instruments and higher
     frequencies.
    Lossy codecs such as the widely supported MP3 can reduce file sizes by as much
     as 80% while remaining virtually indistinguishable from the original CD-quality
     sound.
                                                                                       255
Digital Audio
                                                                                     256
Digital Audio
                                                                                    257
Digital Audio
                                    258
           Audio
Optional
Synthesized Sound
Web Audio
   <audio> - HTML element is used to embed sound content in documents. It may
    contain one or more audio sources, represented using the src attribute or the
    <source> element; the browser will choose the most suitable one.
   <audio controls="controls">
        <source src="foo.wav" type="audio/wav">
        Your browser does not support the <code>audio</code>
   element.
   </audio>
                                                                                    260
Audio
Web Audio
   <audio>
     attributes:
      autoplay
      controls
      loop
      src
      volume (numeric) – value between 0 and 1
     API: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio
                                                                             261
Audio
Web Audio
   HTMLAudioElement (JavaScript)
     provides access to the properties of <audio> elements, as well as methods to
      manipulate them. It derives from the HTMLMediaElement interface.
     properties:
      currentSrc, currentTime, duration, ended, error, paused, readyState, volume
     methods:
      canPlayType, load, pause, play
     events:
      canplay, ended, pause, play, volumechange, waiting
     API: https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement
                                                                                     262
           Audio
Optional
Web Audio
                                                                  263
           Audio
Optional
           Web Audio
              Sound visualization using HTM5 Canvas: http://nipe-systems.de/webapps/html5-
               web-audio/
                                                                                              264
Audio
Recommendations
   Consider the playback environment:
     Public vs. private use (ex: autoplay)
     Give users control:
      Over volume.
      To stop or start play.
   Avoid excessive use of sound. Sound can be more tiring for users than images or
    text
                                                                                      265
Animation
Animation
  Animation is the process of creating the illusion of motion and the illusion of
   change
  Main techniques:
    movie technique
    key frames
    color changing
                                                                                     267
Animation
Digital Animation
                                                                                    268
Animation
Digital Animation
   1. frame-by-frame animation
     animators produce each successive frame manually
     technique that provides complete control over frame content, but is also very
       time consuming
                                                                                      269
Animation
Digital Animation
   2. tween animation
     the animator creates the key frames and the computer automatically produces
      the tweens.
     There are several different types of tweens:
      motion tween - can be used to move an object from one position to
        another. The first key frame places the object in one position and the second
        places it in another. The program then fills in the intervening frames.
      path-based animation: the animator draws a path from one key frame to
        another and the computer fills in the intervening images, spaced out along
        the path, to produce the desired motion
      morphing - the shape of one image is gradually modified until it changes
        into another shape
                                                                                        270
Animation
Digital Animation
       size tweening - the first key frame is the object at its initial size and the
        second is the final size.
       alpha tweening- color and transparency can be animated using key frames
        representing initial and final image properties.
 3. programmed animation
                                                                                        271
Animation
Web Animation
                                 draw()
                       MODEL                              BROWSER
handleEvent()
                                                                                       272
JavaScript
JavaScript
   Modern_JavaScript.zip on http://online.ase.ro
   http://jstherightway.org/
274