digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   CQ vs. CQ_VBR ... VERY INTERESTING... (http://www.digitalfaq.com/archives/avisynth/1910-cq-vs-cqvbr.html)

SansGrip 12-27-2002 09:09 PM

Quote:

Originally Posted by rendalunit
I learned something else new: the samples look better when I view them with WinDVD rather than Zoom player (I don't know why that is :?: )

Likely something to do with the decompression algorithm used. WinDVD's might be more "correct" than Zoom's (or vice versa ;)). Either that or WinDVD applies some postprocessing to reduce artifacts.

kwag 12-27-2002 09:14 PM

Quote:

Originally Posted by SansGrip
Either that or WinDVD applies some postprocessing to reduce artifacts.

:idea: A post processing filter. Call it "MpegSynth" filter. AviSynth -->> TMPEG -->> PostFilter( Sort of a system pipe, FIFO, etc. ) -->> Actual MPEG file :idea: :wink:

-kwag

SansGrip 12-27-2002 09:19 PM

Quote:

Originally Posted by kwag
:idea: A post processing filter. Call it "MpegSynth" filter. AviSynth -->> TMPEG -->> PostFilter( Sort of a system pipe, FIFO, etc. ) -->> Actual MPEG file :idea: :wink:

I don't think that would be any simpler than writing our own encoder ;).

kwag 12-27-2002 09:23 PM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by kwag
:idea: A post processing filter. Call it "MpegSynth" filter. AviSynth -->> TMPEG -->> PostFilter( Sort of a system pipe, FIFO, etc. ) -->> Actual MPEG file :idea: :wink:

I don't think that would be any simpler than writing our own encoder ;).

:mrgreen: :mrgreen: :mrgreen:

SansGrip 12-27-2002 10:21 PM

Ok, here's what I've been working on for the last five hours and the results are surprising. First, the relevent information:

x3 template
528x480
11.4mb clips

Code:

Mpeg2Source("ap.d2v")
Sampler()
Crop(13, 9, 696, 460)
LegalClip()
BilinearResize(528, 352)
FluxSmooth(temporal_threshold=6, spatial_threshold=2)
Blockbuster(method="noise", variance=x, seed=1)
AddBorders(0, 64, 0, 64)
LegalClip()

Here's the framegrab:

http://www.digitalfaq.com/archives/error.gif

First you'll notice six clips in the grab, labelled appropriately. On the top row are three encodes made with CQ_VBR, and on the bottom three made with CQ. The leftmost encodes were made with a Blockbuster variance of zero (i.e. no noise), the centre with one, and the rightmost with two.

While you can see a clear reduction in the number of visible DCT blocks as more noise is added to the CQ_VBR versions (with a corresponding reduction in CQ_VBR level), there is very little difference in the CQ versions (and very little difference in the CQ level). The CQ encode with noise variance of two shows as many blocks, almost as clearly defined, as both the CQ_VBR and CQ encodes with no noise added.

Based on these results, along with my encodes with Resident Evil before my "Christmas break" :), I conclude that Blockbuster is ineffective when using CQ mode, and that in general CQ mode with or without Blockuster is significantly blockier than CQ_VBR with Blockbuster.

One possible reason for this behaviour is the current Q matrix, which might be very suitable for CQ_VBR mode but too strong for CQ mode in the low-frequency components.

An additional observation I made is that at least with this source material adding noise (and reducing the CQ_VBR level) had very little or no noticible effect on the amount of Gibbs in the clip.

kwag 12-27-2002 11:33 PM

First of all "DANGER WILL ROBINSON". Here's a little teaser. I've been doing some analysis on the low frequency domain of the Q. Matrix. Here's my first attempt, with a different approach from any existing matrix. I've tried to tune a specific area, the lowest lit areas on MPEG files. This is mostly close to black (dark gray) areas and/or low frequency components, where you have your "Belly dancer" DCT blocks. What I'm doing is notching out this frequency domain with very low quantization values. So frequencies below and above this point will be transformed with the standard KVCD quantisizer values. The standard KVCD Q. Matrix has these values in the upper left corner, which represent the low frequency components.
Code:

