History

avcodec/wmaprodec: Avoid branch for setting block_align

Andreas Rheinhardt committed 1 year ago

Commit 725563a1 parent 66acbb91 file · +7 −8Browse files

Unified · Split

libavcodec/wmaprodec.c+7−8
@@ -370,14 +370,6 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu · 369 unmodified lines
370 int log2_max_num_subframes;370 int log2_max_num_subframes;
371 int num_possible_block_sizes;371 int num_possible_block_sizes;
372 372
373 if (avctx->codec_id == AV_CODEC_ID_XMA1 || avctx->codec_id == AV_CODEC_ID_XMA2)
374 avctx->block_align = 2048;
375
376 if (!avctx->block_align) {
377 av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
378 return AVERROR(EINVAL);
379 }
380
381 s->avctx = avctx;373 s->avctx = avctx;
382 374
383 init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);375 init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
@@ -603,6 +595,11 @@ static av_cold int wmapro_decode_init(AVCodecContext *avctx) · 219 unmodified lines
603{595{
604 WMAProDecodeCtx *s = avctx->priv_data;596 WMAProDecodeCtx *s = avctx->priv_data;
605 597
598 if (!avctx->block_align) {
599 av_log(avctx, AV_LOG_ERROR, "block_align is not set\n");
600 return AVERROR(EINVAL);
601 }
602
606 return decode_init(s, avctx, 0);603 return decode_init(s, avctx, 0);
607}604}
608 605
@@ -1957,6 +1954,8 @@ static av_cold int xma_decode_init(AVCodecContext *avctx) · 1348 unmodified lines
1957 XMADecodeCtx *s = avctx->priv_data;1954 XMADecodeCtx *s = avctx->priv_data;
1958 int i, ret, start_channels = 0;1955 int i, ret, start_channels = 0;
1959 1956
1957 avctx->block_align = 2048;
1958
1960 if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)1959 if (avctx->ch_layout.nb_channels <= 0 || avctx->extradata_size == 0)
1961 return AVERROR_INVALIDDATA;1960 return AVERROR_INVALIDDATA;
1962 1961

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t