[FFmpeg-devel] [PATCH] LPCM in MPEG-TS, next iteration

Michael Niedermayer michaelni
Tue Aug 25 16:21:23 CEST 2009


On Tue, Aug 25, 2009 at 02:56:19PM +0300, Christian P. Schmidt wrote:
> Michael Niedermayer wrote:
> 
> >> +static int pcm_bluray_decode_frame(AVCodecContext *avctx,
> >> +                                   void *data,
> >> +                                   int *data_size,
> >> +                                   AVPacket *avpkt)
> >> +{
> >> +    const uint8_t *src = avpkt->data;
> >> +    int buf_size = avpkt->size;
> >> +    int num_source_channels, channel, retval;
> >> +    int sample_size, samples;
> > 
> >> +#if HAVE_BIGENDIAN
> >> +    int used_sample_size;
> >> +#endif
> > 
> > redundant #if
> 
> It would give an "unused variable" warning together with below's code:

av_unused


[...]
> 
> The final option (d) would be to remove used_sample_size completely and
> just use
>                 do {
> #if HAVE_BIGENDIAN
>                     memcpy(dst16, src, avctx->channels * 2);
>                     dst16 += avctx->channels;
>                     src += sample_size;
> #else
>                     channel = avctx->channels;
>                     do {
>                         *dst16++ = bytestream_get_be16(&src);
>                     } while (--channel);
>                     src += 2;
> #endif
>                 } while (--samples);
> 
> and hope the compiler caches the calculated value inside the memcpy(). I
> personally think any change of the original code would rely on the
> compiler doing the right thing, or look even worse.
> 
> Which of the options would be preferred? I'll post a complete updated
> patch once this part is decided.

i prefer d, as a startpoint of further review :)

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090825/890dcaea/attachment.pgp>



More information about the ffmpeg-devel mailing list