8  16 19 22
16 19 22 26
19 22 26 27
22 26 27 31

And I am currently testing:
Code:

8  12 8  22
12 6  12 26
8  12 14 27
22 26 27 31

And here's the result "blown up" to enhance details and crap :D :

http://www.digitalfaq.com/archives/i.../2002/12/1.png

See how many things you can find in the top picture that are smoothed on the bottom :wink:
There's still a long way to go before this is fully optimized, but I can see the light at the end of the tunnel :wink:
This was encoded at 352x240 using this script:

LoadPlugin("C:\encoding\MPEG2DEC.dll")
LoadPlugin("C:\encoding\sampler.dll")
LoadPlugin("C:\encoding\fluxsmooth.dll")
LoadPlugin("C:\encoding\blockbuster.dll")
LoadPlugin("C:\encoding\legalclip.dll")
mpeg2source("K:\KPAX\VIDEO_TS\movie.d2v")
LegalClip()
BilinearResize(672,336,0,0,720,480)
FluxSmooth()
Blockbuster( method="noise", variance=.4, seed=1 )
AddBorders(16,72,16,72)
LegalClip()

-kwag

SansGrip 12-28-2002 12:01 AM

Quote:

Originally Posted by kwag
Look carefully at her hand, arm, and neck.

I can't really see any difference in those areas :?. However, I do notice a significant reduction in the number of "striped" DCT blocks with your experimental matrix. Can you post another grab, preferably one that's very static? I wouldn't want to get my macroblocks and DCT blocks mixed up :).

kwag 12-28-2002 12:08 AM

Quote:

Originally Posted by SansGrip
Quote:

Originally Posted by kwag
Look carefully at her hand, arm, and neck.

I can't really see any difference in those areas :?. However, I do notice a significant reduction in the number of "striped" DCT blocks with your experimental matrix. Can you post another grab, preferably one that's very static? I wouldn't want to get my macroblocks and DCT blocks mixed up :).

:lol: Ok.
The background is static, only she is moving on this scene.
I'm looking for another dark material to encode. Probably from a dark scene on "K-Pax". But take a look on the right side of the picture, there are some small vertical DCT blocks that are clear on top, and they don't show on the bottom. On top of the hole that looks like a handle to open a door. Sorry I didn't circle in red the areas, because the program I used ( Canvas 7 ), I don't know how to use :twisted: :oops:

-kwag

SansGrip 12-28-2002 12:19 AM

Quote:

Originally Posted by kwag
But take a look on the right side of the picture, there are some small vertical DCT blocks that are clear on top, and they don't show on the bottom.

Yep, those are the ones I was talking about. When I save each image as a separate file and switch quickly between them I can see a nice overall smoothing of the background, with most "jarring" artefacts gone. You're definitely on the right track :).

kwag 12-28-2002 12:33 AM

Quote:

Originally Posted by SansGrip
You're definitely on the right track :).

But this is painful 8O Encode, change, encode, change, encode, change, encode, encode ..... :roll:
Eventually we'll get it right :D ( I hope 8O )
I wish I knew EXACTLY what fequency range corresponds to each matrix block. Then it would be much simpler :roll: Maybe if I encode a "White Screen" with "White Noise" using your blockbuster set to a high value so that I saturate the complete frequency spectrum and then change the matrix to all 0's except lower left top to 99 and keep rolling that "99" to each position, I can create a frequency histogram :idea: . Then we'll have a pretty good idea of what frequency corresponds to each block of the matrix :idea:
Maybe I should do that right now :mrgreen:

-kwag

rendalunit 12-28-2002 12:55 AM

i hate to interrupt the brainstorming but....
CQ or CQ_VBR?

SansGrip, the screenshots you posted show that CQ-VBR mode with Blockbuster variance=2 (with the current GOP and q. matrix) is the way to go! :) To me the CQ-VBR 10.2 var 2 sample looks much better than the others.

@kwag, I blew up the images you posted with Photoshop and the only difference I can see is the left side of her (Trinity?) neck- is more smooth. I can't see the block on the right side- could you circle it?

