• Ted Meyer's avatar
    Encode InitializationVectors into VP9 video frames · 0b35c5fd
    Ted Meyer authored
    Using a vector of subsamples and a starting initialization vector,
    start incrementing the IV based on how large each video frame is. These
    values are used by accelerators to support encrypted playback.
    
    Since subsamples and frames can overlap, we have to cover multiple
    scenarios:
    frames & subsamples line up:
    ┌───────────────────┬────────────────────┐
    │ frame 1           │ frame 2            │
    ┝━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━┥
    │ clear1 | cipher 1 │ clear 2 | cipher 2 │
    └───────────────────┴────────────────────┘
    
    subsample clear covers all first frame and partial second frame:
    ┌───────────────────┬────────────────────┐
    │ frame 1           │ frame 2            │
    ┝━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┥
    │ clear1                  | cipher 1     │
    └────────────────────────────────────────┘
    
    one frame has more than one subsample, and subsamples might not align:
    ┌─────────────────────────┬────────────────────┐
    │ frame 1                 │ frame 2            │
    ┝━━━━━━━━━━━━━━━━━━━┯━━━━━┷━━━━━━━━━━━━━━━━━━━━┥
    │ clear1 | cipher 1 │ clear 2       | cipher 2 │
    └───────────────────┴──────────────────────────┘
    or:
    ┌────────────────────────────────────────┬────────────────────┐
    │ frame 1                                │ frame 2            │
    ┝━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━┥
    │ clear1 | cipher 1 │ clear 2 | cipher 2 │ clear 3 | cipher 3 │
    └───────────────────┴────────────────────┴────────────────────┘
    or:
    ┌─────────────────────────────────────────────┬───────────────┐
    │ frame 1                                     │ frame 2       │
    ┝━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━┯━━━━┷━━━━━━━━━━━━━━━┥
    │ clear1 | cipher 1 │ clear 2 | cipher 2 │ clear 3 | cipher 3 │
    └───────────────────┴────────────────────┴────────────────────┘
    
    a cipher section crosses a frame boundary: (this is an error and is caught)
    ┌───────────────────┬────────────────────┐
    │ frame 1           │ frame 2            │
    ┝━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━┥
    │ clear1      | cipher 1                 │
    └────────────────────────────────────────┘
    
    Bug: 881922
    Bug: 836557
    Change-Id: I7e69be34221702f77ec67daa8647c1767661bb51
    Reviewed-on: https://chromium-review.googlesource.com/c/1307059Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
    Reviewed-by: default avatarRintaro Kuroiwa <rkuroiwa@chromium.org>
    Commit-Queue: Ted Meyer <tmathmeyer@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#611378}
    0b35c5fd
vp9_decoder.cc 8.11 KB