Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th December 2005, 08:43   #1  |  Link
omion
Registered User
 
omion's Avatar
 
Join Date: Nov 2003
Location: San Diego, CA
Posts: 325
CAVLC -> CABAC?

I've just started to encode an HDTV movie, and have been playing around with the settings. After a few quick tests, I found that at 720p24 I can't play back CABAC-encoded files, but I can play CAVLC. Is there any tool available which can "recompress" between the two?

My idea is to encode with CAVLC and just accept the slightly larger file until I get my next computer. Then I'll "recompress" the file to CABAC to save space.

So is there anything available which can do this? If not, is it something simple enough to expect it to be available in the future?
__________________
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
omion is offline   Reply With Quote
Old 26th December 2005, 08:59   #2  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
There is no such tool existing, but it shouldn't be hard to write.

Last edited by akupenguin; 26th December 2005 at 09:01.
akupenguin is offline   Reply With Quote
Old 26th December 2005, 16:03   #3  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
Forgive my complete and utter ignorance, but it can be done in a lossless way? How?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.

Last edited by Chainmax; 26th December 2005 at 17:05.
Chainmax is offline   Reply With Quote
Old 26th December 2005, 16:18   #4  |  Link
Sharktooth
Mr. Sandman
 
Sharktooth's Avatar
 
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
Converting CABAC compressed data in CAVLC... something like converting a 7-zip archive into a normal zip.
Sharktooth is offline   Reply With Quote
Old 26th December 2005, 16:23   #5  |  Link
virus
Senior n00b
 
Join Date: Jan 2004
Location: Italy
Posts: 446
Quote:
Originally Posted by Chainmax
Forgive my complete and utter ingorance, but it can be done in a lossless way? How?
Entropy coding via CABAC or CAVLC is done as last step, after ME and quantization have taken place. Let's say it's a lossless process that just "writes down to the bitstream" the already-computed data (transformed&quantized coefficients, macroblock types, motion vectors, plus additional side-infos). All you need to do is to decode the CAVLC/CABAC stream and reencode it to the other format, while signalling in the slice headers that you've switched entropy coder type. Nothing will be lost in the process, since detail removal (which comes from quantization) need not be performed again. You just redo the very last step in your encoding chain (see what I've written above).
virus is offline   Reply With Quote
Old 26th December 2005, 17:07   #6  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
So, it would be akin to switching headers on a video stream or demuxing and remuxing into a different container?
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Old 26th December 2005, 20:43   #7  |  Link
omion
Registered User
 
omion's Avatar
 
Join Date: Nov 2003
Location: San Diego, CA
Posts: 325
@Chainmax:
It would be a bit like changing containers, but Sharktooth's zip analogy is better. The data is compressed with either CABAC or CAVLC before it is written to a file.

By the way, I found I can read 720p24 CABAC movies as long as I use the overlay mixer. Since I watch a lot of subbed anime, I always have VMR9 renderless on, but it seems to be a bit too slow in this case.
__________________
"We demand rigidly defined areas of doubt and uncertainty!" - Vroomfondel, H2G2
omion is offline   Reply With Quote
Old 14th October 2006, 02:01   #8  |  Link
Limobar
aka Rabomil
 
Join Date: Sep 2005
Posts: 82
Quote:
Originally Posted by akupenguin View Post
There is no such tool existing, but it shouldn't be hard to write.
Quote:
Originally Posted by akupenguin View Post
I'd expect the converter to run no slower than 1.5x realtime.
Dear Developers,

Please consider writing a tool that converts CABAC to CAVLC. People that use the Xbox (XBMC) would then be able to enjoy so much more content that is available, but not decodable because of the limited processing power of the Xbox and the processing power needed by CABAC.

The combination of a tool that appears not to be that hard to write (according to akupenguin) and the reasonable conversion time needed, in my opinion, makes it worth the effort. I hope you feel the same.

Regards,
Limobar
Limobar is offline   Reply With Quote
Old 8th August 2006, 09:26   #9  |  Link
j7n
Registered User
 
j7n's Avatar
 
Join Date: Apr 2006
Posts: 101
As far as I understand CABAC considerably increases CPU load during playback. I think that after recompressing into CAVLC my older computer would be able to decode my H.264 files in real-time. Has the situation changed after 7 months and a tool to convert between CABAC & CAVLC become available?
j7n is offline   Reply With Quote
Old 8th August 2006, 10:15   #10  |  Link
Limobar
aka Rabomil
 
Join Date: Sep 2005
Posts: 82
I would welcome a CABAC-to-CAVLC-converter because that would make more encodes decodable for the Xbox.
Limobar is offline   Reply With Quote
Old 29th November 2022, 18:26   #11  |  Link
kurkosdr
Registered User
 
Join Date: Aug 2009
Posts: 194
Quote:
Originally Posted by Limobar View Post
I would welcome a CABAC-to-CAVLC-converter because that would make more encodes decodable for the Xbox.
Which Xbox?
kurkosdr is offline   Reply With Quote
Old 1st December 2022, 01:45   #12  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,369
Quote:
Originally Posted by kurkosdr View Post
Which Xbox?
It could help with Xbox 360, which didn't have any hardware decoders. I was working on the Microsoft codec team when the H.264 software decoder was being built for HD DVD playback. Lots of very smart people using some very clever design using all three of the PowerPC + AltiVec cores and the GPU of the 360 were able to support ~30 Mbps 1080i30 H.264 playback for HD-DVD, including CABAC. The Silverlight-derived Greenlight framework's H.264 decoder could handle 1080p30 10 Mbps with CABAC just fine.