thanks a lot,
ren

kwag 12-28-2002 01:02 AM

Quote:

Originally Posted by rendalunit
@kwag, I blew up the images you posted with Photoshop and the only difference I can see is the left side of her (Trinity?) neck- is more smooth. I can't see the block on the right side- could you circle it?

thanks a lot,
ren

When I learn to do a circle with this program, I will :D
Take a look at the hole to her left. Looks like a handle to open some cabinet. Right above the hole you see some artifacts that are not visible on the lower screenshot. This is still experimental, and I'm probably gettiing closer to the frequency domain of our target, but nowhere near yet. So you're just seeing only a very slight improvement of what I think can be accomplished once this is finaly tuned and tweaked :wink:

-kwag

kwag 12-28-2002 01:08 AM

I'm uploading the picture again at a higher resolution.

-kwag

Jellygoose 12-28-2002 05:12 AM

I see this is going the right way now... :wink:
If I can help in any way, just let me know! I'm on holiday right now, so lots of time for testing 8)

black prince 12-28-2002 07:55 AM

Hey Kwag,

Kwag wrote:
Quote:

When I learn to do a circle with this program, I will
If these screen shots are jpeg's or bmp's then use windows paint. :)
Choose ellipes with the box that's not shaded. Select red from the palet
on tool bar and hold down right mouse key and drag until the area you
want is selected. :)

-black prince

SansGrip 12-28-2002 10:54 AM

Quote:

Originally Posted by rendalunit
SansGrip, the screenshots you posted show that CQ-VBR mode with Blockbuster variance=2 (with the current GOP and q. matrix) is the way to go! :) To me the CQ-VBR 10.2 var 2 sample looks much better than the others.

Me too, but the same may not apply at 704x480. I'd need to run the same test at that resolution before I could be certain.

As for the noise, remember that the variance will change depending on the source material. For this source I would say that the var 2 sample might have a little too much noise -- I think I'd probably try 1.5 as well.

kwag 12-28-2002 10:57 AM

You see black prince,

I feel like an idiot :D
Where's that little IDIOT icon so I can paste it to myself :lol:
All the time I'm thinking on Photoshop or Canvas etc.
And it was so easy to just use Windows Paint :P
I'll do that right now :!:
( And I might also upload a little idiot icon, so I can use it on these special occasions :idea: :lol: )

-kwag

SansGrip 12-28-2002 11:04 AM

Quote:

Originally Posted by kwag
I wish I knew EXACTLY what fequency range corresponds to each matrix block.

I'm sure a search on "DCT quantization matrix" would turn up the info you require. It might make your head ache though ;).

Quote:

Maybe if I encode a "White Screen" with "White Noise" using your blockbuster
Don't use Blockbuster for applications that require real random noise. Use my Noise Generators package. They're much slower but much more "random".

Quote:

set to a high value so that I saturate the complete frequency spectrum
Not sure that noise would produce this. What you need is one of those test patterns that you get on TV calibration discs, where you have many vertical lines of differing widths and separated by differing amounts.

black prince 12-28-2002 11:15 AM

Hi All,

ALERT!! ALERT!!. 8O Be careful about using overburn with CQ encodes.
I just encoded a video for 2 CD's and used bbMPEG to multiplex. I set
the cut point at 794MB which produce an mpeg of 805MB and another
mpeg of 715MB. I set VCDEasy to overburn. The first disc (805MB)
played fine until it reached the overburn area and then the picture
broke-up and the movie just stopped playing. The second played fine
without any problems. The picture was perfect in both (same as DVD) but,
appears darker than DVD. I didn't use Blockbuster noise. Still
having trouble with file prediction for CQ >= 80. Tmpgenc seems to
increase file size dramatically for CQ above 80. For now I'm using a
range of 50 to 78 for CQ for 2 CD's and it still looks perfect :D

-black prince

kwag 12-28-2002 11:42 AM

Ok, go back to the previous page and look again. That's a darker sample, so you can see the results better. It's still only a very slight improvement, but it's there, and it can be optimized.

-kwag


All times are GMT -5. The time now is 04:20 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.