[Ffmpeg-devel] libavcodec h264 decoder

Stefan Gehrer stefan.gehrer
Fri Dec 15 09:50:05 CET 2006


michael benzon chua wrote:
> On 12/14/06, Stefan Gehrer <stefan.gehrer at gmx.de> wrote:
>>
>> michael benzon chua wrote:
>> > apologies if this post isn't in any particular format, i couldn't find
>> > anything on the mailing list page about following a specific protocol.
>> >
>> > can someone point me to where libavcodec decodes h.264 macroblocks? im
>> > trying to access the dct coefficients of i type 4x4 luma blocks.
>>
>> In h264.c, functions decode_mb_cavlc and decode_mb_cabac.
>
>
> Is this the case even if I turned off cabac? I usually generate my .264
> bitstreams with the no-cabac option turned on for the x264.
decode_mb_cabac if cabac is on, decode_mb_cavlc otherwise.
>
>
>> >
>> > essentially, i modified the x264 encoder to flip the sign of the
>> top-left
>> > most coefficient in the dct block during macroblock encoding, and i
>> > want to
>> > try and reverse the process during decoding. i just added this line of
>> > code
>> > in x264's encoder/macroblock.c, under the x264_mb_encode_i4x4 
>> function:
>> >
>> > dct4x4[0][0] = 0 - dct4x4[0][0];
>> >
>> > right after quantization and scanning, but before dequantization...
>> >
>> What are you trying to achieve with that?
>
>
> My end goal is to encrypt the upper triangle of the dct block during
> encoding, and decrypt it during decoding using any cryptosystem. I'm 
> taking
> small steps. The first thing I'm trying to do is simply to modify 1 dct
> block value during encoding, and to reverse what I did during 
> decoding. In
> the case above, I flipped the sign of the dct coefficient during 
> encoding.
> This has a visible effect on the video (it looks blotchier). I want to be
> able to change the sign back during the decoding process, so that the 
> video
> looks as it would have if I'd never modified the dct coefficient at all.
Interesting concept, but as soon as you use some real cryptography instead
of just toggling the sign I think the bitstream size will increase as some
seemingly random coefficients will be harder to compress than what the
encoder outputs. Or am I missing something?

Stefan




More information about the ffmpeg-devel mailing list