URL
https://opencores.org/ocsvn/nova/nova/trunk
[/] [nova/] [trunk/] [test/] [bin2hex.pl] - Diff between revs 7 and 11
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 7 |
Rev 11 |
#! /usr/bin/perl
|
#! /usr/bin/perl
|
|
|
# Author(s) : Ke Xu
|
# Author(s) : Ke Xu
|
# Email : eexuke@yahoo.com
|
# Email : eexuke@yahoo.com
|
# Description: Convert binary .264 file to text format
|
# Description: Convert binary .264 file to text format
|
# Usage : bin2hex.pl xxx.264
|
# Usage : bin2hex.pl xxx.264
|
# Copyright (C) 2008 Ke Xu
|
# Copyright (C) 2008 Ke Xu
|
|
|
open STDOUT, ">akiyo300_1ref.txt" || die "Can't open output file:$!\n";
|
open STDOUT, ">akiyo300_1ref.txt" || die "Can't open output file:$!\n";
|
if (open(BINFILE,"<".$ARGV[0]))
|
if (open(BINFILE,"<".$ARGV[0]))
|
{
|
{
|
binmode(BINFILE);
|
binmode(BINFILE);
|
$s = '';
|
$s = '';
|
$i = 0;
|
$i = 0;
|
while (!eof(BINFILE))
|
while (!eof(BINFILE))
|
{
|
{
|
if ($i >= 2)
|
if ($i >= 2)
|
{
|
{
|
printf "%s\n",$s;
|
printf "%s\n",$s;
|
$s = '';
|
$s = '';
|
$i = 0;
|
$i = 0;
|
}
|
}
|
else
|
else
|
{
|
{
|
$i++;
|
$i++;
|
$s .= sprintf("%02X",ord(getc(BINFILE)));
|
$s .= sprintf("%02X",ord(getc(BINFILE)));
|
}
|
}
|
}
|
}
|
###if last line of BINFILE is less than 16 byte
|
###if last line of BINFILE is less than 16 byte
|
if ($i < 2)
|
if ($i < 2)
|
{
|
{
|
printf "%s",$s;
|
printf "%s",$s;
|
}
|
}
|
close (BINFILE);
|
close (BINFILE);
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.