On Tue, Nov 08, 2011 at 01:21:28PM -0500, Justin Ruggles wrote:
> On 11/08/2011 01:01 PM, Kostya Shishkov wrote:
>
> > On Tue, Nov 08, 2011 at 12:33:56PM -0500, Justin Ruggles wrote:
> >> On 11/07/2011 03:06 PM, Kostya Shishkov wrote:
> >>
> >>> On Mon, Nov 07, 2011 at 02:41:02PM -0500, Justin Ruggles wrote:
> >>>> the user is not required to set bit_rate
> >>>> ---
> >>>> libavcodec/sipr.c | 13 +++++++++----
> >>>> 1 files changed, 9 insertions(+), 4 deletions(-)
> >>>>
> >>>> diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c
> >>>> index 70227c3..4257496 100644
> >>>> --- a/libavcodec/sipr.c
> >>>> +++ b/libavcodec/sipr.c
> >>>> @@ -480,10 +480,15 @@ static av_cold int
> >>>> sipr_decoder_init(AVCodecContext * avctx)
> >>>> SiprContext *ctx = avctx->priv_data;
> >>>> int i;
> >>>>
> >>>> - if (avctx->bit_rate > 12200) ctx->mode = MODE_16k;
> >>>> - else if (avctx->bit_rate > 7500 ) ctx->mode = MODE_8k5;
> >>>> - else if (avctx->bit_rate > 5750 ) ctx->mode = MODE_6k5;
> >>>> - else ctx->mode = MODE_5k0;
> >>>> + switch (avctx->block_align) {
> >>>> + case 20: ctx->mode = MODE_16k; break;
> >>>> + case 19: ctx->mode = MODE_8k5; break;
> >>>> + case 29: ctx->mode = MODE_6k5; break;
> >>>> + case 37: ctx->mode = MODE_5k0; break;
> >>>> + default:
> >>>> + av_log(avctx, AV_LOG_ERROR, "Invalid block_align: %d\n",
> >>>> avctx->block_align);
> >>>> + return AVERROR(EINVAL);
> >>>> + }
> >>>>
> >>>> av_log(avctx, AV_LOG_DEBUG, "Mode: %s\n",
> >>>> modes[ctx->mode].mode_name);
> >>>>
> >>>> --
> >>>
> >>> might be okay
> >>
> >>
> >> what concerns do you have?
> >
> > I don't know whether bitrates and block sizes are related.
>
>
> Actually, using block_align is less hackish in this case because the
> mode is directly related to block_align.
>
> from RM demuxer:
>
> ff_sipr_subpk_size[4] = { 29, 19, 37, 20 };
> ...
> st->codec->block_align = ff_sipr_subpk_size[flavor];
>
> Also, from some google searching, this seems to match the blockalign
> value from the wave header for sipr-in-wav/asf/avi. Although there's no
> way to be sure whether or not all the search results were from
> ffmpeg/libav-generated files...
probably one can generate a file on Windows or RE Windows codec (no in Real
distribution) but meanwhile - the patch might be okay (I'm not against it)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel