How to get the information of encoded video from the Decoder TAppdecoderStatic HM model - encoder

I am trying to obtain the information (including Intra, motion vector, coeff) of compressed frames from the Decoder of HEVC Test Model. I used this command in Linux:
env PRINT_COEFF=1 PRINT_INTRA=1 PRINT_MV=1 SAVE_PREFILT=1 ./TAppDecoderAnalyserStaticd -b "BasketballDrive_1920x1080_50_50.bin"
-o "BasketballDrive_1920x1080_50_50.yuv"
But it only returns results like this
HM software: Decoder Version [11.0][Linux][GCC 7.5.0][64 bit]
POC 0 TId: 0 ( I-SLICE, QP 27 ) [DT 0.049] [L0 ] [L1 ] [:,,,(unk)]
POC 1 TId: 0 ( P-SLICE, QP 30 ) [DT 0.016] [L0 0 ] [L1 ] [:,,,(unk)]
POC 2 TId: 0 ( P-SLICE, QP 29 ) [DT 0.019] [L0 1 0 ] [L1 ] [:,,,(unk)]
POC 3 TId: 0 ( P-SLICE, QP 30 ) [DT 0.015] [L0 2 1 0 ] [L1 ] [:,,,(unk)]
POC 4 TId: 0 ( P-SLICE, QP 28 ) [DT 0.017] [L0 3 2 1 0 ] [L1 ] [:,,,(unk)]
POC 5 TId: 0 ( P-SLICE, QP 30 ) [DT 0.009] [L0 4 3 2 0 ] [L1 ] [:,,,(unk)]
POC 6 TId: 0 ( P-SLICE, QP 29 ) [DT 0.011] [L0 5 4 3 0 ] [L1 ] [:,,,(unk)]
POC 7 TId: 0 ( P-SLICE, QP 30 ) [DT 0.010] [L0 6 5 4 0 ] [L1 ] [:,,,(unk)]
enter code hereTotal Time: 0.172 sec.
And the results I am expecting like this
information from compressed video
Is there any solution to solve this problem?
Thanks.

I don't know where those PRINT_X parameters are coming from. But according to the official HM code, they should do nothing.
Second, what do you mean intra mode or MV of a frame? The information you are asking are in the block level.
Block level information like these can be recorded during the parsing.

If you want to log block-level information such as intra mode, MV, QP, partition size etc, you can do it simply during the parsing phase at the decoder side. In this phase, most syntax elements have dedicated functions to read their values from bitstream and copy them in the coding unit structure (all happens in TDecSbac.cpp)
For instance, you can go to parseIntraDirLumaAng() and take intraPredMode of the corresponding block. Or go to parseCoeffNxN() and take coefficient values stored in pcCoef array. Same about MV and other syntax elements.

Related

Object does not exist in the pdf file structure

