i'm a graduate student currently working on extending modern image and video compression codecs to achieve better performance. I'm currently working on modifying BPG(Better Portable Graphics) and x265 (an HEVC/H.265 implementation).
My current approach involves adding additional intra-prediction modes that can make use of greater amount of information than just 1 pixel row from the CTU (Coding Tree Unit) above and 1 pixel column from the CTU to the left.
I have implemented my approach and named my intra-prediction mode as "35" (BPG and hevc use modes from 0-34). My current approach requires me to store two additional numbers (12 bits) each every time I make use of my intra-prediction mode. I am facing problems in embedding these two numbers in the bitstream(encoding) and in retrieving them from the bitstream(decoding).
I modified the function codeIntraDirLumaAng in entropy.cpp from the x265 package that is provided with BPG so that it writes the two additional numbers when it encounters my new intra-prediction mode 35.
My set of questions are as follows.
1) Given that I have a greater number of prediction modes, and I expect them to increase even more, should I modify the following line of code
encodeBinsEP(dir[j], 5);
to be
encodeBinsEP(dir[j], 6);
2) When i run the decoder, the first time it encounters an instance of where it should have stored mode 35. It is unable to read it, it reads mode 26 instead. I believe this is because of the derivation procedure for Intra-Luma Pred-Dir in the hevc? (Any input on how to correctly embed my new intra-prediction mode in the bitstream so that it can be read correctly)?
3) Should i be doing something with the CABAC states for the two additional numbers that i encode? I created an additional context for handling this new kind of information. I would appreciate pointers on how to set the value of a NUM_STATES_CTX variable that i defined in addition and how to use CABAC to best encode these two numbers?