[FFmpeg-devel] [FFmpeg-cvslog] mpegaudiodec_template: disable CRC checking for layers 1 and 2

Martin Storsjö martin at martin.st
Mon Aug 3 09:58:01 EEST 2020


On Sun, 2 Aug 2020, Lynne wrote:

> ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sun Aug  2 22:45:00 2020 +0200| [b48397e7b84864f2d4c70361a4c4bed93e826753] | committer: Lynne
>
> mpegaudiodec_template: disable CRC checking for layers 1 and 2
>
> Layers 1 and 2 use lengths in bits which are not a multiple of 8,
> and our CRC works on a per-byte basis.
>
>> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b48397e7b84864f2d4c70361a4c4bed93e826753
> ---
>
> libavcodec/mpegaudiodec_template.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c
> index 3d7e3ba4f2..f03d7bc275 100644
> --- a/libavcodec/mpegaudiodec_template.c
> +++ b/libavcodec/mpegaudiodec_template.c
> @@ -1566,7 +1566,7 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples,
>
>     init_get_bits(&s->gb, buf + HEADER_SIZE, (buf_size - HEADER_SIZE) * 8);
> 
> -    if (s->error_protection) {
> +    if (s->error_protection && s->layer == 3) {
>         uint16_t crc = get_bits(&s->gb, 16);
>         if (s->err_recognition & AV_EF_CRCCHECK) {
>             const int sec_len = s->lsf ? ((s->nb_channels == 1) ? 9  : 17) :

This change broke two fate tests; fate-h264-skip-nokey and 
fate-h264-skip-nointra. The change does look sensible in itself though 
(framecrcs that used to be all zeros now have nonzero, varying values).

// Martin



More information about the ffmpeg-devel mailing list