%PDF-1.5
...
10737 0 obj
<</MarkInfo<</Marked true>>/Metadata 161 0 R/PageLayout/OneColumn/Pages 10732 0 R/StructTreeRoot 206 0 R/Type/Catalog>>
endobj
10738 0 obj
<</Contents[10740 0 R 10741 0 R 10747 0 R 10748 0 R 10749 0 R 10750 0 R 10751 0 R 10752 0 R]/CropBox[0.0 0.0 516.0 728.64]/MediaBox[0.0 0.0 516.0 728.64]/Parent 10733 0 R/Resources<</ColorSpace<</CS0 10771 0 R/CS1 10772 0 R>>/ExtGState<</GS0 10773 0 R>>/Font<</C2_0 10778 0 R/C2_1 10783 0 R/C2_2 10788 0 R/C2_3 10793 0 R/C2_4 10798 0 R/TT0 10800 0 R/TT1 10802 0 R/TT2 10804 0 R/TT3 10806 0 R/TT4 10808 0 R>>/XObject<</Im0 10769 0 R>>>>/Rotate 0/StructParents 0/Tabs/S/Type/Page>>
endobj
10739 0 obj
<</Filter/FlateDecode/First 410/Length 3756/N 38/Type/ObjStm>>stream
10771 0 10772 21 10773 42 10774 138 10775 190 10776 442 10777 741 10778 752 10779 869 10780 921 10781 1190 10782 2050 10783 2061 10784 2192 10785 2244 10786 2504 10787 3456 10788 3467 10789 3587 10790 3639 10791 3903 10792 6058 10793 6069 10794 6196 10795 6248 10796 6507 10797 8153 10798 8164 10799 8284 10800 8496 10801 9662 10802 9894 10803 11072 10804 11325 10805 11779 10806 11985 10807 13147 10808 13395
[/ICCBased 10753 0 R][/ICCBased 10754 0 R]
<</AIS false/BM/Normal/CA 1.0/OP false/OPM 1/SA true/SMask/None/Type/ExtGState/ca 1.0/op false>>
<</Ordering(Identity)/Registry(Adobe)/Supplement 0>><</Ascent 858/CIDSet 10757 0 R/CapHeight 719/Descent -148/Flags 4/FontBBox[-16 -148 1008 858]/FontFamily(\xfe\xff\x00H\x00Y\xc9\x11\xac\xe0\xb5\x15)/FontFile2 10758 0 R/FontName/YDRADB+H2gtrM/FontStretch/Normal/FontWeight 400/ItalicAngle 0/StemV 60/Type/FontDescriptor/XHeight 520>>
...
endstream
endobj
...
No. - Type
10732 - Pages
206 - StructTreeRoot
10771, 10772, 10773, 10778 ... - Font
Many indirect objects including 10732, 206, 10771 and 10772 do not exist in the pdf file.
But I think I found objects 10771~10808 in object 10739 stream.
Q1. Why are there no object 10732(Pages) and 206(StructTreeRoot) in the pdf file?
Q2. Why are indirect objects in stream?
I would be grateful if you would suggest any explanations or resources for reference.
Starting with version 1.5 PDF supports so called object streams, i.e. stream objects which contain other non-stream objects.
Your object 10739 is such an object stream as you can see in its Type ObjStm.
This allows those other objects to be compressed. In particular structure tree objects which otherwise can substantially increase the size of a PDF, can be compressed fairly well, reducing their impact on the document size.
For details please study the PDF specification, section 7.5.7 – Object Streams, in either the current PDF specification ISO 32000-2 or its predecessor ISO 32000-1.
Adobe has shared a copy of ISO 32000-1 on their web site which merely has its ISO page headers replaced. Simply google for "PDF32000_2008"; currently it is located at https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf but as far as I know this isn't a permalink.

Extract text from wrk output

I'm running a load test with wrk2 as a job on Jenkins. I'd like to send the results of the load test to Graylog but I only want to store the Requests/Sec and average latency.
Here's what the output looks like:
Running 30s test # https://example.com
1 threads and 100 connections
Thread calibration: mean lat.: 8338.285ms, rate sampling interval: 19202ms
Thread Stats Avg Stdev Max +/- Stdev
Latency 16.20s 6.17s 29.64s 65.74%
Req/Sec 5.00 0.00 5.00 100.00%
Latency Distribution (HdrHistogram - Recorded Latency)
50.000% 15.72s
75.000% 20.81s
90.000% 24.58s
99.000% 29.13s
99.900% 29.66s
99.990% 29.66s
99.999% 29.66s
100.000% 29.66s
Detailed Percentile spectrum:
Value Percentile TotalCount 1/(1-Percentile)
4497.407 0.000000 1 1.00
7561.215 0.100000 11 1.11
11100.159 0.200000 22 1.25
12582.911 0.300000 33 1.43
14565.375 0.400000 44 1.67
15720.447 0.500000 54 2.00
16416.767 0.550000 60 2.22
17301.503 0.600000 65 2.50
18464.767 0.650000 71 2.86
19185.663 0.700000 76 3.33
20807.679 0.750000 81 4.00
21479.423 0.775000 84 4.44
22347.775 0.800000 87 5.00
22527.999 0.825000 90 5.71
23216.127 0.850000 93 6.67
23478.271 0.875000 95 8.00
23805.951 0.887500 96 8.89
24723.455 0.900000 98 10.00
25067.519 0.912500 99 11.43
25395.199 0.925000 101 13.33
26525.695 0.937500 102 16.00
26525.695 0.943750 102 17.78
26705.919 0.950000 103 20.00
28065.791 0.956250 104 22.86
28065.791 0.962500 104 26.67
28377.087 0.968750 105 32.00
28377.087 0.971875 105 35.56
28475.391 0.975000 106 40.00
28475.391 0.978125 106 45.71
28475.391 0.981250 106 53.33
29130.751 0.984375 107 64.00
29130.751 0.985938 107 71.11
29130.751 0.987500 107 80.00
29130.751 0.989062 107 91.43
29130.751 0.990625 107 106.67
29655.039 0.992188 108 128.00
29655.039 1.000000 108 inf
#[Mean = 16199.756, StdDeviation = 6170.105]
#[Max = 29638.656, Total count = 108]
#[Buckets = 27, SubBuckets = 2048]
----------------------------------------------------------
130 requests in 30.02s, 13.44MB read
Socket errors: connect 0, read 0, write 0, timeout 1192
Requests/sec: 4.33
Transfer/sec: 458.47KB
Does anyone know how I could go about extracting Requests/sec (at the bottom) and the latency average to send as JSON parameters?
The expected output would be: "latency": 16.2, "requests_per_second": 4.33
You didn't provide the expected output so your question isn't clear but is this what you want?
$ awk 'BEGIN{a["Latency"]; a["Requests/sec:"]} ($1 in a) && ($2 ~ /[0-9]/){print $1, $2}' file
Latency 16.20s
Requests/sec: 4.33
Updated based on you adding expected output to your question:
$ awk '
BEGIN { map["Latency"]="latency"; map["Requests/sec:"]="requests_per_second" }
($1 in map) && ($2 ~ /[0-9]/) { printf "%s\"%s\": %s", ofs, map[$1], $2+0; ofs=", " }
END { print "" }
' file
"latency": 16.2, "requests_per_second": 4.33

decodingTCAP message - dialoguePortion

I'm writing an simulator (for learning purposes) for complete M3UA-SCCP-TCAP-MAP stack (over SCTP). So far M3UA+SCCP stacks are OK.
M3UA Based on the RFC 4666 Sept 2006
SCCP Based on the ITU-T Q.711-Q716
TCAP Based on the ITU-T Q.771-Q775
But upon decoding TCAP part I got lost on dialoguePortion.
TCAP is asn.1 encoded, so everything is tag+len+data.
Wireshark decode it differently than my decoder.
Message is:
62434804102f00676b1e281c060700118605010101a011600f80020780a1090607040000010005036c1ba1190201010201163011800590896734f283010086059062859107
Basically, my message is BER-decoded as
Note: Format: hex(tag) + (BER splitted to CLS+PC+TAG in decimal) + hex(data)
62 ( 64 32 2 )
48 ( 64 0 8 ) 102f0067
6b ( 64 32 11 )
28 ( 0 32 8 )
06 ( 0 0 6 ) 00118605010101 OID=0.0.17.773.1.1.1
a0 ( 128 32 0 )
60 ( 64 32 0 )
80 ( 128 0 0 ) 0780
a1 ( 128 32 1 )
06 ( 0 0 6 ) 04000001000503 OID=0.4.0.0.1.0.5.3
6c ( 64 32 12 )
...
So I can see begin[2] message containing otid[8], dialogPortion[11] and componentPortion[12].
otid and ComponentPortion are decoded correctly. But not dialogPortion.
ASN for dialogPortion does not mention any of these codes.
Even more confusing, wireshark decode it differently (oid-as-dialogue is NOT in the dialoguePortion, but as a field after otid, which is NOT as described in ITU-T documentation - or not as I'm understanding it)
Wireshark decoded Transaction Capabilities Application Part
begin
Source Transaction ID
otid: 102f0067
oid: 0.0.17.773.1.1.1 (id-as-dialogue)
dialogueRequest
Padding: 7
protocol-version: 80 (version1)
1... .... = version1: True
application-context-name: 0.4.0.0.1.0.5.3 (locationInfoRetrievalContext-v3)
components: 1 item
...
I can't find any reference for Padding in dialoguePDU ASN.
Can someone point me in the right direction?
I would like to know how to properly decode this message
DialoguePDU format should be simple in this case:
dialogue-as-id OBJECT IDENTIFIER ::= {itu-t recommendation q 773 as(1) dialogue-as(1) version1(1)}
DialoguePDU ::= CHOICE {
dialogueRequest AARQ-apdu,
dialogueResponse AARE-apdu,
dialogueAbort ABRT-apdu
}
AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE {
protocol-version [0] IMPLICIT BIT STRING {version1(0)} DEFAULT {version1},
application-context-name [1] OBJECT IDENTIFIER,
user-information [30] IMPLICIT SEQUENCE OF EXTERNAL OPTIONAL
}
Wireshark is still wrong :-). But then... that is display. It displays values correctly - only in the wrong section. Probably some reason due to easier decoding.
What I was missing was definition of EXTERNAL[8]. DialoguePortion is declared as EXTERNAL...so now everything makes sense.
For your message, my very own decoder says:
begin [APPLICATION 2] (x67)
otid [APPLICATION 8] (x4) =102f0067h
dialoguePortion [APPLICATION 11] (x30)
EXTERNAL (x28)
direct-reference [OBJECT IDENTIFIER] (x7) =00118605010101h
encoding:single-ASN1-type [0] (x17)
dialogueRequest [APPLICATION 0] (x15)
protocol-version [0] (x2) = 80 {version1 (0) } spare bits= 7
application-context-name [1] (x9)
OBJECT IDENTIFIER (x7) =04000001000503h
components [APPLICATION 12] (x27)
invoke [1] (x25)
invokeID [INTEGER] (x1) =1d (01h)
operationCode [INTEGER] (x1) = (22) SendRoutingInfo
parameter [SEQUENCE] (x17)
msisdn [0] (x5) = 90896734f2h
Nature of Address: international number (1)
Numbering Plan Indicator: unknown (0)
signal= 9876432
interrogationType [3] (x1) = (0) basicCall
gmsc-Address [6] (x5) = 9062859107h
Nature of Address: international number (1)
Numbering Plan Indicator: unknown (0)
signal= 26581970
Now, wireshark's padding 7 and my spare bits=7 both refer to the the protocol-version field, defined in Q.773 as:
AARQ-apdu ::= [APPLICATION 0] IMPLICIT SEQUENCE {
protocol-version [0] IMPLICIT BIT STRING { version1 (0) }
DEFAULT { version1 },
application-context-name [1] OBJECT IDENTIFIER,
user-information [30] IMPLICIT SEQUENCE OF EXTERNAL
OPTIONAL }
the BIT STRING definition, assigns name to just the leading bit (version1)... the rest (7 bits) are not given a name and wireshark consider them as padding

