[FFmpeg-devel] [PATCH 1/2] spdifenc: IEC 61937 encapsulation of DTS-HD for HDMI
Jean-Daniel Dupas
devlists
Thu Jan 27 20:19:05 CET 2011
Le 27 janv. 2011 ? 20:06, M?ns Rullg?rd a ?crit :
> Anssi Hannula <anssi.hannula at iki.fi> writes:
>
>> On 27.01.2011 19:50, Justin Ruggles wrote:
>>> Hi,
>>
>> Hi!
>>
>>> On 01/21/2011 01:32 PM, Anssi Hannula wrote:
>>>
>>>> ---
>>>>
>>>> This time the default mode of operation is to passthrough DTS-core only
>>>> unless the HD mode is explicitely requested by the user via an AVOption.
>>>>
>>>> This way we avoid exporting the final bitrate in avctx->bit_rate as I
>>>> previously planned, as now the caller always specifies the output rate
>>>> themselves and therefore already knows the output rate (as is the case
>>>> for other formats as well).
>>>>
>>>> An AVOption is used instead of the previously planned muxrate as the
>>>> usage doesn't exactly match muxrate semantics.
>>>>
>>>> Changelog | 2 +-
>>>> libavformat/avformat.h | 2 +-
>>>> libavformat/spdifenc.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++
>>>> 3 files changed, 149 insertions(+), 2 deletions(-)
>>>>
>>>> +static int spdif_header_dts4(AVFormatContext *s, AVPacket *pkt, int core_size,
>>>> + int sample_rate, int blocks)
>>>> +{
>>>> + IEC61937Context *ctx = s->priv_data;
>>>> + const char dtshd_start_code[10] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe };
>>>
>>>
>>> dtshd_start_code could be made static.
>>
>> Hm, what difference would it make?
>>
>> Since it is a constant, the values are retained over calls by definition
>> even without "static" keyword, and indeed there seems to be no
>> difference between "const" or "static const" inside a function in output
>> of gcc.
>
> It does make a difference:
>
> ---8<---
> int baz(const char *);
>
> int foo(void)
> {
> const char x[] = { 1, 2, 3, 4 };
> return baz(x);
> }
>
> int bar(void)
> {
> static const char x[] = { 1, 2, 3, 4 };
> return baz(x);
> }
> --->8---
>
I don't know where this assembly come from, but using gcc -O2, I'm getting the very same output for both functions for i386, x86_64, ppc and arm.
> Disassembly of section .text:
>
> 00000000 <foo>:
> 0: e52de004 push {lr} ; (str lr, [sp, #-4]!)
> 4: e59f301c ldr r3, [pc, #28] ; 28 <foo+0x28>
> 8: e24dd00c sub sp, sp, #12
> c: e5933000 ldr r3, [r3]
> 10: e28d0008 add r0, sp, #8
> 14: e5203004 str r3, [r0, #-4]!
> 18: ebfffffe bl 0 <baz>
> 1c: e28dd00c add sp, sp, #12
> 20: e49de004 pop {lr} ; (ldr lr, [sp], #4)
> 24: e12fff1e bx lr
> 28: 00000000 .word 0x00000000
>
> 0000002c <bar>:
> 2c: e92d4008 push {r3, lr}
> 30: e59f0008 ldr r0, [pc, #8] ; 40 <bar+0x14>
> 34: ebfffffe bl 0 <baz>
> 38: e8bd4008 pop {r3, lr}
> 3c: e12fff1e bx lr
> 40: 00000004 .word 0x00000004
-- Jean-Daniel
More information about the ffmpeg-devel
mailing list