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 > General > Newbies
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th August 2014, 14:00   #1  |  Link
errantkkn
Registered User
 
Join Date: Oct 2012
Posts: 14
Question about lossy and lossless

Hi all, I have some troubles of understanding lossy and lossless video.

For ex:
I encode raw source A1 to B1 through lossy method.
Then when decoding B1 I have raw A2.

So B1 is lossy of A1 and B1 is lossless of A2, is it right?

If yes, then I encode A2 to B2 through lossless method, but It'll never touch the size of B1. I can not understand this.

Please help me, thank you guys
errantkkn is offline   Reply With Quote
Old 20th August 2014, 14:13   #2  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,844
no it's not right

if you encode raw A1 to lossy B1, you'll get a compressed video (lossy). Decoding of B1 does not imply that you get true raw video (without modifications compared to raw A1) since B1 is compressed and the decoder decodes the compressed video. You cannot go from compressed video to raw video which is exactly the same as the original raw input.

Note that raw video can mean two things: either it's truly raw without any compression or it's a compressed raw video which is extracted from a container
__________________
ffx264 || ffhevc || ffxvid || microenc

Last edited by microchip8; 20th August 2014 at 14:22.
microchip8 is offline   Reply With Quote
Old 20th August 2014, 15:14   #3  |  Link
errantkkn
Registered User
 
Join Date: Oct 2012
Posts: 14
Thank froggy1.
I know that A2 will be different from A1. I just mean decoding B1 we'll have something call A2.

So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?

Thank you.
errantkkn is offline   Reply With Quote
Old 20th August 2014, 15:26   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by errantkkn View Post


So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?

Thank you.

A2 is uncompressed video decoded from B1, not the same thing as "raw" by any definition . A2 has same image quality as B1. But B1 has already incurred generation loss and is not equivalent to A1

Note in the video world "raw" has a very different meaning than in "anime" world.

Decoding lossy video (in theory) should result in same results with different decoders . But sometimes there are problems with decoders, shortcuts taken, errors in code
poisondeathray is offline   Reply With Quote
Old 20th August 2014, 15:26   #5  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by errantkkn View Post
Thank froggy1.
I know that A2 will be different from A1. I just mean decoding B1 we'll have something call A2.

So, as you said, A2 is not a raw? Is it still compressed?
I have one more question. Does decoding a lossy video with different decoders bring different results?

Thank you.
Put simply, encoding takes "raw" (uncompressed) video data as input and returns some kind of compressed bitstream; decoding takes the compressed bitstream as input and returns "raw" (uncompressed) video data again.

It is possible to convert directly from one compressed format to another compressed format, but "internally" the data will still be decompressed (from the old format) and then compressed again (to the new format).

Now, the compression may be lossy or lossless. With a lossless compression, the "raw" data you get back from the decoder is bit-identical to the "raw" data you once fed into the encoder. With lossy compression that is not the case!

(Be aware though that different pixel formats for "raw" video data exist, such as YCrCb vs. RGB, different sub-sampling or different number of bits per channel. So even lossless compression may include a pixel format conversion!)


Quote:
Originally Posted by errantkkn View Post
Does decoding a lossy video with different decoders bring different results?
In a perfect world, all existing decoders (for a certain compressed format) would produce bit-identical output for the identical compressed input bitstream.

In reality, tough, decoders may contain bugs or not be 100% spec compliant. So you cannot rely on that (although it generally should be the case).
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 20th August 2014 at 15:41.
LoRd_MuldeR is offline   Reply With Quote
Old 20th August 2014, 16:20   #6  |  Link
errantkkn
Registered User
 
Join Date: Oct 2012
Posts: 14
Very interesting, thank you all.

So in conclusion:
Quote:
A -->encoding--> B -->decoding--> A :lossless
A -->encoding--> B -->decoding--> C :lossy
But I'm thinking of this:
Quote:
A1 -->lossy_encoding--> lossy_B1
lossy_B1 -->decoding--> A2 (different from A1)
A2 -->lossless_encoding--> lossless_B2

Decoding both lossy_B1 & lossless_B2 will bring the same A2
But in reality, lossy_B1 < lossless_B2.
So if we want to save A2 on HDD, lossy_B1 is better.

In similar, for the raw A1, maybe there's a lossy_B0 that when decoding it, we'll have exactly A1. And this will be the perfect compress method (lossy_B0 < lossless_B0)
Is it right? Forgive me if this is a noob thinking.
errantkkn is offline   Reply With Quote
Old 20th August 2014, 16:29   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Yes that's right

"lossless" always refers to comparing to the uncompressed video state. A compressed video has to be decompressed (decoded) to uncompressed before it's recompressed.

So lossless compression will always yield larger filesize , when the source is already lossy compressed.
poisondeathray is offline   Reply With Quote
Old 28th August 2014, 09:52   #8  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
Speaking of lossless, how lossless is encoding with "-QP 0" really?

I have a project that requires several passes, with lossless intermediate steps. Will "-QP 0" do it?

Thanks.
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 28th August 2014, 09:54   #9  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
n/a /5
__________________
Gorgeous, delicious, deculture!
asarian is offline   Reply With Quote
Old 28th August 2014, 11:47   #10  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
qp 0 is mathematically lossless, identical to totally lossless
feisty2 is offline   Reply With Quote
Reply


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 21:02.


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