Why this parameter '+profile "*"' get convert killed?

If I run this command,
convert -limit memory 2071963648 -quality 100 -alpha off -density 165% -scene 1 infile.jpg outfile.png
The conversion runs without any issue.
However if I add +profile "*",
convert +profile "*" -limit memory 2071963648 -quality 100 -alpha off -density 165% -scene 1 infile.jpg outfile.png
The process is killed.
Here is output from dmesg
[ 1403.401440] [ pid ] uid tgid total_vm rss nr_ptes swapents oom_score_adj name
[ 1403.401444] [ 474] 0 474 4869 49 13 0 0 upstart-udev-br
[ 1403.401446] [ 480] 0 480 12460 207 27 0 -1000 systemd-udevd
[ 1403.401448] [ 659] 0 659 3815 55 13 0 0 upstart-socket-
[ 1403.401449] [ 671] 0 671 2556 572 8 0 0 dhclient
[ 1403.401451] [ 852] 102 852 9806 94 23 0 0 dbus-daemon
[ 1403.401453] [ 860] 101 860 65019 147 29 0 0 rsyslogd
[ 1403.401454] [ 884] 0 884 10863 85 27 0 0 systemd-logind
[ 1403.401456] [ 888] 0 888 3819 64 11 0 0 upstart-file-br
[ 1403.401463] [ 967] 0 967 3635 41 12 0 0 getty
[ 1403.401464] [ 970] 0 970 3635 42 12 0 0 getty
[ 1403.401466] [ 974] 0 974 3635 40 12 0 0 getty
[ 1403.401467] [ 975] 0 975 3635 40 12 0 0 getty
[ 1403.401468] [ 977] 0 977 3635 41 12 0 0 getty
[ 1403.401470] [ 1047] 0 1047 15341 169 33 0 -1000 sshd
[ 1403.401472] [ 1052] 0 1052 5914 58 17 0 0 cron
[ 1403.401473] [ 1057] 0 1057 4785 40 13 0 0 atd
[ 1403.401475] [ 1089] 0 1089 1092 36 8 0 0 acpid
[ 1403.401476] [ 1099] 0 1099 4797 63 15 0 0 irqbalance
[ 1403.401478] [ 1224] 0 1224 6336 78 16 0 0 master
[ 1403.401479] [ 1230] 106 1230 6852 73 18 0 0 pickup
[ 1403.401481] [ 1231] 106 1231 6893 81 19 0 0 qmgr
[ 1403.401482] [ 1281] 999 1281 278175 5269 82 0 0 sensu-client
[ 1403.401484] [ 1397] 0 1397 3635 42 11 0 0 getty
[ 1403.401485] [ 1398] 0 1398 3197 37 11 0 0 getty
[ 1403.401487] [ 1515] 107 1515 7862 150 19 0 0 ntpd
[ 1403.401488] [ 1929] 0 1929 26408 247 55 0 0 sshd
[ 1403.401490] [ 1982] 1000 1982 26442 256 53 0 0 sshd
[ 1403.401491] [ 1983] 1000 1983 5580 761 16 0 0 bash
[ 1403.401493] [ 2488] 1000 2488 8685 1607 22 0 0 pynt
[ 1403.401494] [ 2490] 1000 2490 8685 1607 21 0 0 pynt
[ 1403.401495] [ 2491] 1000 2491 1111 24 7 0 0 sh
[ 1403.401497] [ 2492] 1000 2492 1111 25 7 0 0 sh
[ 1403.401498] [ 2493] 1000 2493 15638 3221 36 0 0 python
[ 1403.401500] [ 2494] 1000 2494 15939 3535 36 0 0 python
[ 1403.401501] [ 2924] 1000 2924 975967 954941 1894 0 0 convert
[ 1403.401503] Out of memory: Kill process 2924 (convert) score 945 or sacrifice child
[ 1403.406111] Killed process 2924 (convert) total-vm:3903868kB, anon-rss:3819760kB, file-rss:4kB
I am using this version of ImageMagick
$ convert -version
Version: ImageMagick 6.8.9-7 Q16 x86_64 2014-12-30 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: jng jpeg png x xml zlib
on ubuntu 14.04.1
I don't know why +profile would cause ImageMagick to crash, but as an alternative you might like to try -strip like this.
convert image.jpg -strip output.jpg
It strips the image of all profiles and comments.

