chromium/third_party/webrtc/common_video/h264/sps_vui_rewriter.cc

/*
 *  Copyright (c) 2016 The WebRTC 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.
 *
 */

#include "common_video/h264/sps_vui_rewriter.h"

#include <string.h>

#include <algorithm>
#include <cstdint>
#include <vector>

#include "api/video/color_space.h"
#include "common_video/h264/h264_common.h"
#include "common_video/h264/sps_parser.h"
#include "rtc_base/bit_buffer.h"
#include "rtc_base/bitstream_reader.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/metrics.h"

namespace webrtc {

namespace {

// The maximum expected growth from adding a VUI to the SPS. It's actually
// closer to 24 or so, but better safe than sorry.
const size_t kMaxVuiSpsIncrease =;

const char* kSpsValidHistogramName =;
enum SpsValidEvent {};

#define RETURN_FALSE_ON_FAIL(x)

uint8_t CopyUInt8(BitstreamReader& source, rtc::BitBufferWriter& destination) {}

uint32_t CopyExpGolomb(BitstreamReader& source,
                       rtc::BitBufferWriter& destination) {}

uint32_t CopyBits(int bits,
                  BitstreamReader& source,
                  rtc::BitBufferWriter& destination) {}

bool CopyAndRewriteVui(const SpsParser::SpsState& sps,
                       BitstreamReader& source,
                       rtc::BitBufferWriter& destination,
                       const webrtc::ColorSpace* color_space,
                       SpsVuiRewriter::ParseResult& out_vui_rewritten);

void CopyHrdParameters(BitstreamReader& source,
                       rtc::BitBufferWriter& destination);
bool AddBitstreamRestriction(rtc::BitBufferWriter* destination,
                             uint32_t max_num_ref_frames);
bool IsDefaultColorSpace(const ColorSpace& color_space);
bool AddVideoSignalTypeInfo(rtc::BitBufferWriter& destination,
                            const ColorSpace& color_space);
bool CopyOrRewriteVideoSignalTypeInfo(
    BitstreamReader& source,
    rtc::BitBufferWriter& destination,
    const ColorSpace* color_space,
    SpsVuiRewriter::ParseResult& out_vui_rewritten);
bool CopyRemainingBits(BitstreamReader& source,
                       rtc::BitBufferWriter& destination);
}  // namespace

void SpsVuiRewriter::UpdateStats(ParseResult result, Direction direction) {}

SpsVuiRewriter::ParseResult SpsVuiRewriter::ParseAndRewriteSps(
    rtc::ArrayView<const uint8_t> buffer,
    absl::optional<SpsParser::SpsState>* sps,
    const webrtc::ColorSpace* color_space,
    rtc::Buffer* destination) {}

SpsVuiRewriter::ParseResult SpsVuiRewriter::ParseAndRewriteSps(
    rtc::ArrayView<const uint8_t> buffer,
    absl::optional<SpsParser::SpsState>* sps,
    const webrtc::ColorSpace* color_space,
    rtc::Buffer* destination,
    Direction direction) {}

rtc::Buffer SpsVuiRewriter::ParseOutgoingBitstreamAndRewrite(
    rtc::ArrayView<const uint8_t> buffer,
    const webrtc::ColorSpace* color_space) {}

namespace {
bool CopyAndRewriteVui(const SpsParser::SpsState& sps,
                       BitstreamReader& source,
                       rtc::BitBufferWriter& destination,
                       const webrtc::ColorSpace* color_space,
                       SpsVuiRewriter::ParseResult& out_vui_rewritten) {}

// Copies a VUI HRD parameters segment.
void CopyHrdParameters(BitstreamReader& source,
                       rtc::BitBufferWriter& destination) {}

// These functions are similar to webrtc::H264SpsParser::Parse, and based on the
// same version of the H.264 standard. You can find it here:
// http://www.itu.int/rec/T-REC-H.264

// Adds a bitstream restriction VUI segment.
bool AddBitstreamRestriction(rtc::BitBufferWriter* destination,
                             uint32_t max_num_ref_frames) {}

bool IsDefaultColorSpace(const ColorSpace& color_space) {}

bool AddVideoSignalTypeInfo(rtc::BitBufferWriter& destination,
                            const ColorSpace& color_space) {}

bool CopyOrRewriteVideoSignalTypeInfo(
    BitstreamReader& source,
    rtc::BitBufferWriter& destination,
    const ColorSpace* color_space,
    SpsVuiRewriter::ParseResult& out_vui_rewritten) {}

bool CopyRemainingBits(BitstreamReader& source,
                       rtc::BitBufferWriter& destination) {}

}  // namespace

}  // namespace webrtc