[FFmpeg-devel] [PATCH 2/2] pcxenc: store sample aspect ratio

Michael Niedermayer michaelni at gmx.at
Fri Oct 12 16:51:01 CEST 2012


On Fri, Oct 12, 2012 at 07:04:12AM +0000, Paul B Mahol wrote:
> On 10/11/12, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Thu, Oct 11, 2012 at 10:59:19AM +0000, Paul B Mahol wrote:
> >> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> >> ---
> >>  libavcodec/pcxenc.c | 11 ++++++++---
> >>  1 file changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/libavcodec/pcxenc.c b/libavcodec/pcxenc.c
> >> index 0f8a140..7f710a2 100644
> >> --- a/libavcodec/pcxenc.c
> >> +++ b/libavcodec/pcxenc.c
> >> @@ -105,7 +105,7 @@ static int pcx_encode_frame(AVCodecContext *avctx,
> >> AVPacket *pkt,
> >>      const uint8_t *buf_end;
> >>      uint8_t *buf;
> >>
> >> -    int bpp, nplanes, i, y, line_bytes, written, ret, max_pkt_size;
> >> +    int bpp, nplanes, i, y, line_bytes, written, ret, max_pkt_size, sw,
> >> sh;
> >>      const uint32_t *pal = NULL;
> >>      uint32_t palette256[256];
> >>      const uint8_t *src;
> >> @@ -158,6 +158,11 @@ static int pcx_encode_frame(AVCodecContext *avctx,
> >> AVPacket *pkt,
> >>      buf     = pkt->data;
> >>      buf_end = pkt->data + pkt->size;
> >>
> >> +    sw = avctx->sample_aspect_ratio.num;
> >> +    sh = avctx->sample_aspect_ratio.den;
> >> +    if (sw > 0xFFFFu || sh > 0xFFFFu)
> >> +        av_reduce(&sw, &sh, sw, sh, 0xFFFFu);
> >
> > the if() should be unneeded
> 
> You mean just if() or if() and code bellow it?
> 
> if() is there to preserve original ratio which can be 300/300
> instead of reducing it to 1/1.

well if you consider these distinct and pcx allows this then ive
no objections

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121012/c8b7d53a/attachment.asc>


More information about the ffmpeg-devel mailing list