Community
cancel
Showing results for 
Search instead for 
Did you mean: 
maqua
Beginner
230 Views

H.264 slice coding

Hi,

I am new to H.264 and have a problem to implemnt slice coding... any idea how to do it, because so far i have only managed to implement coding for fixed number of macroblocks but i need fixed slice sizes... I think I have a problem making the slices independent of each other

thanks

0 Kudos
6 Replies
jmason
Beginner
230 Views

I had the same issue and it took me about a week or so to get it just right. First, I created another CompressSlice function that was nearly identical to the existing implementation except the loop used to loop over each MB was slightly different. What I did was compress each MB and add it to the current slice's bitstream and once the size of the current slice's bitstream was over my max, I would remove the last compressed MB from the current slice's bitstream and then set the current MB as the first MB to be compressed the next time my CompressSlice function was called. I continue to do this until I have either encoded every MB or until I have filled up my last slice.

Now in the case where I have filled up my last slice but have NOT compressed all MBs, I would just reset the output bitstream, increase the quant and re-encode the frame again (the rate control functionality does this already if the encoded frame is larger than it should be). Once I have encoded all MBs, I then return with several slices whose payload is no larger than the maximum I set.

Does this help? Any questions?
maqua
Beginner
230 Views

Hi thanks for your reply,

The first paragraph is exactly like I tried to do it ... i start encoding mb's and once limit is exceeded I remove the last mb from bitstream such that next time I can start encoding from the address of this mb.

For me the number of slices actually obtained is not a probelm, a frame can take as many slices as required so long as the individual slice size does not exceed my limit so I was not taking care of adjusting the quant so as to be able to fit in more mb's in the slice.

Using the method described above however the stream still does not decode, basically it manages to decode only the first frame and then an error occurs. I think I have a problem because the slices generated are not being independent of each other i.e. i think that intra coding continues from one slice to the next so long as the slices belong to the same frame and this is not something i want...

any suggestions why this may be so?

jmason
Beginner
230 Views

When you enter the CompressSlice and are looping over the MBs, make sure you are setting the the current slice number for each MB to the current slice. That is if slice_num holds the current slice number then you need to have this line near the beginning of the for loop that loops over all of the MBs.

core_enc->m_pCurrentFrame->m_mbinfo.mbs[uMB].slice_id = slice_num;

If you do not set the slice id as I did above, the MBs will have the slice id that it should assuming fixed slices. I had similar problems when if I did not set the slice id. Hopefully that will fix your decoding issues.
mfssfm4life
Beginner
230 Views

Hello , I am new to this forum and i am doing a project on h.264 video transmission. I would like to know how to split the video into different frames. please help me out guys. i am noob in this rite now...will be glad if u can help..
Chao_Y_Intel
Employee
230 Views


Hello,

"I would like to know how to split the video into different frames"

Maybe you can have some explanation on this. The encoder is encoding the video frame by frame.

Regards,
Chao

Chris_G
Beginner
230 Views

I am curious why you did not use the Intel supplied code that seems to do the same thing you were trying to do? If you define SLICE_CHECK_LIMIT, this too ensures that slices don't exceed a max size. Were you trying to use multiple threads?
Reply