[FFmpeg-devel] [PATCH] change frame_aspect_ratio to AVRational

Michael Niedermayer michaelni
Thu Jun 11 22:14:06 CEST 2009


On Thu, Jun 11, 2009 at 11:36:31AM -0700, Baptiste Coudurier wrote:
> On 6/11/2009 4:27 AM, Michael Niedermayer wrote:
> > On Wed, Jun 10, 2009 at 09:23:40PM -0700, Baptiste Coudurier wrote:
> >> Hi
> >>
> >> $subject, mainly to avoid using double which behaves not correctly
> >> when using 16:9 commandline.
> > [...]
> >> @@ -3012,7 +3012,8 @@
> >>          st->stream_copy = 1;
> >>          video_enc->codec_type = CODEC_TYPE_VIDEO;
> >>          video_enc->sample_aspect_ratio =
> >> -        st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
> >> +        st->sample_aspect_ratio =
> >> +            av_mul_q(frame_aspect_ratio, (AVRational){ frame_height, frame_width });
> >>      } else {
> >>          const char *p;
> >>          int i;
> >> @@ -3039,7 +3040,8 @@
> >>  
> >>          video_enc->width = frame_width + frame_padright + frame_padleft;
> >>          video_enc->height = frame_height + frame_padtop + frame_padbottom;
> >> -        video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
> >> +        video_enc->sample_aspect_ratio =
> >> +            av_mul_q(frame_aspect_ratio, (AVRational){ frame_height, frame_width });
> >>          video_enc->pix_fmt = frame_pix_fmt;
> >>          st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
> >>  
> > 
> > previously these where limited to 255/255 now they arent anymore, i think
> > some codecs dont support arbitrary fractions
> 
> Ok, quick survey:
> theora encoder supports rational.
> h264 supports rational on 16bits.
> libxvid indeed checks for 255/255.
> mpeg12 converts back to float and match supported ones.
> mjpeg is rational on 16bits.
> h263/mpeg4 sar is rational on 8bits.
> 
> Ok to add av_reduce to codecs needing it ?

encoders should not second guess the user
i mean if they accept a 300/301 then they should either store that or
if they cannot then fail

it seems to me the current code is fine, is your patch fixing something
besides changing float to AVRational ?
if not we maybe could just keep it as it is

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- 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/20090611/3f5d22f0/attachment.pgp>



More information about the ffmpeg-devel mailing list