Monday, May 27, 2013

Decoder Test HEVC



#include "common/bitstream.h"
#include "common/VPS.h"
#include "decoder/CAVLC_decoder.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <vector>
static const unsigned char bytestream_vps[] =
{
     0x40, 0x01, 0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x00,
     0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0xba, 0x94, 0x90, 0x24
};
static const unsigned char bytestream_sps[] =
{
     0x42, 0x01, 0x01, 0x01, 0x60, 0x00, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00,
     0x03, 0x00, 0x00, 0x03, 0x00, 0xba, 0xa0, 0x0d, 0x08, 0x0f, 0x1f, 0xe5, 0x94,
     0x99, 0x24, 0x6d, 0x86, 0x16, 0x22, 0xaa, 0x4c, 0x4c, 0x32, 0xfb, 0x3e, 0xbc,
     0xdf, 0x96, 0x7d, 0x78, 0x51, 0x18, 0x9c, 0xbb, 0x20
};
static const unsigned char bytestream_pps[] =
{
     0x44, 0x01, 0xc1, 0xa5, 0x58, 0x11, 0x20
};
static const unsigned char rbsp_vps[] =
{
     0x0c, 0x01, 0xff, 0xff, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
     0x00, 0x00, 0xba, 0x94, 0x90, 0x24
};
static const unsigned char rbsp_sps[] =
{
     0x01, 0x01, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba,
     0xa0, 0x0d, 0x08, 0x0f, 0x1f, 0xe5, 0x94, 0x99, 0x24, 0x6d, 0x86, 0x16, 0x22,
     0xaa, 0x4c, 0x4c, 0x32, 0xfb, 0x3e, 0xbc, 0xdf, 0x96, 0x7d, 0x78, 0x51, 0x18,
     0x9c, 0xbb, 0x20
};

static const unsigned char rbsp_pps[] =
{
  int main(int argc, const char* argv[])
  {
      std::stringstream stream_vps;
      std::stringstream stream_sps;
     std::stringstream stream_pps;

for(int i=0; i<19; i++) stream_vps.put(rbsp_vps[i]);
for(int i=0; i<42; i++) stream_sps.put(rbsp_sps[i]);
for(int i=0; i<5; i++) stream_pps.put(rbsp_pps[i]);

HEVC::VPS vps;
HEVC::CAVLCDecoder decoder;
const unsigned char* buf =
reinterpret_cast<const unsigned char*>(stream_vps.str().c_str());
HEVC::InputBitstream bs(buf, stream_vps.str().length());
decoder.decode_vps(&bs, &vps);
assert(vps.get_vps_id() == 0);
assert(vps.get_max_layers() == 1);
assert(vps.get_max_sub_layers() == 1);
assert(vps.get_temporal_id_nesting_flag());
assert(vps.get_sub_layer_ordering_info_present_flag());
assert(vps.get_max_layer_id()==0);
assert(vps.get_num_layer_sets()==1);
assert(!vps.get_timing_info_present_flag());
assert(!vps.get_extension_flag());
0xc1, 0xa5, 0x58, 0x11, 0x20
};

return EXIT_SUCCESS;
}

No comments:

Post a Comment