(Graybeard esoterica warning)
Greenlight was only limited to 720p due to non-conformant H.264 files that were flagged Level 4.0 but had >>4 reference frames. It was x264's fault by not enforcing of profile and level constraints, so x265 --preset veryslow --level 4.0 would blithly make something that would require level 4.2 or higher. Even then the problem was with memory, not compute. It's still hard to believe that the 360 and PS3 only had 512 MB of RAM).

Xbox One had a hardware H.264 Blu-ray compatible H.264 decoder, so shouldn't have been an issue. And even with software decoding, a single one of its six x64 cores would be able to do quite a lot of CABAC decode.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 8th August 2006, 10:32   #13  |  Link
codimahi
Registered User
 
Join Date: Mar 2006
Posts: 10
Quote:
Originally Posted by j7n
As far as I understand CABAC considerably increases CPU load during playback. I think that after recompressing into CAVLC my older computer would be able to decode my H.264 files in real-time. Has the situation changed after 7 months and a tool to convert between CABAC & CAVLC become available?
Conversion from CABAC to CAVLC includes CABAC decoding and CAVLC encoding in which both are very computational intensive. Let's say for a 1hr h.264 CABAC encoded movie, this recompression may take more than 3hrs(depend on resoulution). I don't think so any body would like to do this before seeing a very interesting movie.
codimahi is offline   Reply With Quote
Old 8th August 2006, 10:38   #14  |  Link
j7n
Registered User
 
j7n's Avatar
 
Join Date: Apr 2006
Posts: 101
However computation intesive or unoptimized that program might be it would really help if purchasing a faster computer (or re-encoding the video) is not an option.

The choice is real simple:
*- spend 3hrs and watch the movie
*- do not watch the movie at all

Last edited by j7n; 8th August 2006 at 10:41.
j7n is offline   Reply With Quote
Old 8th August 2006, 17:15   #15  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
Quote:
Originally Posted by codimahi
Conversion from CABAC to CAVLC includes CABAC decoding and CAVLC encoding in which both are very computational intensive. Let's say for a 1hr h.264 CABAC encoded movie, this recompression may take more than 3hrs(depend on resoulution). I don't think so any body would like to do this before seeing a very interesting movie.
No. CABAC is about 20-40% of the decoding time (depending on bitrate). CAVLC is less. If you can play the CAVLC version in realtime (otherwise you wouldn't be converting), then the CABAC version can't be more than 30% slower than realtime.
But the CABAC->CAVLC converter doesn't have to do any of the other steps of decoding, it just parses the bitstream and writes it out again. So at the high end (CABAC=40% of decoding, CAVLC version takes 100% CPU), I'd expect the converter to run no slower than 1.5x realtime.
akupenguin is offline   Reply With Quote
Old 17th September 2009, 14:19   #16  |  Link
Shevach
Video compressionist
 
Join Date: Jun 2009
Location: Israel
Posts: 126
Quote:
Originally Posted by akupenguin View Post
CABAC is about 20-40% of the decoding time .
In average CABAC performance is 20-40% higher than CAVLC one. But CABAC encoding/decoding can have severe performance peaks (unlike CAVLC where peaks are significantly smaller).
The reason is that CABAC is very hard for optimization due to back-dependency between bins. Choice of context models for some bins depends on the values of previous bins (e.g. the bins of mb_type). So, CABAC can not easely pipelined.

Some encoders deliberately switch to CAVLC mode when performance peak in CABAC encoding/decoding expected.
Thus a smart CABAC->CAVLC converter should switch to CAVLC only if video content might cause performance peak.
Shevach is offline   Reply With Quote
Old 17th September 2009, 15:32   #17  |  Link
akupenguin
x264 developer
 
akupenguin's Avatar
 
Join Date: Sep 2004
Posts: 2,392
Quote:
Originally Posted by Shevach View Post
In average CABAC performance is 20-40% higher than CAVLC one. But CABAC encoding/decoding can have severe performance peaks
Not the point. That post was in response to someone asking how much total time it would take to re-entropy-code a video, for which peaks don't matter.
akupenguin is offline   Reply With Quote
Old 8th August 2006, 17:37   #18  |  Link
Inventive Software
Turkey Machine
 
Join Date: Jan 2005
Location: Lowestoft, UK (but visit lots of places with bribes [beer])
Posts: 1,953
Potentially stupid question, but I'll ask anyway.

Does the CABAC/CAVLC take place in each frame after the ME and bitstream has been written? Or is it done before the bitstream is written? Or is it done completely different?

EDIT: Does CAVLC happen anyway even if CABAC is enabled?
__________________
On Discworld it is clearly recognized that million-to-one chances happen 9 times out of 10. If the hero did not overcome huge odds, what would be the point? Terry Pratchett - The Science Of Discworld
Inventive Software is offline   Reply With Quote
Old 9th August 2006, 04:20   #19  |  Link
sysKin
Registered User
 
sysKin's Avatar
 
Join Date: Jun 2002
Location: Adelaide, Australia
Posts: 1,167
Quote:
Originally Posted by Inventive Software
Does the CABAC/CAVLC take place in each frame after the ME and bitstream has been written? Or is it done before the bitstream is written?
CABAC/CAVLC is THE two ways of writing a bitstream

Quote:
Does CAVLC happen anyway even if CABAC is enabled?
No, it's one or the other.
__________________
Visit #xvid or #x264 at irc.freenode.net
sysKin is offline   Reply With Quote
Old 16th September 2009, 18:48   #20  |  Link
pokazene_maslo
Registered User
 
Join Date: Apr 2009
Location: Martin, Slovakia
Posts: 79
I second this request. It would be a useful tool for users with slower machines.
pokazene_maslo is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:16.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.