• Yunqing Wang's avatar
    Multiple-resolution encoder · aa7335e6
    Yunqing Wang authored
    The example encoder down-samples the input video frames a number of
    times with a down-sampling factor, and then encodes and outputs
    bitstreams with different resolutions.
    
    Support arbitrary down-sampling factor, and down-sampling factor
    can be different for each encoding level.
    
    For example, the encoder can be tested as follows.
    1. Configure with multi-resolution encoding enabled:
    ../libvpx/configure --target=x86-linux-gcc --disable-codecs
    --enable-vp8 --enable-runtime_cpu_detect --enable-debug
    --disable-install-docs --enable-error-concealment
    --enable-multi-res-encoding
    2. Run make
    3. Encode:
    If input video is 1280x720, run:
    ./vp8_multi_resolution_encoder 1280 720 input.yuv 1.ivf 2.ivf 3.ivf 1
    (output: 1.ivf(1280x720); 2.ivf(640x360); 3.ivf(320x180).
    The last parameter is set to 1/0 to show/not show PSNR.)
    4. Decode:
    ./simple_decoder 1.ivf 1.yuv
    ./simple_decoder 2.ivf 2.yuv
    ./simple_decoder 3.ivf 3.yuv
    5. View video:
    mplayer 1.yuv -demuxer rawvideo -rawvideo w=1280:h=720 -loop 0 -fps 30
    mplayer 2.yuv -demuxer rawvideo -rawvideo w=640:h=360 -loop 0 -fps 30
    mplayer 3.yuv -demuxer rawvideo -rawvideo w=320:h=180 -loop 0 -fps 30
    
    The encoding parameters can be modified in vp8_multi_resolution_encoder.c,
    for example, target bitrate, frame rate...
    
    Modified API. John helped a lot with that. Thanks!
    
    Change-Id: I03be9a51167eddf94399f92d269599fb3f3d54f5
    aa7335e6
md5_utils.c 7.41 KiB
/*
 * This code implements the MD5 message-digest algorithm.
 * The algorithm is due to Ron Rivest.  This code was
 * written by Colin Plumb in 1993, no copyright is claimed.
 * This code is in the public domain; do with it what you wish.
 * Equivalent code is available from RSA Data Security, Inc.
 * This code has been tested against that, and is equivalent,
 * except that you don't need to include two pages of legalese
 * with every copy.
 * To compute the message digest of a chunk of bytes, declare an
 * MD5Context structure, pass it to MD5Init, call MD5Update as
 * needed on buffers full of bytes, and then call MD5Final, which
 * will fill a supplied 16-byte array with the digest.
 * Changed so as no longer to depend on Colin Plumb's `usual.h' header
 * definitions
 *  - Ian Jackson <ian@chiark.greenend.org.uk>.
 * Still in the public domain.
#include <string.h>   /* for memcpy() */
#include "md5_utils.h"
void
byteSwap(UWORD32 *buf, unsigned words) {
  md5byte *p;
  /* Only swap bytes for big endian machines */
  int i = 1;
  if (*(char *)&i == 1)
    return;
  p = (md5byte *)buf;
  do {
    *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
             ((unsigned)p[1] << 8 | p[0]);
    p += 4;
  } while (--words);
 * Start MD5 accumulation.  Set bit count to 0 and buffer to mysterious
 * initialization constants.
void
MD5Init(struct MD5Context *ctx) {
  ctx->buf[0] = 0x67452301;
  ctx->buf[1] = 0xefcdab89;
  ctx->buf[2] = 0x98badcfe;
  ctx->buf[3] = 0x10325476;
  ctx->bytes[0] = 0;
  ctx->bytes[1] = 0;
 * Update context to reflect the concatenation of another buffer full
 * of bytes.
void
MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len) {
  UWORD32 t;
  /* Update byte count */