Getting a 2D histogram of a grayscale image in Julia

Using the Images package, I can open up a color image, convert it to Gray scale and then :
using Images
img_gld = imread("...path to some color jpg...")
img_gld_gs = convert(Image{Gray},img_gld)
#change from floats to Array of values between 0 and 255:
img_gld_gs = reinterpret(Uint8,data(img_gld_gs))
Now I've got a 1920X1080 array of Uint8's:
julia> img_gld_gs
1920x1080 Array{Uint8,2}
Now I want to get a histogram of the 2D array of Uint8 values:
julia> hist(img_gld_gs)
(0.0:50.0:300.0,
6x1080 Array{Int64,2}:
1302 1288 1293 1302 1297 1300 1257 1234 … 12 13 13 12 13 15 14
618 632 627 618 623 620 663 686 189 187 187 188 185 183 183
0 0 0 0 0 0 0 0 9 9 8 7 8 7 7
0 0 0 0 0 0 0 0 10 12 9 7 13 7 9
0 0 0 0 0 0 0 0 1238 1230 1236 1235 1230 1240 1234
0 0 0 0 0 0 0 0 … 462 469 467 471 471 468 473)
But, instead of 6x1080, I'd like 256 slots in the histogram to show total number of times each value has appeared. I tried:
julia> hist(img_gld_gs,256)
But that gives:
(2.0:1.0:252.0,
250x1080 Array{Int64,2}:
So instead of a 256x1080 Array, it's 250x1080. Is there any way to force it to have 256 bins (without resorting to writing my own hist function)? I want to be able to compare different images and I want the histogram for each image to have the same number of bins.
Assuming you want a histogram for the entire image (rather than one per row), you might want
hist(vec(img_gld_gs), -1:255)
which first converts the image to a 1-dimensional vector. (You can also use img_gld_gs[:], but that copies the data.)
Also note the range here: the hist function uses a left-open interval, so it will omit counting zeros unless you use something smaller than 0.
hist also accepts a vector (or range) as an optional argument that specifies the edge boundaries, so
hist(img_gld_gs, 0:256)
should work.

Resources