A story of bug and WTF.



  • Company: "Hey, $developer, your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!  We use interlaced encoding for our live broadcasts, so though your adaptive quantization patch looks astounding, we can't use it until you fix this."

    Me: "Wait, what? I didn't even touch that part of the codebase. My code is totally unrelated to that. WTF?  This doesn't make any sense, is there some strange memory overflow that only activates on interlaced encoding or something?"

    30 minutes of trying various options ensues

    Interesting, so it only occurs with CABAC compression.  This makes things a bitch to debug, because if you make a single encoding mistake on CABAC, it affects all future blocks decoded, corrupting the entire stream.

    30 minutes of CABAC debugging and comparing output to that of the reference decoder

    So it breaks after just a few blocks in the stream... but I have no idea where the corruption actually occurred.

    an
    hour of frantic CABAC debugging, yielding nothing other than that the
    stream corruption is in the mb_qp_delta variable in the second
    macroblock


    Another developer looks over the function I'd narrowed it down to.

    "Wait
    a minute. Its supposed to choose context 0 if its the first macroblock.
    But its choosing context 0 if it has no neighbor--which in interlaced,
    is for the first two blocks, not the first. Oops."

    And so after
    hours of debugging and generally stupid shit, I find that the encoder
    was actually broken to begin with, and its just that it never generated
    the situation that broke it before: when the quantizer differs between the first two blocks of an interlaced frame. And I fixed it with a single change
    to a single line of code.



  • Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!
    for the Technobabble Sentence of the Week.



  • @PSWorx said:

    Unrelated to the WTF, I vote
    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!
    for the Technobabble Sentence of the Week.
    I can do much better than that:

    "Logarithmically-scaled variance-based complexity-masking adaptive quantization with Hadamard-weighted automatic sensitivity."

    or

    "Hadamard-thresholded rate-distortion optimized inter-macroblock partition decision" 

    or

    "Rate-distortion optimized quantizer lookahead with adaptive range and scenecut detection."

    Dontcha just love video compression?  (Though I agree with the poster below; its not actually technobabble, since it means something.)



  • @PSWorx said:

    Unrelated to the WTF, I vote
    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!
    for the Technobabble Sentence of the Week.
    "Technobabble" does not mean "them fancy words I don't understand".


  • Winner of the 2016 Presidential Election

    @Dark Shikari said:

    "Hadamard-thresholded rate-distortion optimized inter-macroblock partition decision" 

    Achievement Unlocked: Make the correct party submission position decision.



  • @Dark Shikari said:

    (Though I agree with the poster below; its not actually technobabble, since it means something.)

     

    You agree with the poster below?! I just got a shiver in me timbers...



  •  @R.Flowers said:

    @Dark Shikari said:

    (Though I agree with the poster below; its not actually technobabble, since it means something.)

     

    You agree with the poster below?! I just got a shiver in me timbers...

    Gah! Time traveler!



  • Well, you are not the only one to find a bug in a supposedly "working" piece of code that you have been using for a long time.



  • @henke37 said:

    Well, you are not the only one to find a bug in a supposedly "working" piece of code that you have been using for a long time.

    That's nothing. On several occasions I have found bugs in large, widely used pieces of software (including glibc and perl) which clearly meant that it could not possiby  have ever worked, yet it had been working for years.

    My working theory is gremlins. 



  •  @PSWorx said:

    Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!

    for the Technobabble Sentence of the Week.

    Yeah, it does have the right kind of ring to it... It goes well with Dark Shikari's followup babble, too:

    Last week on a Starfleet ship
    Engineer: Captain! The Cardassians are jamming our transmissions to starbase 734!
    Captain: Try interlaced encoding! They'll never suspect the first two macroblocks having zero context.
    Engineer: But our adaptive quantization algorithms will result in a corrupt stream when interlaced encoding is activated!
    Captain: Not if we use logarithmically-scaled variance-based complexity-masking adaptive quantization with Hadamard-weighted automatic sensitivity!
    Engineer: That is madness! Using varianced-based complexity masking could cause a cascading failure in the scenecut detection matrix!
    Captain: ...Remember when our techno-drama was still about things that go "boom" if we screw up?
    Engineer: Well, if we screw up really hard we might damage a speaker on the starbase.
    Captain: Do it so.



  • @Dark Shikari said:

    Company: "Hey, $developer, your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!  We use interlaced encoding for our live broadcasts, so though your adaptive quantization patch looks astounding, we can't use it until you fix this."

    You really need to get out more.  Seriously.



  • @j6cubic said:

     @PSWorx said:

    Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!

    for the Technobabble Sentence of the Week.

    Yeah, it does have the right kind of ring to it... It goes well with Dark Shikari's followup babble, too:

    Last week on a Starfleet ship
    Engineer: Captain! The Cardassians are jamming our transmissions to starbase 734!
    Captain: Try interlaced encoding! They'll never suspect the first two macroblocks having zero context.
    Engineer: But our adaptive quantization algorithms will result in a corrupt stream when interlaced encoding is activated!
    Captain: Not if we use logarithmically-scaled variance-based complexity-masking adaptive quantization with Hadamard-weighted automatic sensitivity!
    Engineer: That is madness! Using varianced-based complexity masking could cause a cascading failure in the scenecut detection matrix!
    Captain: ...Remember when our techno-drama was still about things that go "boom" if we screw up?
    Engineer: Well, if we screw up really hard we might damage a speaker on the starbase.
    Captain: Do it so.

     

     That's "make it so."  And Picard would rarely debate a technical problem with his crew; he would let them duke it out, then choose the best solution.  He definitely wouldn't let Geordi call his solution "madness!"



  • @asuffield said:

    My working theory is gremlins. 

    Same here. I tell everyone that it's either gremlins or a ghost in the machine. Which one I choose is random.



  •  @AbbydonKrafts said:

    @asuffield said:

    My working theory is gremlins. 

    Same here. I tell everyone that it's either gremlins or a ghost in the machine. Which one I choose is random.

    I am sure you use SSDS for your random search.



  • @asuffield said:

    @henke37 said:

    Well, you are not the only one to find a bug in a supposedly "working" piece of code that you have been using for a long time.

    That's nothing. On several occasions I have found bugs in large, widely used pieces of software (including glibc and perl) which clearly meant that it could not possiby  have ever worked, yet it had been working for years.


    Is that all? About a year ago, I encountered some production code that not only could not have worked, but could not have been compiled in the first place.



  • @Carnildo said:

    @asuffield said:

    @henke37 said:

    Well, you are not the only one to find a bug in a supposedly "working" piece of code that you have been using for a long time.

    That's nothing. On several occasions I have found bugs in large, widely used pieces of software (including glibc and perl) which clearly meant that it could not possiby  have ever worked, yet it had been working for years.


    Is that all? About a year ago, I encountered some production code that not only could not have worked, but could not have been compiled in the first place.
     

    Is that all? I found some production code that stabbed my coworker in the face.



  • @MasterPlanSoftware said:

    Is that all? I found some production code that stabbed my coworker in the face.

    Heh.  coworker arrives to work looking like he lost a fight with a MAC truck  Did you have to test that script 40 times last night? 



  • @Carnildo said:

    Is that all? About a year ago, I encountered some production code that not only could not have worked, but could not have been compiled in the first place.

    I did once find a bug in a Debian package that meant it could not ever have successfully built, which had been present for several years (think it was perl - whatever it was, the maintainer agreed with me that it could never have worked, and had no idea why it used to).



  • @operagost said:

    @j6cubic said:

     @PSWorx said:

    Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!

    for the Technobabble Sentence of the Week.

    Yeah, it does have the right kind of ring to it... It goes well with Dark Shikari's followup babble, too:

    Last week on a Starfleet ship
    Engineer: Captain! The Cardassians are jamming our transmissions to starbase 734!
    Captain: Try interlaced encoding! They'll never suspect the first two macroblocks having zero context.
    Engineer: But our adaptive quantization algorithms will result in a corrupt stream when interlaced encoding is activated!
    Captain: Not if we use logarithmically-scaled variance-based complexity-masking adaptive quantization with Hadamard-weighted automatic sensitivity!
    Engineer: That is madness! Using varianced-based complexity masking could cause a cascading failure in the scenecut detection matrix!
    Captain: ...Remember when our techno-drama was still about things that go "boom" if we screw up?
    Engineer: Well, if we screw up really hard we might damage a speaker on the starbase.
    Captain: Do it so.

     

     That's "make it so."  And Picard would rarely debate a technical problem with his crew; he would let them duke it out, then choose the best solution.  He definitely wouldn't let Geordi call his solution "madness!"

     

     It's a combination between Janeway and Picard.



  •  @asuffield said:

    @henke37 said:

    Well, you are not the only one to find a bug in a supposedly "working" piece of code that you have been using for a long time.

    That's nothing. On several occasions I have found bugs in large, widely used pieces of software (including glibc and perl) which clearly meant that it could not possiby  have ever worked, yet it had been working for years.

    My working theory is gremlins. 

    And usually, you find them while looking for something else.

    And, starting the day you find about it, it starts breaking up.

    That's what we call a Heisenbug at work.



  • @Denis Troller said:

    That's what we call a Heisenbug at work.

    No, a Heisenbug is a bug that only exists when you aren't debugging it. It specifically refers to bugs that vanish when you try to look for them (usually because of some variation in timing due to running under the debugger, or something like that - most of them are race conditions). 



  • @j6cubic said:

    Last week on a Starfleet ship

    Engineer: Captain! The Cardassians are jamming our transmissions to starbase 734!
    Captain: Try interlaced encoding! They'll never suspect the first two macroblocks having zero context.
    Engineer: But our adaptive quantization algorithms will result in a corrupt stream when interlaced encoding is activated!
    Captain: Not if we use logarithmically-scaled variance-based complexity-masking adaptive quantization with Hadamard-weighted automatic sensitivity!
    Engineer: That is madness! Using varianced-based complexity masking could cause a cascading failure in the scenecut detection matrix!
    Captain: ...Remember when our techno-drama was still about things that go "boom" if we screw up?
    Engineer: Well, if we screw up really hard we might damage a speaker on the starbase.
    Captain: Do it so.

     

    That. made. my. day! Could have been also a conversation between Carter and O'Neil in SG-1...

     



  •  We don't talk about Janeway here.

     



  • @PSWorx said:

    Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!

    for the Technobabble Sentence of the Week.

     

    Indeed, it sounds that way.

    He is talking about encoding video.

    Of course, like many videophiles, I wish interlacing would just get on with it and die.

     



  • Technically it's not technobabble, since it does mean something...

    (It had to be said...)



  • @PSWorx said:

    Unrelated to the WTF, I vote

    Your new adaptive quantization patch results in a corrupt stream when interlaced encoding is activated!

    for the Technobabble Sentence of the Week.

     

     I second that.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.