Log in

View Full Version : how to calculate the intra prediction angle?


asdf013cv
1st August 2016, 16:13
after reading this (http://sidd-reddy.blogspot.tw/2011/04/h264-intra-coding.html), I finally understand what intra prediction is.

Here, I give my knowledge about intra prediction mode 2 and 10.
15506
15507
So, every sample locations are projected to a single reference row.

However, I don't understand how to calculate special angle, such as 6.
15510
If I use 15508, does it mean p is projected to N? (because 14/33 is closer to 2/5 not 3/5.)
Can any one help me how to draw the line or how the formula apply?

Also, I know for some special cases, if the projected pixel indexes is negative, I have to extend the reference row and column.
But, again, how to project the left reference column to the extended reference row?
15509
(not 23, so the Fig.3 of Intra Coding of the HEVC Standard (http://ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=6317153&tag=1) cannot work here)

Thanks a lot.

asdf013cv
2nd August 2016, 07:51
OK.
I think I understand how it works. So I am here to give my answer,
this is intra prediction mode 6 15513.
The color is based on the arrow which is closer to the center of the block.
Am I right?

But I still don't understand the intra prediction mode 22 15514.
Which block is the "?", K or L? And why?

FancyMouse
2nd August 2016, 09:59
Down to this detail level, you need to read the spec, section 8.4.4.2.6 formula 8-48 extends the reference row by filling the negative indices of the ref row with the column data (AJKL...). For 4x4 mode 22, 8-48 applies just for ref[-1], which calculates to p[-1][1], which would be K.
And don't forget extrapolation (see formula 8-52). Your coloring would not make sense because each predicted sample would depend on 2 pixels in ref array.

asdf013cv
2nd August 2016, 15:55
Down to this detail level, you need to read the spec, section 8.4.4.2.6 formula 8-48 extends the reference row by filling the negative indices of the ref row with the column data (AJKL...). For 4x4 mode 22, 8-48 applies just for ref[-1], which calculates to p[-1][1], which would be K.
And don't forget extrapolation (see formula 8-52). Your coloring would not make sense because each predicted sample would depend on 2 pixels in ref array.

Thanks.

However, I have a problem while calculating
ref[x]=p[-1+x][-1], x=nTbS+1..2*nTbS (8-49)
for nTbS is 4, predModeIntra is 27 and intraPredAngle is 2.

x=4+1..2*4? 8 to 12? How could it be possible.
What is real range for x?

asdf013cv
3rd August 2016, 07:20
OK.
"nTbS+1..2*nTbS" means "nTbS+1 to 2*nTbS".
if nTbS is 4, then it is "5 to 8".

This is intra prediction 27
15515
The color it not totally true (because the actual extrapolation is (30*B+2*C+16)/32), but the idea is almost correct.