• Jim Bankoski's avatar
    vpn common -> implicit segmentation · 91325b8f
    Jim Bankoski authored
    This introduces base functions for introducing implicit segmentation.
    The code that actually stores the results to the segment map isn't
    here yet.   This just prints out the segmentation map results
    if you call it.
    
    Uses connected component labeling technique on mbmi info so that only
    if 2 mbs are horizontally or vertically touching do they get the same
    segment.
    
    vp8next - plumbing for rotation
    
    code to produce taps for rotation ( tapify. py ),  code
    for predicting using rotation ( predict_rotated.c ) ,  code
    for finding the best rotation find_rotation.c.
    
    didn't checkin code that uses this in the codec.   still work
    in progress.
    
    Fixed copyright notice
    
    Change-Id: I450c13cfa41ab2fcb699f3897760370b4935fdf8
    91325b8f
vp8_multi_resolution_encoder.c 16.13 KiB
/*
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */
 * This is an example demonstrating multi-resolution encoding in VP8.
 * High-resolution input video is down-sampled to lower-resolutions. The
 * encoder then encodes the video and outputs multiple bitstreams with
 * different resolutions.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "math.h"
#define VPX_CODEC_DISABLE_COMPAT 1
#include "vpx/vpx_encoder.h"
#include "vpx/vp8cx.h"
#include "vpx_ports/mem_ops.h"
#define interface (vpx_codec_vp8_cx())
#define fourcc    0x30385056
#define IVF_FILE_HDR_SZ  (32)
#define IVF_FRAME_HDR_SZ (12)
 * The input video frame is downsampled several times to generate a multi-level
 * hierarchical structure. NUM_ENCODERS is defined as the number of encoding
 * levels required. For example, if the size of input video is 1280x720,
 * NUM_ENCODERS is 3, and down-sampling factor is 2, the encoder outputs 3
 * bitstreams with resolution of 1280x720(level 0), 640x360(level 1), and
 * 320x180(level 2) respectively.
#define NUM_ENCODERS 3
/* This example uses the scaler function in libyuv. */
#include "third_party/libyuv/include/libyuv/basic_types.h"
#include "third_party/libyuv/include/libyuv/scale.h"
#include "third_party/libyuv/include/libyuv/cpu_id.h"
static double vp8_mse2psnr(double Samples, double Peak, double Mse)
    double psnr;
    if ((double)Mse > 0.0)
        psnr = 10.0 * log10(Peak * Peak * Samples / Mse);
    else
        psnr = 60;      // Limit to prevent / 0
    if (psnr > 60)
        psnr = 60;
    return psnr;
static void die(const char *fmt, ...) {
    va_list ap;
    va_start(ap, fmt);
    vprintf(fmt, ap);
    if(fmt[strlen(fmt)-1] != '\n')
        printf("\n");
    exit(EXIT_FAILURE);