Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 16.08.16 um 19:21 schrieb Thilo Borgmann: > Am 12.08.16 um 14:27 schrieb Umair Khan: >> Hi, >> >> On Mon, Aug 8, 2016 at 11:09 PM, Carl Eugen Hoyoswrote: >>> 2016-08-08 19:10 GMT+02:00 Umair Khan : Attached the 3 separate patches. >>> >>> Which other codecs could use mlz decompression in the future? >>> Which other codecs could use IEEE 754 single floating point >>> soft float implementation in the future? >>> >>> I would suggest that there is one easy-to-understand new line >>> in the Changelog like "Floating point ALS decoding". >>> >> >> Updated patches attached. > > Ping. I'll push soon if there are no further complains. Applied. Thanks! -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 12.08.16 um 14:27 schrieb Umair Khan: > Hi, > > On Mon, Aug 8, 2016 at 11:09 PM, Carl Eugen Hoyoswrote: >> 2016-08-08 19:10 GMT+02:00 Umair Khan : >>> Attached the 3 separate patches. >> >> Which other codecs could use mlz decompression in the future? >> Which other codecs could use IEEE 754 single floating point >> soft float implementation in the future? >> >> I would suggest that there is one easy-to-understand new line >> in the Changelog like "Floating point ALS decoding". >> > > Updated patches attached. Ping. I'll push soon if there are no further complains. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, On Mon, Aug 8, 2016 at 11:09 PM, Carl Eugen Hoyoswrote: > 2016-08-08 19:10 GMT+02:00 Umair Khan : >> Attached the 3 separate patches. > > Which other codecs could use mlz decompression in the future? > Which other codecs could use IEEE 754 single floating point > soft float implementation in the future? > > I would suggest that there is one easy-to-understand new line > in the Changelog like "Floating point ALS decoding". > Updated patches attached. - Umair 0001-avutil-Softfloat-implementation-for-IEEE-754-floatin.patch Description: Binary data 0002-avcodec-Implement-masked-lz-decompression.patch Description: Binary data 0003-avcodec-alsdec-Implement-floating-point-sample-data-.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
2016-08-08 19:10 GMT+02:00 Umair Khan: > Attached the 3 separate patches. Which other codecs could use mlz decompression in the future? Which other codecs could use IEEE 754 single floating point soft float implementation in the future? I would suggest that there is one easy-to-understand new line in the Changelog like "Floating point ALS decoding". Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, On Sat, Aug 6, 2016 at 10:35 PM, Thilo Borgmannwrote: > Am 06.08.16 um 17:26 schrieb Umair Khan: >> On Fri, Aug 5, 2016 at 9:27 PM, Carl Eugen Hoyos wrote: >>> Hi! >>> >>> 2016-08-05 16:57 GMT+02:00 Umair Khan : Updated patch attached. >>> >>> The Changelog hunk of your patch indicates that the patch should be split. >>> (Or the change to Changelog could be wrong.) >> >> I don't know. I can do it if the other people also think this. > > Yes. Split it up into three parts: SoftFloat_IEEE754, MLZ and the ALS > decoding of floats. > > All these parts alone make sense for a separate commit although they are only > used in ALS (by now). > You can (assuming you are planning to maintain your code) also add yourself > to MAINTAINERS for SoftFloat & MLZ files you add. Attached the 3 separate patches. - Umair 0001-avcodec-alsdec-Implement-floating-point-sample-data-.patch Description: Binary data 0001-avcodec-Implement-masked-lz-decompression.patch Description: Binary data 0001-avutil-Softfloat-implementation-for-IEEE-754-single-.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 06.08.16 um 17:26 schrieb Umair Khan: > On Fri, Aug 5, 2016 at 9:27 PM, Carl Eugen Hoyoswrote: >> Hi! >> >> 2016-08-05 16:57 GMT+02:00 Umair Khan : >>> Updated patch attached. >> >> The Changelog hunk of your patch indicates that the patch should be split. >> (Or the change to Changelog could be wrong.) > > I don't know. I can do it if the other people also think this. Yes. Split it up into three parts: SoftFloat_IEEE754, MLZ and the ALS decoding of floats. All these parts alone make sense for a separate commit although they are only used in ALS (by now). You can (assuming you are planning to maintain your code) also add yourself to MAINTAINERS for SoftFloat & MLZ files you add. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi! 2016-08-05 16:57 GMT+02:00 Umair Khan: > Updated patch attached. The Changelog hunk of your patch indicates that the patch should be split. (Or the change to Changelog could be wrong.) Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, On Fri, Aug 5, 2016 at 6:59 PM, Umair Khanwrote: > On Fri, Aug 5, 2016 at 6:59 PM, Thilo Borgmann wrote: >> Am 05.08.16 um 14:29 schrieb Umair Khan: >>> On Fri, Aug 5, 2016 at 5:48 PM, Thilo Borgmann >>> wrote: Am 05.08.16 um 11:45 schrieb Michael Niedermayer: > On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: >> On Thu, Jul 28, 2016 at 7:12 PM, Umair Khan wrote: >>> On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann >>> wrote: Am 28.07.16 um 08:28 schrieb Umair Khan: > On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: >> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->raw_buffer = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples)); +if (sconf->floating) { +ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf)); +ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value)); +ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value)); +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa)); +ctx->raw_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa)); + +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, sizeof(*ctx->larray)); +ctx->nbits = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits)); +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); +ff_mlz_init_dict(avctx, ctx->mlz); +ff_mlz_flush_dict(ctx->mlz); ctx->mlz is also used without allocation check. Are the _dict functions safe for ctx->mlz == NULL? >> >> I had sent the old patch file by mistake. This is the correct one. >> >> - Umair > >> >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 >> >> ^^^ >> >> Changelog |3 >> libavcodec/Makefile |2 >> libavcodec/alsdec.c | 284 >> libavcodec/mlz.c| 173 ++ >> libavcodec/mlz.h| 70 + >> libavutil/softfloat_ieee754.h | 115 + >> 7 files changed, 1415 insertions(+), 3 deletions(-) > > "0001-avcodec-alsdec-implement-floating-point-decoding.patch" > looks like it shouldnt be in the checkin that way Oh I missed that, sorry... >>> >>> I didn't get it. Should I change the name of the file? >> >> No. You've added .patch file in your source tree and locally committed it >> into >> your repository as if it were a new usual source file. >> >> Go back in your local history (git reset) to the point before committing your >> changes, then add again all files except the .patch file in your source root >> directory (git add), then commit these changes (git commit) and create a new >> patch that does not add "0001-avcodec-alsdec-... .patch" into the FFmpeg >> source >> (git format-patch). > > Oh. Really sorry about this. I'll resend the patch. Updated patch attached. - Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Fri, Aug 5, 2016 at 6:59 PM, Thilo Borgmannwrote: > Am 05.08.16 um 14:29 schrieb Umair Khan: >> On Fri, Aug 5, 2016 at 5:48 PM, Thilo Borgmann >> wrote: >>> Am 05.08.16 um 11:45 schrieb Michael Niedermayer: On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: > On Thu, Jul 28, 2016 at 7:12 PM, Umair Khan wrote: >> On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann >> wrote: >>> Am 28.07.16 um 08:28 schrieb Umair Khan: On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: > On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: >>> @@ -1803,6 +2057,34 @@ static av_cold int >>> decode_init(AVCodecContext *avctx) >>> ctx->raw_buffer = av_mallocz_array(avctx->channels * >>> channel_size, sizeof(*ctx->raw_buffer)); >>> ctx->raw_samples = av_malloc_array(avctx->channels, >>> sizeof(*ctx->raw_samples)); >>> >>> +if (sconf->floating) { >>> +ctx->acf = av_malloc_array(avctx->channels, >>> sizeof(*ctx->acf)); >>> +ctx->shift_value = av_malloc_array(avctx->channels, >>> sizeof(*ctx->shift_value)); >>> +ctx->last_shift_value = av_malloc_array(avctx->channels, >>> sizeof(*ctx->last_shift_value)); >>> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, >>> sizeof(*ctx->last_acf_mantissa)); >>> +ctx->raw_mantissa = av_malloc_array(avctx->channels, >>> sizeof(*ctx->raw_mantissa)); >>> + >>> +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, >>> sizeof(*ctx->larray)); >>> +ctx->nbits = av_malloc_array(ctx->cur_frame_length, >>> sizeof(*ctx->nbits)); >>> >>> +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); >>> +ff_mlz_init_dict(avctx, ctx->mlz); >>> +ff_mlz_flush_dict(ctx->mlz); >>> >>> ctx->mlz is also used without allocation check. Are the _dict functions >>> safe for >>> ctx->mlz == NULL? > > I had sent the old patch file by mistake. This is the correct one. > > - Umair > > 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 > > ^^^ > > Changelog |3 > libavcodec/Makefile |2 > libavcodec/alsdec.c | 284 > libavcodec/mlz.c| 173 ++ > libavcodec/mlz.h| 70 + > libavutil/softfloat_ieee754.h | 115 + > 7 files changed, 1415 insertions(+), 3 deletions(-) "0001-avcodec-alsdec-implement-floating-point-decoding.patch" looks like it shouldnt be in the checkin that way >>> >>> Oh I missed that, sorry... >> >> I didn't get it. Should I change the name of the file? > > No. You've added .patch file in your source tree and locally committed it into > your repository as if it were a new usual source file. > > Go back in your local history (git reset) to the point before committing your > changes, then add again all files except the .patch file in your source root > directory (git add), then commit these changes (git commit) and create a new > patch that does not add "0001-avcodec-alsdec-... .patch" into the FFmpeg > source > (git format-patch). Oh. Really sorry about this. I'll resend the patch. - Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 05.08.16 um 14:29 schrieb Umair Khan: > On Fri, Aug 5, 2016 at 5:48 PM, Thilo Borgmannwrote: >> Am 05.08.16 um 11:45 schrieb Michael Niedermayer: >>> On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: On Thu, Jul 28, 2016 at 7:12 PM, Umair Khan wrote: > On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann > wrote: >> Am 28.07.16 um 08:28 schrieb Umair Khan: >>> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: >> @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext >> *avctx) >> ctx->raw_buffer = av_mallocz_array(avctx->channels * >> channel_size, sizeof(*ctx->raw_buffer)); >> ctx->raw_samples = av_malloc_array(avctx->channels, >> sizeof(*ctx->raw_samples)); >> >> +if (sconf->floating) { >> +ctx->acf = av_malloc_array(avctx->channels, >> sizeof(*ctx->acf)); >> +ctx->shift_value = av_malloc_array(avctx->channels, >> sizeof(*ctx->shift_value)); >> +ctx->last_shift_value = av_malloc_array(avctx->channels, >> sizeof(*ctx->last_shift_value)); >> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, >> sizeof(*ctx->last_acf_mantissa)); >> +ctx->raw_mantissa = av_malloc_array(avctx->channels, >> sizeof(*ctx->raw_mantissa)); >> + >> +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, >> sizeof(*ctx->larray)); >> +ctx->nbits = av_malloc_array(ctx->cur_frame_length, >> sizeof(*ctx->nbits)); >> >> +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); >> +ff_mlz_init_dict(avctx, ctx->mlz); >> +ff_mlz_flush_dict(ctx->mlz); >> >> ctx->mlz is also used without allocation check. Are the _dict functions >> safe for >> ctx->mlz == NULL? I had sent the old patch file by mistake. This is the correct one. - Umair >>> 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 ^^^ Changelog |3 libavcodec/Makefile |2 libavcodec/alsdec.c | 284 libavcodec/mlz.c| 173 ++ libavcodec/mlz.h| 70 + libavutil/softfloat_ieee754.h | 115 + 7 files changed, 1415 insertions(+), 3 deletions(-) >>> >>> "0001-avcodec-alsdec-implement-floating-point-decoding.patch" >>> looks like it shouldnt be in the checkin that way >> >> Oh I missed that, sorry... > > I didn't get it. Should I change the name of the file? No. You've added .patch file in your source tree and locally committed it into your repository as if it were a new usual source file. Go back in your local history (git reset) to the point before committing your changes, then add again all files except the .patch file in your source root directory (git add), then commit these changes (git commit) and create a new patch that does not add "0001-avcodec-alsdec-... .patch" into the FFmpeg source (git format-patch). -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Fri, Aug 5, 2016 at 5:48 PM, Thilo Borgmannwrote: > Am 05.08.16 um 11:45 schrieb Michael Niedermayer: >> On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: >>> On Thu, Jul 28, 2016 at 7:12 PM, Umair Khan wrote: On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann wrote: > Am 28.07.16 um 08:28 schrieb Umair Khan: >> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: >>> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext > *avctx) > ctx->raw_buffer = av_mallocz_array(avctx->channels * > channel_size, sizeof(*ctx->raw_buffer)); > ctx->raw_samples = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_samples)); > > +if (sconf->floating) { > +ctx->acf = av_malloc_array(avctx->channels, > sizeof(*ctx->acf)); > +ctx->shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->shift_value)); > +ctx->last_shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->last_shift_value)); > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->last_acf_mantissa)); > +ctx->raw_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_mantissa)); > + > +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, > sizeof(*ctx->larray)); > +ctx->nbits = av_malloc_array(ctx->cur_frame_length, > sizeof(*ctx->nbits)); > > +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); > +ff_mlz_init_dict(avctx, ctx->mlz); > +ff_mlz_flush_dict(ctx->mlz); > > ctx->mlz is also used without allocation check. Are the _dict functions > safe for > ctx->mlz == NULL? >>> >>> I had sent the old patch file by mistake. This is the correct one. >>> >>> - Umair >> >>> 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 >>> >>> Changelog |3 >>> libavcodec/Makefile |2 >>> libavcodec/alsdec.c | 284 >>> libavcodec/mlz.c| 173 ++ >>> libavcodec/mlz.h| 70 + >>> libavutil/softfloat_ieee754.h | 115 + >>> 7 files changed, 1415 insertions(+), 3 deletions(-) >> >> "0001-avcodec-alsdec-implement-floating-point-decoding.patch" >> looks like it shouldnt be in the checkin that way > > Oh I missed that, sorry... I didn't get it. Should I change the name of the file? - Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 05.08.16 um 11:45 schrieb Michael Niedermayer: > On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: >> On Thu, Jul 28, 2016 at 7:12 PM, Umair Khanwrote: >>> On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann >>> wrote: Am 28.07.16 um 08:28 schrieb Umair Khan: > On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: >> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->raw_buffer = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples)); +if (sconf->floating) { +ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf)); +ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value)); +ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value)); +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa)); +ctx->raw_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa)); + +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, sizeof(*ctx->larray)); +ctx->nbits = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits)); +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); +ff_mlz_init_dict(avctx, ctx->mlz); +ff_mlz_flush_dict(ctx->mlz); ctx->mlz is also used without allocation check. Are the _dict functions safe for ctx->mlz == NULL? >> >> I had sent the old patch file by mistake. This is the correct one. >> >> - Umair > >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 >> >> Changelog |3 >> libavcodec/Makefile |2 >> libavcodec/alsdec.c | 284 >> libavcodec/mlz.c| 173 ++ >> libavcodec/mlz.h| 70 + >> libavutil/softfloat_ieee754.h | 115 + >> 7 files changed, 1415 insertions(+), 3 deletions(-) > > "0001-avcodec-alsdec-implement-floating-point-decoding.patch" > looks like it shouldnt be in the checkin that way Oh I missed that, sorry... -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Fri, Jul 29, 2016 at 08:33:13PM +0530, Umair Khan wrote: > On Thu, Jul 28, 2016 at 7:12 PM, Umair Khanwrote: > > On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann > > wrote: > >> Am 28.07.16 um 08:28 schrieb Umair Khan: > >>> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: > On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: > >> @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext > >> *avctx) > >> ctx->raw_buffer = av_mallocz_array(avctx->channels * > >> channel_size, sizeof(*ctx->raw_buffer)); > >> ctx->raw_samples = av_malloc_array(avctx->channels, > >> sizeof(*ctx->raw_samples)); > >> > >> +if (sconf->floating) { > >> +ctx->acf = av_malloc_array(avctx->channels, > >> sizeof(*ctx->acf)); > >> +ctx->shift_value = av_malloc_array(avctx->channels, > >> sizeof(*ctx->shift_value)); > >> +ctx->last_shift_value = av_malloc_array(avctx->channels, > >> sizeof(*ctx->last_shift_value)); > >> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, > >> sizeof(*ctx->last_acf_mantissa)); > >> +ctx->raw_mantissa = av_malloc_array(avctx->channels, > >> sizeof(*ctx->raw_mantissa)); > >> + > >> +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, > >> sizeof(*ctx->larray)); > >> +ctx->nbits = av_malloc_array(ctx->cur_frame_length, > >> sizeof(*ctx->nbits)); > >> > >> +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); > >> +ff_mlz_init_dict(avctx, ctx->mlz); > >> +ff_mlz_flush_dict(ctx->mlz); > >> > >> ctx->mlz is also used without allocation check. Are the _dict functions > >> safe for > >> ctx->mlz == NULL? > > I had sent the old patch file by mistake. This is the correct one. > > - Umair > 0001-avcodec-alsdec-implement-floating-point-decoding.patch | 771 > > Changelog |3 > libavcodec/Makefile |2 > libavcodec/alsdec.c | 284 > libavcodec/mlz.c| 173 ++ > libavcodec/mlz.h| 70 + > libavutil/softfloat_ieee754.h | 115 + > 7 files changed, 1415 insertions(+), 3 deletions(-) "0001-avcodec-alsdec-implement-floating-point-decoding.patch" looks like it shouldnt be in the checkin that way [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
> [...] > I had sent the old patch file by mistake. This is the correct one. LGTM. Pushing in a few days if there are no further comments. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 28, 2016 at 7:12 PM, Umair Khanwrote: > On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmann > wrote: >> Am 28.07.16 um 08:28 schrieb Umair Khan: >>> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: >> @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext >> *avctx) >> ctx->raw_buffer = av_mallocz_array(avctx->channels * >> channel_size, sizeof(*ctx->raw_buffer)); >> ctx->raw_samples = av_malloc_array(avctx->channels, >> sizeof(*ctx->raw_samples)); >> >> +if (sconf->floating) { >> +ctx->acf = av_malloc_array(avctx->channels, >> sizeof(*ctx->acf)); >> +ctx->shift_value = av_malloc_array(avctx->channels, >> sizeof(*ctx->shift_value)); >> +ctx->last_shift_value = av_malloc_array(avctx->channels, >> sizeof(*ctx->last_shift_value)); >> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, >> sizeof(*ctx->last_acf_mantissa)); >> +ctx->raw_mantissa = av_malloc_array(avctx->channels, >> sizeof(*ctx->raw_mantissa)); >> + >> +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, >> sizeof(*ctx->larray)); >> +ctx->nbits = av_malloc_array(ctx->cur_frame_length, >> sizeof(*ctx->nbits)); >> >> +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); >> +ff_mlz_init_dict(avctx, ctx->mlz); >> +ff_mlz_flush_dict(ctx->mlz); >> >> ctx->mlz is also used without allocation check. Are the _dict functions safe >> for >> ctx->mlz == NULL? I had sent the old patch file by mistake. This is the correct one. - Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 28, 2016 at 2:25 PM, Thilo Borgmannwrote: > Am 28.07.16 um 08:28 schrieb Umair Khan: >> On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœsch wrote: >>> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext > *avctx) > ctx->raw_buffer = av_mallocz_array(avctx->channels * > channel_size, sizeof(*ctx->raw_buffer)); > ctx->raw_samples = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_samples)); > > +if (sconf->floating) { > +ctx->acf = av_malloc_array(avctx->channels, > sizeof(*ctx->acf)); > +ctx->shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->shift_value)); > +ctx->last_shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->last_shift_value)); > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->last_acf_mantissa)); > +ctx->raw_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_mantissa)); > + > +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, > sizeof(*ctx->larray)); > +ctx->nbits = av_malloc_array(ctx->cur_frame_length, > sizeof(*ctx->nbits)); > > +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); > +ff_mlz_init_dict(avctx, ctx->mlz); > +ff_mlz_flush_dict(ctx->mlz); > > ctx->mlz is also used without allocation check. Are the _dict functions safe > for > ctx->mlz == NULL? Updated. - Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 28.07.16 um 08:28 schrieb Umair Khan: > On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœschwrote: >> On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->raw_buffer = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples)); +if (sconf->floating) { +ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf)); +ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value)); +ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value)); +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa)); +ctx->raw_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa)); + +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, sizeof(*ctx->larray)); +ctx->nbits = av_malloc_array(ctx->cur_frame_length, sizeof(*ctx->nbits)); +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); +ff_mlz_init_dict(avctx, ctx->mlz); +ff_mlz_flush_dict(ctx->mlz); ctx->mlz is also used without allocation check. Are the _dict functions safe for ctx->mlz == NULL? -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 28, 2016 at 12:22 AM, Clément Bœschwrote: > On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: >> > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext >> > *avctx) >> > ctx->raw_buffer = av_mallocz_array(avctx->channels * >> > channel_size, sizeof(*ctx->raw_buffer)); >> > ctx->raw_samples = av_malloc_array(avctx->channels, >> > sizeof(*ctx->raw_samples)); >> > >> > +if (sconf->floating) { >> > +ctx->acf = av_malloc_array(avctx->channels, >> > sizeof(*ctx->acf)); >> > +ctx->shift_value = av_malloc_array(avctx->channels, >> > sizeof(*ctx->shift_value)); >> > +ctx->last_shift_value = av_malloc_array(avctx->channels, >> > sizeof(*ctx->last_shift_value)); >> > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, >> > sizeof(*ctx->last_acf_mantissa)); >> > +ctx->raw_mantissa = av_malloc_array(avctx->channels, >> > sizeof(*ctx->raw_mantissa)); >> > + >> > +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, >> > sizeof(*ctx->larray)); >> > +ctx->nbits = av_malloc_array(ctx->cur_frame_length, >> > sizeof(*ctx->nbits)); >> > +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); >> > +ff_mlz_init_dict(avctx, ctx->mlz); >> > +ff_mlz_flush_dict(ctx->mlz); >> > + >> > +if (!ctx->mlz || !ctx->acf || !ctx->shift_value || >> > !ctx->last_shift_value >> > +|| !ctx->last_acf_mantissa || !ctx->raw_mantissa) { >> > +av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory >> > failed.\n"); >> > +ret = AVERROR(ENOMEM); >> > +goto fail; >> > +} >> >> > +for (c = 0; c < avctx->channels; ++c) { >> > +ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, >> > sizeof(**ctx->raw_mantissa)); >> >> Is there no av_malloc_arrayz() ? >> > > there is av_mallocz_array() Updated and tested. - Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Wed, Jul 27, 2016 at 07:48:56PM +0200, Thilo Borgmann wrote: > > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) > > ctx->raw_buffer = av_mallocz_array(avctx->channels * > > channel_size, sizeof(*ctx->raw_buffer)); > > ctx->raw_samples = av_malloc_array(avctx->channels, > > sizeof(*ctx->raw_samples)); > > > > +if (sconf->floating) { > > +ctx->acf = av_malloc_array(avctx->channels, > > sizeof(*ctx->acf)); > > +ctx->shift_value = av_malloc_array(avctx->channels, > > sizeof(*ctx->shift_value)); > > +ctx->last_shift_value = av_malloc_array(avctx->channels, > > sizeof(*ctx->last_shift_value)); > > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, > > sizeof(*ctx->last_acf_mantissa)); > > +ctx->raw_mantissa = av_malloc_array(avctx->channels, > > sizeof(*ctx->raw_mantissa)); > > + > > +ctx->larray = av_malloc_array(ctx->cur_frame_length * 4, > > sizeof(*ctx->larray)); > > +ctx->nbits = av_malloc_array(ctx->cur_frame_length, > > sizeof(*ctx->nbits)); > > +ctx->mlz= av_malloc(sizeof(*ctx->mlz)); > > +ff_mlz_init_dict(avctx, ctx->mlz); > > +ff_mlz_flush_dict(ctx->mlz); > > + > > +if (!ctx->mlz || !ctx->acf || !ctx->shift_value || > > !ctx->last_shift_value > > +|| !ctx->last_acf_mantissa || !ctx->raw_mantissa) { > > +av_log(avctx, AV_LOG_ERROR, "Allocating buffer memory > > failed.\n"); > > +ret = AVERROR(ENOMEM); > > +goto fail; > > +} > > > +for (c = 0; c < avctx->channels; ++c) { > > +ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, > > sizeof(**ctx->raw_mantissa)); > > Is there no av_malloc_arrayz() ? > there is av_mallocz_array() -- Clément B. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Wed, Jul 27, 2016 at 1:27 PM, Umair Khanwrote: > On Wed, Jul 27, 2016 at 1:28 PM, Thilo Borgmann > wrote: >> Hi, >> [...] > @@ -1678,6 +1931,7 @@ static av_cold int decode_init(AVCodecContext > *avctx) > { > unsigned int c; > unsigned int channel_size; > +unsigned int i; > int num_buffers, ret; > ALSDecContext *ctx = avctx->priv_data; > ALSSpecificConfig *sconf = >sconf; > @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext > *avctx) > ctx->raw_buffer = av_mallocz_array(avctx->channels * > channel_size, sizeof(*ctx->raw_buffer)); > ctx->raw_samples = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_samples)); > > +if (sconf->floating) { > +ctx->acf = av_malloc_array(avctx->channels, > sizeof(*ctx->acf)); > +ctx->shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->shift_value)); > +ctx->last_shift_value = av_malloc_array(avctx->channels, > sizeof(*ctx->last_shift_value)); > +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->last_acf_mantissa)); > +ctx->raw_mantissa = av_malloc_array(avctx->channels, > sizeof(*ctx->raw_mantissa)); > + > +for (c = 0; c < avctx->channels; ++c) { > +ctx->raw_mantissa[c] = > av_malloc_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa)); using ctx->raw_mantissa without prior malloc failure check >>> >>> Should I keep this in a separate patch? It is unrelated to my patch. >> >> This is not unrelated to your patch. You're allocating ctx->raw_mantissa >> array >> and use the (maybe invalid) "allocated" array in the for loop. Test for a >> valid >> pointer in ctx->raw_matissa before using it. > > Oops. Sorry. I mistook it as raw_samples. I'll send another patch in a bit. Updated patch attached. -Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Wed, Jul 27, 2016 at 1:28 PM, Thilo Borgmannwrote: > Hi, > >>> [...] @@ -1678,6 +1931,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { unsigned int c; unsigned int channel_size; +unsigned int i; int num_buffers, ret; ALSDecContext *ctx = avctx->priv_data; ALSSpecificConfig *sconf = >sconf; @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) ctx->raw_buffer = av_mallocz_array(avctx->channels * channel_size, sizeof(*ctx->raw_buffer)); ctx->raw_samples = av_malloc_array(avctx->channels, sizeof(*ctx->raw_samples)); +if (sconf->floating) { +ctx->acf = av_malloc_array(avctx->channels, sizeof(*ctx->acf)); +ctx->shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->shift_value)); +ctx->last_shift_value = av_malloc_array(avctx->channels, sizeof(*ctx->last_shift_value)); +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->last_acf_mantissa)); +ctx->raw_mantissa = av_malloc_array(avctx->channels, sizeof(*ctx->raw_mantissa)); + +for (c = 0; c < avctx->channels; ++c) { +ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, sizeof(**ctx->raw_mantissa)); >>> >>> using ctx->raw_mantissa without prior malloc failure check >> >> Should I keep this in a separate patch? It is unrelated to my patch. > > This is not unrelated to your patch. You're allocating ctx->raw_mantissa array > and use the (maybe invalid) "allocated" array in the for loop. Test for a > valid > pointer in ctx->raw_matissa before using it. Oops. Sorry. I mistook it as raw_samples. I'll send another patch in a bit. - Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, >> [...] >>> @@ -1678,6 +1931,7 @@ static av_cold int decode_init(AVCodecContext *avctx) >>> { >>> unsigned int c; >>> unsigned int channel_size; >>> +unsigned int i; >>> int num_buffers, ret; >>> ALSDecContext *ctx = avctx->priv_data; >>> ALSSpecificConfig *sconf = >sconf; >>> @@ -1803,6 +2057,34 @@ static av_cold int decode_init(AVCodecContext *avctx) >>> ctx->raw_buffer = av_mallocz_array(avctx->channels * >>> channel_size, sizeof(*ctx->raw_buffer)); >>> ctx->raw_samples = av_malloc_array(avctx->channels, >>> sizeof(*ctx->raw_samples)); >>> >>> +if (sconf->floating) { >>> +ctx->acf = av_malloc_array(avctx->channels, >>> sizeof(*ctx->acf)); >>> +ctx->shift_value = av_malloc_array(avctx->channels, >>> sizeof(*ctx->shift_value)); >>> +ctx->last_shift_value = av_malloc_array(avctx->channels, >>> sizeof(*ctx->last_shift_value)); >>> +ctx->last_acf_mantissa = av_malloc_array(avctx->channels, >>> sizeof(*ctx->last_acf_mantissa)); >>> +ctx->raw_mantissa = av_malloc_array(avctx->channels, >>> sizeof(*ctx->raw_mantissa)); >>> + >>> +for (c = 0; c < avctx->channels; ++c) { >>> +ctx->raw_mantissa[c] = av_malloc_array(ctx->cur_frame_length, >>> sizeof(**ctx->raw_mantissa)); >> >> using ctx->raw_mantissa without prior malloc failure check > > Should I keep this in a separate patch? It is unrelated to my patch. This is not unrelated to your patch. You're allocating ctx->raw_mantissa array and use the (maybe invalid) "allocated" array in the for loop. Test for a valid pointer in ctx->raw_matissa before using it. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Tue, Jul 26, 2016 at 4:52 AM, Michael Niedermayerwrote: > On Mon, Jul 25, 2016 at 10:13:38PM +0530, Umair Khan wrote: >> On Sun, Jul 24, 2016 at 1:47 AM, Umair Khan wrote: >> > >> > HI, >> > >> > On Fri, Jul 22, 2016 at 9:19 PM, Michael Niedermayer >> > wrote: >> > > On Fri, Jul 22, 2016 at 06:22:30PM +0530, Umair Khan wrote: >> > >> On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer >> > >> wrote: >> > >> > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: >> > > [...] >> > >> >> +static int decode_string(MLZDict *dict, unsigned char *buff, int >> > >> >> string_code, int *first_char_code, unsigned long bufsize) { >> > >> >> +unsigned long count, offset; >> > >> >> +int current_code, parent_code, tmp_code; >> > >> >> + >> > >> >> +count= 0; >> > >> >> +current_code = string_code; >> > >> >> +*first_char_code = CODE_UNSET; >> > >> >> + >> > >> >> +while (count < bufsize) { >> > >> >> +switch (current_code) { >> > >> >> +case CODE_UNSET: >> > >> >> +return count; >> > >> >> +break; >> > >> >> +default: >> > >> >> +if (current_code < FIRST_CODE) { >> > >> >> +*first_char_code = current_code; >> > >> >> +buff[0] = current_code; >> > >> >> +count++; >> > >> >> +return count; >> > >> >> +} else { >> > >> >> +offset = dict[current_code].match_len - 1; >> > >> >> +tmp_code = dict[current_code].char_code; >> > >> >> +buff[offset] = tmp_code; >> > >> >> +count++; >> > >> >> +} >> > >> >> +current_code = dict[current_code].parent_code; >> > >> >> +if ((current_code < 0) || (current_code > >> > >> >> (DIC_INDEX_MAX - 1))) { >> > >> > >> > >> >> +av_log(NULL, AV_LOG_ERROR, "MLZ dic index >> > >> >> error.\n"); >> > >> > >> > >> > it would be ideal if all av_log() would have a context instead of NULL >> > >> >> > >> How to go ahead with this? Should I create MLZContext or something? If >> > >> yes, could you please tell how? >> > > >> > > possible or you pass a void *context >> > >> > Updated patch. >> >> Another revision. Fixes some things I had overlooked. >> >> - Umair > >> Changelog |3 >> libavcodec/Makefile |2 >> libavcodec/alsdec.c | 286 >> +- >> libavcodec/mlz.c | 173 + >> libavcodec/mlz.h | 70 ++ >> libavutil/softfloat_ieee754.h | 115 >> 6 files changed, 646 insertions(+), 3 deletions(-) >> 66dd916fe5b2e98b30aed21f4cf656b66c51ce1f >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch >> From 44567b208cf0b697a4403420bc3f7ba0cebabbc1 Mon Sep 17 00:00:00 2001 >> From: Umair Khan >> Date: Sun, 24 Jul 2016 00:28:55 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> >> It conforms to RM22 version of the reference codec. > > gcc generates these warnings: > > libavcodec/mlz.c: In function ‘ff_mlz_decompression’: > libavcodec/mlz.c:152:25: warning: passing argument 1 of ‘decode_string’ from > incompatible pointer type [enabled by default] > libavcodec/mlz.c:61:12: note: expected ‘struct MLZ *’ but argument is of type > ‘struct MLZDict *’ > libavcodec/mlz.c:153:25: warning: passing argument 1 of ‘decode_string’ from > incompatible pointer type [enabled by default] > libavcodec/mlz.c:61:12: note: expected ‘struct MLZ *’ but argument is of type > ‘struct MLZDict *’ > libavcodec/mlz.c:157:25: warning: passing argument 1 of ‘decode_string’ from > incompatible pointer type [enabled by default] Fixed. > [...] >> + >> +/** Read and decode the floating point sample data >> + */ >> +static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { >> +AVCodecContext *avctx = ctx->avctx; >> +GetBitContext *gb = >gb; >> +SoftFloat_IEEE754 *acf = ctx->acf; >> +int *shift_value= ctx->shift_value; >> +int *last_shift_value = ctx->last_shift_value; >> +int *last_acf_mantissa = ctx->last_acf_mantissa; >> +int **raw_mantissa = ctx->raw_mantissa; >> +int *nbits = ctx->nbits; >> +unsigned char *larray = ctx->larray; >> +int frame_length= ctx->cur_frame_length; >> +SoftFloat_IEEE754 scale = av_int2sf_ieee754(0x1u, 23); >> +unsigned int partA_flag; >> +unsigned int highest_byte; >> +unsigned int shift_amp; >> +uint32_t tmp_32; >> +int use_acf; >> +int nchars; >> +int i; >> +int c; >> +long k; >> +long nbits_aligned; >> +unsigned long acc; >> +unsigned long j; >> +uint32_t sign; >> +uint32_t e; >> +uint32_t mantissa; >> + >> +
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Mon, Jul 25, 2016 at 10:13:38PM +0530, Umair Khan wrote: > On Sun, Jul 24, 2016 at 1:47 AM, Umair Khanwrote: > > > > HI, > > > > On Fri, Jul 22, 2016 at 9:19 PM, Michael Niedermayer > > wrote: > > > On Fri, Jul 22, 2016 at 06:22:30PM +0530, Umair Khan wrote: > > >> On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer > > >> wrote: > > >> > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: > > > [...] > > >> >> +static int decode_string(MLZDict *dict, unsigned char *buff, int > > >> >> string_code, int *first_char_code, unsigned long bufsize) { > > >> >> +unsigned long count, offset; > > >> >> +int current_code, parent_code, tmp_code; > > >> >> + > > >> >> +count= 0; > > >> >> +current_code = string_code; > > >> >> +*first_char_code = CODE_UNSET; > > >> >> + > > >> >> +while (count < bufsize) { > > >> >> +switch (current_code) { > > >> >> +case CODE_UNSET: > > >> >> +return count; > > >> >> +break; > > >> >> +default: > > >> >> +if (current_code < FIRST_CODE) { > > >> >> +*first_char_code = current_code; > > >> >> +buff[0] = current_code; > > >> >> +count++; > > >> >> +return count; > > >> >> +} else { > > >> >> +offset = dict[current_code].match_len - 1; > > >> >> +tmp_code = dict[current_code].char_code; > > >> >> +buff[offset] = tmp_code; > > >> >> +count++; > > >> >> +} > > >> >> +current_code = dict[current_code].parent_code; > > >> >> +if ((current_code < 0) || (current_code > (DIC_INDEX_MAX > > >> >> - 1))) { > > >> > > > >> >> +av_log(NULL, AV_LOG_ERROR, "MLZ dic index error.\n"); > > >> > > > >> > it would be ideal if all av_log() would have a context instead of NULL > > >> > > >> How to go ahead with this? Should I create MLZContext or something? If > > >> yes, could you please tell how? > > > > > > possible or you pass a void *context > > > > Updated patch. > > Another revision. Fixes some things I had overlooked. > > - Umair > Changelog |3 > libavcodec/Makefile |2 > libavcodec/alsdec.c | 286 > +- > libavcodec/mlz.c | 173 + > libavcodec/mlz.h | 70 ++ > libavutil/softfloat_ieee754.h | 115 > 6 files changed, 646 insertions(+), 3 deletions(-) > 66dd916fe5b2e98b30aed21f4cf656b66c51ce1f > 0001-avcodec-alsdec-implement-floating-point-decoding.patch > From 44567b208cf0b697a4403420bc3f7ba0cebabbc1 Mon Sep 17 00:00:00 2001 > From: Umair Khan > Date: Sun, 24 Jul 2016 00:28:55 +0530 > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > > It conforms to RM22 version of the reference codec. gcc generates these warnings: libavcodec/mlz.c: In function ‘ff_mlz_decompression’: libavcodec/mlz.c:152:25: warning: passing argument 1 of ‘decode_string’ from incompatible pointer type [enabled by default] libavcodec/mlz.c:61:12: note: expected ‘struct MLZ *’ but argument is of type ‘struct MLZDict *’ libavcodec/mlz.c:153:25: warning: passing argument 1 of ‘decode_string’ from incompatible pointer type [enabled by default] libavcodec/mlz.c:61:12: note: expected ‘struct MLZ *’ but argument is of type ‘struct MLZDict *’ libavcodec/mlz.c:157:25: warning: passing argument 1 of ‘decode_string’ from incompatible pointer type [enabled by default] [...] > + > +/** Read and decode the floating point sample data > + */ > +static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { > +AVCodecContext *avctx = ctx->avctx; > +GetBitContext *gb = >gb; > +SoftFloat_IEEE754 *acf = ctx->acf; > +int *shift_value= ctx->shift_value; > +int *last_shift_value = ctx->last_shift_value; > +int *last_acf_mantissa = ctx->last_acf_mantissa; > +int **raw_mantissa = ctx->raw_mantissa; > +int *nbits = ctx->nbits; > +unsigned char *larray = ctx->larray; > +int frame_length= ctx->cur_frame_length; > +SoftFloat_IEEE754 scale = av_int2sf_ieee754(0x1u, 23); > +unsigned int partA_flag; > +unsigned int highest_byte; > +unsigned int shift_amp; > +uint32_t tmp_32; > +int use_acf; > +int nchars; > +int i; > +int c; > +long k; > +long nbits_aligned; > +unsigned long acc; > +unsigned long j; > +uint32_t sign; > +uint32_t e; > +uint32_t mantissa; > + > +skip_bits_long(gb, 32); //num_bytes_diff_float > +use_acf = get_bits1(gb); > + > +if (ra_frame) { > +memset(last_acf_mantissa, 0, sizeof(last_acf_mantissa)); > +memset(last_shift_value, 0, sizeof(last_shift_value) );
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Sun, Jul 24, 2016 at 1:47 AM, Umair Khanwrote: > > HI, > > On Fri, Jul 22, 2016 at 9:19 PM, Michael Niedermayer > wrote: > > On Fri, Jul 22, 2016 at 06:22:30PM +0530, Umair Khan wrote: > >> On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer > >> wrote: > >> > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: > > [...] > >> >> +static int decode_string(MLZDict *dict, unsigned char *buff, int > >> >> string_code, int *first_char_code, unsigned long bufsize) { > >> >> +unsigned long count, offset; > >> >> +int current_code, parent_code, tmp_code; > >> >> + > >> >> +count= 0; > >> >> +current_code = string_code; > >> >> +*first_char_code = CODE_UNSET; > >> >> + > >> >> +while (count < bufsize) { > >> >> +switch (current_code) { > >> >> +case CODE_UNSET: > >> >> +return count; > >> >> +break; > >> >> +default: > >> >> +if (current_code < FIRST_CODE) { > >> >> +*first_char_code = current_code; > >> >> +buff[0] = current_code; > >> >> +count++; > >> >> +return count; > >> >> +} else { > >> >> +offset = dict[current_code].match_len - 1; > >> >> +tmp_code = dict[current_code].char_code; > >> >> +buff[offset] = tmp_code; > >> >> +count++; > >> >> +} > >> >> +current_code = dict[current_code].parent_code; > >> >> +if ((current_code < 0) || (current_code > (DIC_INDEX_MAX - > >> >> 1))) { > >> > > >> >> +av_log(NULL, AV_LOG_ERROR, "MLZ dic index error.\n"); > >> > > >> > it would be ideal if all av_log() would have a context instead of NULL > >> > >> How to go ahead with this? Should I create MLZContext or something? If > >> yes, could you please tell how? > > > > possible or you pass a void *context > > Updated patch. Another revision. Fixes some things I had overlooked. - Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
HI, On Fri, Jul 22, 2016 at 9:19 PM, Michael Niedermayerwrote: > On Fri, Jul 22, 2016 at 06:22:30PM +0530, Umair Khan wrote: >> On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer >> wrote: >> > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: > [...] >> >> +static int decode_string(MLZDict *dict, unsigned char *buff, int >> >> string_code, int *first_char_code, unsigned long bufsize) { >> >> +unsigned long count, offset; >> >> +int current_code, parent_code, tmp_code; >> >> + >> >> +count= 0; >> >> +current_code = string_code; >> >> +*first_char_code = CODE_UNSET; >> >> + >> >> +while (count < bufsize) { >> >> +switch (current_code) { >> >> +case CODE_UNSET: >> >> +return count; >> >> +break; >> >> +default: >> >> +if (current_code < FIRST_CODE) { >> >> +*first_char_code = current_code; >> >> +buff[0] = current_code; >> >> +count++; >> >> +return count; >> >> +} else { >> >> +offset = dict[current_code].match_len - 1; >> >> +tmp_code = dict[current_code].char_code; >> >> +buff[offset] = tmp_code; >> >> +count++; >> >> +} >> >> +current_code = dict[current_code].parent_code; >> >> +if ((current_code < 0) || (current_code > (DIC_INDEX_MAX - >> >> 1))) { >> > >> >> +av_log(NULL, AV_LOG_ERROR, "MLZ dic index error.\n"); >> > >> > it would be ideal if all av_log() would have a context instead of NULL >> >> How to go ahead with this? Should I create MLZContext or something? If >> yes, could you please tell how? > > possible or you pass a void *context Updated patch. -Umair 0001-avcodec-alsdec-implement-floating-point-decoding.patch Description: Binary data ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Fri, Jul 22, 2016 at 06:22:30PM +0530, Umair Khan wrote: > On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer >wrote: > > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: [...] > >> +static int decode_string(MLZDict *dict, unsigned char *buff, int > >> string_code, int *first_char_code, unsigned long bufsize) { > >> +unsigned long count, offset; > >> +int current_code, parent_code, tmp_code; > >> + > >> +count= 0; > >> +current_code = string_code; > >> +*first_char_code = CODE_UNSET; > >> + > >> +while (count < bufsize) { > >> +switch (current_code) { > >> +case CODE_UNSET: > >> +return count; > >> +break; > >> +default: > >> +if (current_code < FIRST_CODE) { > >> +*first_char_code = current_code; > >> +buff[0] = current_code; > >> +count++; > >> +return count; > >> +} else { > >> +offset = dict[current_code].match_len - 1; > >> +tmp_code = dict[current_code].char_code; > >> +buff[offset] = tmp_code; > >> +count++; > >> +} > >> +current_code = dict[current_code].parent_code; > >> +if ((current_code < 0) || (current_code > (DIC_INDEX_MAX - > >> 1))) { > > > >> +av_log(NULL, AV_LOG_ERROR, "MLZ dic index error.\n"); > > > > it would be ideal if all av_log() would have a context instead of NULL > > How to go ahead with this? Should I create MLZContext or something? If > yes, could you please tell how? possible or you pass a void *context [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayerwrote: > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: >> Hi, >> >> Patch attached. >> >> - Umair > >> libavcodec/Makefile |2 >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + >> 5 files changed, 638 insertions(+), 3 deletions(-) >> 0282267108d74681f1bff6b5e6a85c603ac7052e >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 >> From: Umair Khan >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> >> It conforms to RM22 version of the reference codec. >> >> Signed-off-by: Umair Khan >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + > > missing update to Changelog > > [...] >> @@ -1356,6 +1366,237 @@ static int revert_channel_correlation(ALSDecContext >> *ctx, ALSBlockData *bd, >> } >> >> >> +/** multiply two softfloats and handle the rounding off >> + */ >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) >> { >> +uint64_t mantissa_temp; >> +uint64_t mask_64; >> +int bit_count; >> +int cutoff_bit_count; >> +unsigned char last_2_bits; >> +unsigned int mantissa; >> +uint32_t return_val = 0; >> +int32_t sign; >> + >> +sign = a.sign ^ b.sign; >> + >> +// Multiply mantissa bits in a 64-bit register >> +mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant; >> + >> +// Count the valid bit count > >> +for (bit_count=48, mask_64=(uint64_t)0x1 << 47; !(mantissa_temp & >> mask_64) && mask_64; bit_count--, mask_64>>=1); > > this needs some newlines for readability > > >> + >> +// Round off >> +cutoff_bit_count = bit_count - 24; >> +if (cutoff_bit_count > 0) { >> +last_2_bits = (unsigned char)(((unsigned int)mantissa_temp >> >> (cutoff_bit_count - 1)) & 0x3 ); >> +if ((last_2_bits == 0x3) || ((last_2_bits == 0x1) && ((unsigned >> int)mantissa_temp & ((0x1UL << (cutoff_bit_count - 1)) - 1 { >> +// Need to round up >> +mantissa_temp += (uint64_t)0x1 << cutoff_bit_count; >> +} >> +} >> + >> +mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count); >> + >> +// Need one more shift? >> +if (mantissa & 0x0100ul) { >> +bit_count++; >> +mantissa >>= 1; >> +} >> + >> +if (!sign) { >> +return_val = 0x8000U; >> +} >> + >> +return_val |= (a.exp + b.exp + bit_count - 47) << 23; >> +return_val |= mantissa; >> +return av_bits2sf_ieee754(return_val); >> +} >> + >> + >> +/** Read and decode the floating point sample data >> + */ >> +static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { >> +AVCodecContext *avctx = ctx->avctx; >> +GetBitContext *gb = >gb; >> +SoftFloat_IEEE754 *acf = ctx->acf; >> +int *shift_value= ctx->shift_value; >> +int *last_shift_value = ctx->last_shift_value; >> +int *last_acf_mantissa = ctx->last_acf_mantissa; >> +int **raw_mantissa = ctx->raw_mantissa; >> +int *nbits = ctx->nbits; >> +unsigned char *larray = ctx->larray; >> +int frame_length= ctx->cur_frame_length; >> +SoftFloat_IEEE754 scale = av_int2sf_ieee754(0x1u, 23); >> +unsigned int partA_flag; >> +unsigned int highest_byte; >> +unsigned int shift_amp; >> +uint32_t tmp_32; >> +int use_acf; >> +int nchars; >> +int i; >> +int c; >> +long k; >> +long nbits_aligned; >> +unsigned long acc; >> +unsigned long j; >> +uint32_t sign; >> +uint32_t e; >> +uint32_t mantissa; >> + >> +skip_bits_long(gb, 32); //num_bytes_diff_float >> +use_acf = get_bits1(gb); >> + >> +if (ra_frame) { > >> +for (c = 0; c < avctx->channels; ++c) { >> +last_acf_mantissa[c] = 0; >> +last_shift_value[c] = 0; >> +} > > memset() > > >> +ff_mlz_flush_dict(ctx->mlz); >> +} >> + >> +for (c = 0; c < avctx->channels; ++c) { >> +if (use_acf) { >> +//acf_flag >> +if (get_bits1(gb)) { >> +tmp_32 = get_bits(gb, 23); >> +last_acf_mantissa[c] = tmp_32; >> +} else { >> +tmp_32 = last_acf_mantissa[c]; >> +} >> +acf[c] = av_bits2sf_ieee754(tmp_32); >> +} else {
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 21, 2016 at 11:14:03PM +0530, Umair Khan wrote: > On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayer >wrote: > > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: > >> Hi, > >> > >> Patch attached. > >> > >> - Umair > > > >> libavcodec/Makefile |2 > >> libavcodec/alsdec.c | 284 > >> +- > >> libavcodec/mlz.c | 171 + > >> libavcodec/mlz.h | 69 ++ > >> libavutil/softfloat_ieee754.h | 115 + > >> 5 files changed, 638 insertions(+), 3 deletions(-) > >> 0282267108d74681f1bff6b5e6a85c603ac7052e > >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 > >> From: Umair Khan > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > >> > >> It conforms to RM22 version of the reference codec. > >> > >> Signed-off-by: Umair Khan > >> --- > >> libavcodec/Makefile | 2 +- > >> libavcodec/alsdec.c | 284 > >> +- > >> libavcodec/mlz.c | 171 + > >> libavcodec/mlz.h | 69 ++ > >> libavutil/softfloat_ieee754.h | 115 + > > > > missing update to Changelog > > What do you mean by this? theres a Changelog file in git, one line could be added to it for the new feature [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Thu, Jul 21, 2016 at 6:18 PM, Michael Niedermayerwrote: > On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: >> Hi, >> >> Patch attached. >> >> - Umair > >> libavcodec/Makefile |2 >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + >> 5 files changed, 638 insertions(+), 3 deletions(-) >> 0282267108d74681f1bff6b5e6a85c603ac7052e >> 0001-avcodec-alsdec-implement-floating-point-decoding.patch >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 >> From: Umair Khan >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> >> It conforms to RM22 version of the reference codec. >> >> Signed-off-by: Umair Khan >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + > > missing update to Changelog What do you mean by this? > [...] >> @@ -1356,6 +1366,237 @@ static int revert_channel_correlation(ALSDecContext >> *ctx, ALSBlockData *bd, >> } >> >> >> +/** multiply two softfloats and handle the rounding off >> + */ >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) >> { >> +uint64_t mantissa_temp; >> +uint64_t mask_64; >> +int bit_count; >> +int cutoff_bit_count; >> +unsigned char last_2_bits; >> +unsigned int mantissa; >> +uint32_t return_val = 0; >> +int32_t sign; >> + >> +sign = a.sign ^ b.sign; >> + >> +// Multiply mantissa bits in a 64-bit register >> +mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant; >> + >> +// Count the valid bit count > >> +for (bit_count=48, mask_64=(uint64_t)0x1 << 47; !(mantissa_temp & >> mask_64) && mask_64; bit_count--, mask_64>>=1); > > this needs some newlines for readability > > >> + >> +// Round off >> +cutoff_bit_count = bit_count - 24; >> +if (cutoff_bit_count > 0) { >> +last_2_bits = (unsigned char)(((unsigned int)mantissa_temp >> >> (cutoff_bit_count - 1)) & 0x3 ); >> +if ((last_2_bits == 0x3) || ((last_2_bits == 0x1) && ((unsigned >> int)mantissa_temp & ((0x1UL << (cutoff_bit_count - 1)) - 1 { >> +// Need to round up >> +mantissa_temp += (uint64_t)0x1 << cutoff_bit_count; >> +} >> +} >> + >> +mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count); >> + >> +// Need one more shift? >> +if (mantissa & 0x0100ul) { >> +bit_count++; >> +mantissa >>= 1; >> +} >> + >> +if (!sign) { >> +return_val = 0x8000U; >> +} >> + >> +return_val |= (a.exp + b.exp + bit_count - 47) << 23; >> +return_val |= mantissa; >> +return av_bits2sf_ieee754(return_val); >> +} >> + >> + >> +/** Read and decode the floating point sample data >> + */ >> +static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { >> +AVCodecContext *avctx = ctx->avctx; >> +GetBitContext *gb = >gb; >> +SoftFloat_IEEE754 *acf = ctx->acf; >> +int *shift_value= ctx->shift_value; >> +int *last_shift_value = ctx->last_shift_value; >> +int *last_acf_mantissa = ctx->last_acf_mantissa; >> +int **raw_mantissa = ctx->raw_mantissa; >> +int *nbits = ctx->nbits; >> +unsigned char *larray = ctx->larray; >> +int frame_length= ctx->cur_frame_length; >> +SoftFloat_IEEE754 scale = av_int2sf_ieee754(0x1u, 23); >> +unsigned int partA_flag; >> +unsigned int highest_byte; >> +unsigned int shift_amp; >> +uint32_t tmp_32; >> +int use_acf; >> +int nchars; >> +int i; >> +int c; >> +long k; >> +long nbits_aligned; >> +unsigned long acc; >> +unsigned long j; >> +uint32_t sign; >> +uint32_t e; >> +uint32_t mantissa; >> + >> +skip_bits_long(gb, 32); //num_bytes_diff_float >> +use_acf = get_bits1(gb); >> + >> +if (ra_frame) { > >> +for (c = 0; c < avctx->channels; ++c) { >> +last_acf_mantissa[c] = 0; >> +last_shift_value[c] = 0; >> +} > > memset() > > >> +ff_mlz_flush_dict(ctx->mlz); >> +} >> + >> +for (c = 0; c < avctx->channels; ++c) { >> +if (use_acf) { >> +//acf_flag >> +if (get_bits1(gb)) { >> +tmp_32 = get_bits(gb, 23); >> +last_acf_mantissa[c] = tmp_32; >> +} else { >> +tmp_32 = last_acf_mantissa[c]; >> +} >> +acf[c] =
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Sun, Jul 17, 2016 at 12:06:03AM +0530, Umair Khan wrote: > Hi, > > Patch attached. > > - Umair > libavcodec/Makefile |2 > libavcodec/alsdec.c | 284 > +- > libavcodec/mlz.c | 171 + > libavcodec/mlz.h | 69 ++ > libavutil/softfloat_ieee754.h | 115 + > 5 files changed, 638 insertions(+), 3 deletions(-) > 0282267108d74681f1bff6b5e6a85c603ac7052e > 0001-avcodec-alsdec-implement-floating-point-decoding.patch > From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 > From: Umair Khan> Date: Sat, 16 Jul 2016 23:52:39 +0530 > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > > It conforms to RM22 version of the reference codec. > > Signed-off-by: Umair Khan > --- > libavcodec/Makefile | 2 +- > libavcodec/alsdec.c | 284 > +- > libavcodec/mlz.c | 171 + > libavcodec/mlz.h | 69 ++ > libavutil/softfloat_ieee754.h | 115 + missing update to Changelog [...] > @@ -1356,6 +1366,237 @@ static int revert_channel_correlation(ALSDecContext > *ctx, ALSBlockData *bd, > } > > > +/** multiply two softfloats and handle the rounding off > + */ > +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { > +uint64_t mantissa_temp; > +uint64_t mask_64; > +int bit_count; > +int cutoff_bit_count; > +unsigned char last_2_bits; > +unsigned int mantissa; > +uint32_t return_val = 0; > +int32_t sign; > + > +sign = a.sign ^ b.sign; > + > +// Multiply mantissa bits in a 64-bit register > +mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant; > + > +// Count the valid bit count > +for (bit_count=48, mask_64=(uint64_t)0x1 << 47; !(mantissa_temp & > mask_64) && mask_64; bit_count--, mask_64>>=1); this needs some newlines for readability > + > +// Round off > +cutoff_bit_count = bit_count - 24; > +if (cutoff_bit_count > 0) { > +last_2_bits = (unsigned char)(((unsigned int)mantissa_temp >> > (cutoff_bit_count - 1)) & 0x3 ); > +if ((last_2_bits == 0x3) || ((last_2_bits == 0x1) && ((unsigned > int)mantissa_temp & ((0x1UL << (cutoff_bit_count - 1)) - 1 { > +// Need to round up > +mantissa_temp += (uint64_t)0x1 << cutoff_bit_count; > +} > +} > + > +mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count); > + > +// Need one more shift? > +if (mantissa & 0x0100ul) { > +bit_count++; > +mantissa >>= 1; > +} > + > +if (!sign) { > +return_val = 0x8000U; > +} > + > +return_val |= (a.exp + b.exp + bit_count - 47) << 23; > +return_val |= mantissa; > +return av_bits2sf_ieee754(return_val); > +} > + > + > +/** Read and decode the floating point sample data > + */ > +static int read_diff_float_data(ALSDecContext *ctx, unsigned int ra_frame) { > +AVCodecContext *avctx = ctx->avctx; > +GetBitContext *gb = >gb; > +SoftFloat_IEEE754 *acf = ctx->acf; > +int *shift_value= ctx->shift_value; > +int *last_shift_value = ctx->last_shift_value; > +int *last_acf_mantissa = ctx->last_acf_mantissa; > +int **raw_mantissa = ctx->raw_mantissa; > +int *nbits = ctx->nbits; > +unsigned char *larray = ctx->larray; > +int frame_length= ctx->cur_frame_length; > +SoftFloat_IEEE754 scale = av_int2sf_ieee754(0x1u, 23); > +unsigned int partA_flag; > +unsigned int highest_byte; > +unsigned int shift_amp; > +uint32_t tmp_32; > +int use_acf; > +int nchars; > +int i; > +int c; > +long k; > +long nbits_aligned; > +unsigned long acc; > +unsigned long j; > +uint32_t sign; > +uint32_t e; > +uint32_t mantissa; > + > +skip_bits_long(gb, 32); //num_bytes_diff_float > +use_acf = get_bits1(gb); > + > +if (ra_frame) { > +for (c = 0; c < avctx->channels; ++c) { > +last_acf_mantissa[c] = 0; > +last_shift_value[c] = 0; > +} memset() > +ff_mlz_flush_dict(ctx->mlz); > +} > + > +for (c = 0; c < avctx->channels; ++c) { > +if (use_acf) { > +//acf_flag > +if (get_bits1(gb)) { > +tmp_32 = get_bits(gb, 23); > +last_acf_mantissa[c] = tmp_32; > +} else { > +tmp_32 = last_acf_mantissa[c]; > +} > +acf[c] = av_bits2sf_ieee754(tmp_32); > +} else { > +acf[c] = FLOAT_1; > +} > + > +highest_byte = get_bits(gb, 2); > +partA_flag = get_bits1(gb); > +shift_amp= get_bits1(gb); > + > +if (shift_amp) { > +shift_value[c] =
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 21.07.16 um 04:17 schrieb Umair Khan: > On Tue, Jul 19, 2016 at 11:17 PM, Umair Khanwrote: >> >> Updated patch. >> >> On Tue, Jul 19, 2016 at 8:19 PM, Thilo Borgmann >> wrote: >>> Am 19.07.16 um 15:42 schrieb Umair Khan: On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmann wrote: > Am 19.07.16 um 09:22 schrieb Umair Khan: >> On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol wrote: >>> >>> On 7/19/16, Umair Khan wrote: On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer wrote: > On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: >> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >> wrote: >>> On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > Hi, > > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann > wrote: >> Hi, >> >>> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 >>> 00:00:00 >>> 2001 >>> From: Umair Khan >>> Date: Sat, 16 Jul 2016 23:52:39 +0530 >>> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point >>> decoding >>> >>> It conforms to RM22 version of the reference codec. >>> >>> Signed-off-by: Umair Khan >>> --- >>> libavcodec/Makefile | 2 +- >>> libavcodec/alsdec.c | 284 >>> +- >>> libavcodec/mlz.c | 171 + >>> libavcodec/mlz.h | 69 ++ >>> libavutil/softfloat_ieee754.h | 115 + >>> 5 files changed, 638 insertions(+), 3 deletions(-) >>> create mode 100644 libavcodec/mlz.c >>> create mode 100644 libavcodec/mlz.h >>> create mode 100644 libavutil/softfloat_ieee754.h >>> >>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >>> index abef19e..a03adf5 100644 >>> --- a/libavcodec/Makefile >>> +++ b/libavcodec/Makefile >>> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= >>> alac.o alac_data.o alacdsp.o >>> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >>> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >>> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >>> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o >>> mpeg4audio.o >>> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >>> mpeg4audio.o >>> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o >>> celp_filters.o \ >>>celp_math.o >>> acelp_filters.o \ >>>acelp_vectors.o >>> \ >>> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >>> index a7e58a2..c710fc3 100644 >>> --- a/libavcodec/alsdec.c >>> +++ b/libavcodec/alsdec.c >>> @@ -35,8 +35,11 @@ >>> [...] >>> >>> +/** multiply two softfloats and handle the rounding off >>> + */ >>> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >>> SoftFloat_IEEE754 b) { >>> [...] >> >> Why is this in alsdec.c? > > This is not the actual IEEE 754 multiplication. It is as is > mentioned > in the reference spec. > The typical one for 754 floats, I've implemented here separately - > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > >> [...] >> >>> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >>> new file mode 100644 >>> index 000..cb2ed6a >>> --- /dev/null >>> +++ b/libavcodec/mlz.c >>> [...] >> >>> +static int input_code(GetBitContext* gb, int len) { >>> +int tmp_code = 0; >>> +int i; >>> +for (i = 0; i < len; ++i) { >>> +tmp_code += get_bits1(gb) << i; > |= > should be better. > >>> +} >>> +return tmp_code;
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Tue, Jul 19, 2016 at 11:17 PM, Umair Khanwrote: > > Updated patch. > > On Tue, Jul 19, 2016 at 8:19 PM, Thilo Borgmann > wrote: > > Am 19.07.16 um 15:42 schrieb Umair Khan: > >> On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmann > >> wrote: > >>> Am 19.07.16 um 09:22 schrieb Umair Khan: > On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol wrote: > > > > On 7/19/16, Umair Khan wrote: > >> On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer > >> wrote: > >>> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: > On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer > wrote: > > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: > >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > >>> Hi, > >>> > >>> On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann > >>> wrote: > Hi, > > > From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 > > 00:00:00 > > 2001 > > From: Umair Khan > > Date: Sat, 16 Jul 2016 23:52:39 +0530 > > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point > > decoding > > > > It conforms to RM22 version of the reference codec. > > > > Signed-off-by: Umair Khan > > --- > > libavcodec/Makefile | 2 +- > > libavcodec/alsdec.c | 284 > > +- > > libavcodec/mlz.c | 171 + > > libavcodec/mlz.h | 69 ++ > > libavutil/softfloat_ieee754.h | 115 + > > 5 files changed, 638 insertions(+), 3 deletions(-) > > create mode 100644 libavcodec/mlz.c > > create mode 100644 libavcodec/mlz.h > > create mode 100644 libavutil/softfloat_ieee754.h > > > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > > index abef19e..a03adf5 100644 > > --- a/libavcodec/Makefile > > +++ b/libavcodec/Makefile > > @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= > > alac.o alac_data.o alacdsp.o > > OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > > OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > > OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > > -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o > > mpeg4audio.o > > +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o > > mpeg4audio.o > > OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o > > celp_filters.o \ > >celp_math.o > > acelp_filters.o \ > >acelp_vectors.o > > \ > > diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > > index a7e58a2..c710fc3 100644 > > --- a/libavcodec/alsdec.c > > +++ b/libavcodec/alsdec.c > > @@ -35,8 +35,11 @@ > > [...] > > > > +/** multiply two softfloats and handle the rounding off > > + */ > > +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, > > SoftFloat_IEEE754 b) { > > [...] > > Why is this in alsdec.c? > >>> > >>> This is not the actual IEEE 754 multiplication. It is as is > >>> mentioned > >>> in the reference spec. > >>> The typical one for 754 floats, I've implemented here separately - > >>> https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > >>> > [...] > > > diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > > new file mode 100644 > > index 000..cb2ed6a > > --- /dev/null > > +++ b/libavcodec/mlz.c > > [...] > > > +static int input_code(GetBitContext* gb, int len) { > > +int tmp_code = 0; > > +int i; > > +for (i = 0; i < len; ++i) { > > +tmp_code += get_bits1(gb) << i; > >>> |= > >>> should be better. > >>> > > +} > > +return tmp_code; > > +} > >>> > >>> Also, you could revert it
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Updated patch. On Tue, Jul 19, 2016 at 8:19 PM, Thilo Borgmannwrote: > Am 19.07.16 um 15:42 schrieb Umair Khan: >> On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmann >> wrote: >>> Am 19.07.16 um 09:22 schrieb Umair Khan: On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol wrote: > > On 7/19/16, Umair Khan wrote: >> On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer >> wrote: >>> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer wrote: > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: >>> Hi, >>> >>> On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann >>> wrote: Hi, > From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 > 2001 > From: Umair Khan > Date: Sat, 16 Jul 2016 23:52:39 +0530 > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point > decoding > > It conforms to RM22 version of the reference codec. > > Signed-off-by: Umair Khan > --- > libavcodec/Makefile | 2 +- > libavcodec/alsdec.c | 284 > +- > libavcodec/mlz.c | 171 + > libavcodec/mlz.h | 69 ++ > libavutil/softfloat_ieee754.h | 115 + > 5 files changed, 638 insertions(+), 3 deletions(-) > create mode 100644 libavcodec/mlz.c > create mode 100644 libavcodec/mlz.h > create mode 100644 libavutil/softfloat_ieee754.h > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index abef19e..a03adf5 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= > alac.o alac_data.o alacdsp.o > OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o > mpeg4audio.o > +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o > mpeg4audio.o > OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o > celp_filters.o \ >celp_math.o > acelp_filters.o \ >acelp_vectors.o > \ > diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > index a7e58a2..c710fc3 100644 > --- a/libavcodec/alsdec.c > +++ b/libavcodec/alsdec.c > @@ -35,8 +35,11 @@ > [...] > > +/** multiply two softfloats and handle the rounding off > + */ > +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, > SoftFloat_IEEE754 b) { > [...] Why is this in alsdec.c? >>> >>> This is not the actual IEEE 754 multiplication. It is as is >>> mentioned >>> in the reference spec. >>> The typical one for 754 floats, I've implemented here separately - >>> https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 >>> [...] > diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > new file mode 100644 > index 000..cb2ed6a > --- /dev/null > +++ b/libavcodec/mlz.c > [...] > +static int input_code(GetBitContext* gb, int len) { > +int tmp_code = 0; > +int i; > +for (i = 0; i < len; ++i) { > +tmp_code += get_bits1(gb) << i; >>> |= >>> should be better. >>> > +} > +return tmp_code; > +} >>> >>> Also, you could revert it byte-wise using ff_revert[]... if len is often >>> bigger >>> than 8 that might be worth it. >> >> I didn't get you. > > tmp_code |= get_bits1(gb) << i; > > >> I tried logging that variable and len is always greater than 8. So >> what should we go with? >> It was 9 or 10 for the file I ran. And going with the
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 19.07.16 um 15:42 schrieb Umair Khan: > On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmann> wrote: >> Am 19.07.16 um 09:22 schrieb Umair Khan: >>> On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol wrote: On 7/19/16, Umair Khan wrote: > On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer > wrote: >> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: >>> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >>> wrote: On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: > On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: >> Hi, >> >> On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann >> wrote: >>> Hi, >>> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Sat, 16 Jul 2016 23:52:39 +0530 Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding It conforms to RM22 version of the reference codec. Signed-off-by: Umair Khan --- libavcodec/Makefile | 2 +- libavcodec/alsdec.c | 284 +- libavcodec/mlz.c | 171 + libavcodec/mlz.h | 69 ++ libavutil/softfloat_ieee754.h | 115 + 5 files changed, 638 insertions(+), 3 deletions(-) create mode 100644 libavcodec/mlz.c create mode 100644 libavcodec/mlz.h create mode 100644 libavutil/softfloat_ieee754.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..a03adf5 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o alac_data.o alacdsp.o OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ celp_math.o acelp_filters.o \ acelp_vectors.o \ diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index a7e58a2..c710fc3 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -35,8 +35,11 @@ [...] +/** multiply two softfloats and handle the rounding off + */ +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { [...] >>> >>> Why is this in alsdec.c? >> >> This is not the actual IEEE 754 multiplication. It is as is >> mentioned >> in the reference spec. >> The typical one for 754 floats, I've implemented here separately - >> https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 >> >>> [...] >>> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c new file mode 100644 index 000..cb2ed6a --- /dev/null +++ b/libavcodec/mlz.c [...] >>> +static int input_code(GetBitContext* gb, int len) { +int tmp_code = 0; +int i; +for (i = 0; i < len; ++i) { +tmp_code += get_bits1(gb) << i; >> |= >> should be better. >> +} +return tmp_code; +} >> >> Also, you could revert it byte-wise using ff_revert[]... if len is often >> bigger >> than 8 that might be worth it. > > I didn't get you. tmp_code |= get_bits1(gb) << i; > I tried logging that variable and len is always greater than 8. So > what should we go with? > It was 9 or 10 for the file I ran. And going with the logic of lzw, it > will hardly be greater than 11 ever. I think it would not benefit enough from ff_reverse then. Keep the loop. -Thilo ___ ffmpeg-devel mailing list
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Tue, Jul 19, 2016 at 5:20 PM, Thilo Borgmannwrote: > Am 19.07.16 um 09:22 schrieb Umair Khan: >> On Tue, Jul 19, 2016 at 12:29 PM, Paul B Mahol wrote: >>> >>> On 7/19/16, Umair Khan wrote: On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer wrote: > On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: >> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >> wrote: >>> On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > Hi, > > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann > wrote: >> Hi, >> >>> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 >>> 2001 >>> From: Umair Khan >>> Date: Sat, 16 Jul 2016 23:52:39 +0530 >>> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point >>> decoding >>> >>> It conforms to RM22 version of the reference codec. >>> >>> Signed-off-by: Umair Khan >>> --- >>> libavcodec/Makefile | 2 +- >>> libavcodec/alsdec.c | 284 >>> +- >>> libavcodec/mlz.c | 171 + >>> libavcodec/mlz.h | 69 ++ >>> libavutil/softfloat_ieee754.h | 115 + >>> 5 files changed, 638 insertions(+), 3 deletions(-) >>> create mode 100644 libavcodec/mlz.c >>> create mode 100644 libavcodec/mlz.h >>> create mode 100644 libavutil/softfloat_ieee754.h >>> >>> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >>> index abef19e..a03adf5 100644 >>> --- a/libavcodec/Makefile >>> +++ b/libavcodec/Makefile >>> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= >>> alac.o alac_data.o alacdsp.o >>> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >>> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >>> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >>> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o >>> mpeg4audio.o >>> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >>> mpeg4audio.o >>> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o >>> celp_filters.o \ >>>celp_math.o >>> acelp_filters.o \ >>>acelp_vectors.o >>> \ >>> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >>> index a7e58a2..c710fc3 100644 >>> --- a/libavcodec/alsdec.c >>> +++ b/libavcodec/alsdec.c >>> @@ -35,8 +35,11 @@ >>> [...] >>> >>> +/** multiply two softfloats and handle the rounding off >>> + */ >>> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >>> SoftFloat_IEEE754 b) { >>> [...] >> >> Why is this in alsdec.c? > > This is not the actual IEEE 754 multiplication. It is as is > mentioned > in the reference spec. > The typical one for 754 floats, I've implemented here separately - > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > >> [...] >> >>> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >>> new file mode 100644 >>> index 000..cb2ed6a >>> --- /dev/null >>> +++ b/libavcodec/mlz.c >>> [...] >> >>> +static int input_code(GetBitContext* gb, int len) { >>> +int tmp_code = 0; >>> +int i; >>> +for (i = 0; i < len; ++i) { >>> +tmp_code += get_bits1(gb) << i; > |= > should be better. > >>> +} >>> +return tmp_code; >>> +} > > Also, you could revert it byte-wise using ff_revert[]... if len is often > bigger > than 8 that might be worth it. I didn't get you. I tried logging that variable and len is always greater than 8. So what should we go with? It was 9 or 10 for the file I ran. And going with the logic of lzw, it will hardly be greater than 11 ever. -Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 19.07.16 um 09:22 schrieb Umair Khan: > On Tue, Jul 19, 2016 at 12:29 PM, Paul B Maholwrote: >> >> On 7/19/16, Umair Khan wrote: >>> On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer >>> wrote: On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: > On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer > wrote: >> On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >>> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: Hi, On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann wrote: > Hi, > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 >> 2001 >> From: Umair Khan >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point >> decoding >> >> It conforms to RM22 version of the reference codec. >> >> Signed-off-by: Umair Khan >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + >> 5 files changed, 638 insertions(+), 3 deletions(-) >> create mode 100644 libavcodec/mlz.c >> create mode 100644 libavcodec/mlz.h >> create mode 100644 libavutil/softfloat_ieee754.h >> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index abef19e..a03adf5 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= >> alac.o alac_data.o alacdsp.o >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o >> mpeg4audio.o >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >> mpeg4audio.o >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o >> celp_filters.o \ >>celp_math.o >> acelp_filters.o \ >>acelp_vectors.o >> \ >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >> index a7e58a2..c710fc3 100644 >> --- a/libavcodec/alsdec.c >> +++ b/libavcodec/alsdec.c >> @@ -35,8 +35,11 @@ >> [...] >> >> +/** multiply two softfloats and handle the rounding off >> + */ >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >> SoftFloat_IEEE754 b) { >> [...] > > Why is this in alsdec.c? This is not the actual IEEE 754 multiplication. It is as is mentioned in the reference spec. The typical one for 754 floats, I've implemented here separately - https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > [...] > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >> new file mode 100644 >> index 000..cb2ed6a >> --- /dev/null >> +++ b/libavcodec/mlz.c >> [...] > >> +static int input_code(GetBitContext* gb, int len) { >> +int tmp_code = 0; >> +int i; >> +for (i = 0; i < len; ++i) { >> +tmp_code += get_bits1(gb) << i; |= should be better. >> +} >> +return tmp_code; >> +} Also, you could revert it byte-wise using ff_revert[]... if len is often bigger than 8 that might be worth it. -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Tue, Jul 19, 2016 at 12:29 PM, Paul B Maholwrote: > > On 7/19/16, Umair Khan wrote: > > On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer > > wrote: > >> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: > >>> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer > >>> wrote: > >>> > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: > >>> >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > >>> >> > Hi, > >>> >> > > >>> >> > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann > >>> >> > wrote: > >>> >> > > Hi, > >>> >> > > > >>> >> > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 > >>> >> > >> 2001 > >>> >> > >> From: Umair Khan > >>> >> > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 > >>> >> > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point > >>> >> > >> decoding > >>> >> > >> > >>> >> > >> It conforms to RM22 version of the reference codec. > >>> >> > >> > >>> >> > >> Signed-off-by: Umair Khan > >>> >> > >> --- > >>> >> > >> libavcodec/Makefile | 2 +- > >>> >> > >> libavcodec/alsdec.c | 284 > >>> >> > >> +- > >>> >> > >> libavcodec/mlz.c | 171 + > >>> >> > >> libavcodec/mlz.h | 69 ++ > >>> >> > >> libavutil/softfloat_ieee754.h | 115 + > >>> >> > >> 5 files changed, 638 insertions(+), 3 deletions(-) > >>> >> > >> create mode 100644 libavcodec/mlz.c > >>> >> > >> create mode 100644 libavcodec/mlz.h > >>> >> > >> create mode 100644 libavutil/softfloat_ieee754.h > >>> >> > >> > >>> >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile > >>> >> > >> index abef19e..a03adf5 100644 > >>> >> > >> --- a/libavcodec/Makefile > >>> >> > >> +++ b/libavcodec/Makefile > >>> >> > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= > >>> >> > >> alac.o alac_data.o alacdsp.o > >>> >> > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > >>> >> > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > >>> >> > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > >>> >> > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o > >>> >> > >> mpeg4audio.o > >>> >> > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o > >>> >> > >> mpeg4audio.o > >>> >> > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o > >>> >> > >> celp_filters.o \ > >>> >> > >>celp_math.o > >>> >> > >> acelp_filters.o \ > >>> >> > >>acelp_vectors.o > >>> >> > >> \ > >>> >> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > >>> >> > >> index a7e58a2..c710fc3 100644 > >>> >> > >> --- a/libavcodec/alsdec.c > >>> >> > >> +++ b/libavcodec/alsdec.c > >>> >> > >> @@ -35,8 +35,11 @@ > >>> >> > >> [...] > >>> >> > >> > >>> >> > >> +/** multiply two softfloats and handle the rounding off > >>> >> > >> + */ > >>> >> > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, > >>> >> > >> SoftFloat_IEEE754 b) { > >>> >> > >> [...] > >>> >> > > > >>> >> > > Why is this in alsdec.c? > >>> >> > > >>> >> > This is not the actual IEEE 754 multiplication. It is as is > >>> >> > mentioned > >>> >> > in the reference spec. > >>> >> > The typical one for 754 floats, I've implemented here separately - > >>> >> > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > >>> >> > > >>> >> > > [...] > >>> >> > > > >>> >> > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > >>> >> > >> new file mode 100644 > >>> >> > >> index 000..cb2ed6a > >>> >> > >> --- /dev/null > >>> >> > >> +++ b/libavcodec/mlz.c > >>> >> > >> [...] > >>> >> > > > >>> >> > >> +static int input_code(GetBitContext* gb, int len) { > >>> >> > >> +int tmp_code = 0; > >>> >> > >> +int i; > >>> >> > >> +for (i = 0; i < len; ++i) { > >>> >> > >> +tmp_code += get_bits1(gb) << i; > >>> >> > >> +} > >>> >> > >> +return tmp_code; > >>> >> > >> +} > >>> >> > > > >>> >> > > Is there nothing in get_bits.h that solves that already? > >>> >> > > > >>> >> > > -Thilo > >>> >> > > >>> >> > I'm not sure. It is just reading the bits in the reverse order. May > >>> >> > be > >>> >> > someone else can help. > >>> >> > >>> >> theres asv2_get_bits() > >>> >> if it works here it could be shared > >>> > > >>> > note though asv2_get_bits() is maximum 8 bits, for more bits more > >>> > table lookups or a bigger table is needed > >>> > >>> What should be the best way to use this function? It is not present in > >>> any header file. > >> > >> it could be moved into a header and made static inlinw with a more > >> generic name. > >> That is if it works ... > > > > I did this
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On 7/19/16, Umair Khanwrote: > On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayer > wrote: >> On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: >>> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >>> wrote: >>> > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >>> >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: >>> >> > Hi, >>> >> > >>> >> > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann >>> >> > wrote: >>> >> > > Hi, >>> >> > > >>> >> > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 >>> >> > >> 2001 >>> >> > >> From: Umair Khan >>> >> > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >>> >> > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point >>> >> > >> decoding >>> >> > >> >>> >> > >> It conforms to RM22 version of the reference codec. >>> >> > >> >>> >> > >> Signed-off-by: Umair Khan >>> >> > >> --- >>> >> > >> libavcodec/Makefile | 2 +- >>> >> > >> libavcodec/alsdec.c | 284 >>> >> > >> +- >>> >> > >> libavcodec/mlz.c | 171 + >>> >> > >> libavcodec/mlz.h | 69 ++ >>> >> > >> libavutil/softfloat_ieee754.h | 115 + >>> >> > >> 5 files changed, 638 insertions(+), 3 deletions(-) >>> >> > >> create mode 100644 libavcodec/mlz.c >>> >> > >> create mode 100644 libavcodec/mlz.h >>> >> > >> create mode 100644 libavutil/softfloat_ieee754.h >>> >> > >> >>> >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >>> >> > >> index abef19e..a03adf5 100644 >>> >> > >> --- a/libavcodec/Makefile >>> >> > >> +++ b/libavcodec/Makefile >>> >> > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= >>> >> > >> alac.o alac_data.o alacdsp.o >>> >> > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >>> >> > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >>> >> > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >>> >> > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o >>> >> > >> mpeg4audio.o >>> >> > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >>> >> > >> mpeg4audio.o >>> >> > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o >>> >> > >> celp_filters.o \ >>> >> > >>celp_math.o >>> >> > >> acelp_filters.o \ >>> >> > >>acelp_vectors.o >>> >> > >> \ >>> >> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >>> >> > >> index a7e58a2..c710fc3 100644 >>> >> > >> --- a/libavcodec/alsdec.c >>> >> > >> +++ b/libavcodec/alsdec.c >>> >> > >> @@ -35,8 +35,11 @@ >>> >> > >> [...] >>> >> > >> >>> >> > >> +/** multiply two softfloats and handle the rounding off >>> >> > >> + */ >>> >> > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >>> >> > >> SoftFloat_IEEE754 b) { >>> >> > >> [...] >>> >> > > >>> >> > > Why is this in alsdec.c? >>> >> > >>> >> > This is not the actual IEEE 754 multiplication. It is as is >>> >> > mentioned >>> >> > in the reference spec. >>> >> > The typical one for 754 floats, I've implemented here separately - >>> >> > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 >>> >> > >>> >> > > [...] >>> >> > > >>> >> > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >>> >> > >> new file mode 100644 >>> >> > >> index 000..cb2ed6a >>> >> > >> --- /dev/null >>> >> > >> +++ b/libavcodec/mlz.c >>> >> > >> [...] >>> >> > > >>> >> > >> +static int input_code(GetBitContext* gb, int len) { >>> >> > >> +int tmp_code = 0; >>> >> > >> +int i; >>> >> > >> +for (i = 0; i < len; ++i) { >>> >> > >> +tmp_code += get_bits1(gb) << i; >>> >> > >> +} >>> >> > >> +return tmp_code; >>> >> > >> +} >>> >> > > >>> >> > > Is there nothing in get_bits.h that solves that already? >>> >> > > >>> >> > > -Thilo >>> >> > >>> >> > I'm not sure. It is just reading the bits in the reverse order. May >>> >> > be >>> >> > someone else can help. >>> >> >>> >> theres asv2_get_bits() >>> >> if it works here it could be shared >>> > >>> > note though asv2_get_bits() is maximum 8 bits, for more bits more >>> > table lookups or a bigger table is needed >>> >>> What should be the best way to use this function? It is not present in >>> any header file. >> >> it could be moved into a header and made static inlinw with a more >> generic name. >> That is if it works ... > > I did this for now and it doesn't seem to read the reversed bits properly. > https://github.com/omerjerk/FFmpeg/commit/c58bdd74518444022c753e24d8048e2fd9febd72 > > No idea what's wrong. If it was reversing the bits properly, this code > should've worked I guess. Because it is wrong, use what you had before. > >
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Tue, Jul 19, 2016 at 3:08 AM, Michael Niedermayerwrote: > On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: >> On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >> wrote: >> > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >> >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: >> >> > Hi, >> >> > >> >> > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann >> >> > wrote: >> >> > > Hi, >> >> > > >> >> > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 >> >> > >> 2001 >> >> > >> From: Umair Khan >> >> > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> >> > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point >> >> > >> decoding >> >> > >> >> >> > >> It conforms to RM22 version of the reference codec. >> >> > >> >> >> > >> Signed-off-by: Umair Khan >> >> > >> --- >> >> > >> libavcodec/Makefile | 2 +- >> >> > >> libavcodec/alsdec.c | 284 >> >> > >> +- >> >> > >> libavcodec/mlz.c | 171 + >> >> > >> libavcodec/mlz.h | 69 ++ >> >> > >> libavutil/softfloat_ieee754.h | 115 + >> >> > >> 5 files changed, 638 insertions(+), 3 deletions(-) >> >> > >> create mode 100644 libavcodec/mlz.c >> >> > >> create mode 100644 libavcodec/mlz.h >> >> > >> create mode 100644 libavutil/softfloat_ieee754.h >> >> > >> >> >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> >> > >> index abef19e..a03adf5 100644 >> >> > >> --- a/libavcodec/Makefile >> >> > >> +++ b/libavcodec/Makefile >> >> > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o >> >> > >> alac_data.o alacdsp.o >> >> > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >> >> > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >> >> > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >> >> > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o >> >> > >> mpeg4audio.o >> >> > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >> >> > >> mpeg4audio.o >> >> > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o >> >> > >> \ >> >> > >>celp_math.o >> >> > >> acelp_filters.o \ >> >> > >>acelp_vectors.o >> >> > >> \ >> >> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >> >> > >> index a7e58a2..c710fc3 100644 >> >> > >> --- a/libavcodec/alsdec.c >> >> > >> +++ b/libavcodec/alsdec.c >> >> > >> @@ -35,8 +35,11 @@ >> >> > >> [...] >> >> > >> >> >> > >> +/** multiply two softfloats and handle the rounding off >> >> > >> + */ >> >> > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >> >> > >> SoftFloat_IEEE754 b) { >> >> > >> [...] >> >> > > >> >> > > Why is this in alsdec.c? >> >> > >> >> > This is not the actual IEEE 754 multiplication. It is as is mentioned >> >> > in the reference spec. >> >> > The typical one for 754 floats, I've implemented here separately - >> >> > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 >> >> > >> >> > > [...] >> >> > > >> >> > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >> >> > >> new file mode 100644 >> >> > >> index 000..cb2ed6a >> >> > >> --- /dev/null >> >> > >> +++ b/libavcodec/mlz.c >> >> > >> [...] >> >> > > >> >> > >> +static int input_code(GetBitContext* gb, int len) { >> >> > >> +int tmp_code = 0; >> >> > >> +int i; >> >> > >> +for (i = 0; i < len; ++i) { >> >> > >> +tmp_code += get_bits1(gb) << i; >> >> > >> +} >> >> > >> +return tmp_code; >> >> > >> +} >> >> > > >> >> > > Is there nothing in get_bits.h that solves that already? >> >> > > >> >> > > -Thilo >> >> > >> >> > I'm not sure. It is just reading the bits in the reverse order. May be >> >> > someone else can help. >> >> >> >> theres asv2_get_bits() >> >> if it works here it could be shared >> > >> > note though asv2_get_bits() is maximum 8 bits, for more bits more >> > table lookups or a bigger table is needed >> >> What should be the best way to use this function? It is not present in >> any header file. > > it could be moved into a header and made static inlinw with a more > generic name. > That is if it works ... I did this for now and it doesn't seem to read the reversed bits properly. https://github.com/omerjerk/FFmpeg/commit/c58bdd74518444022c753e24d8048e2fd9febd72 No idea what's wrong. If it was reversing the bits properly, this code should've worked I guess. -Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Mon, Jul 18, 2016 at 11:42:48PM +0530, Umair Khan wrote: > On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >wrote: > > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: > >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > >> > Hi, > >> > > >> > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann > >> > wrote: > >> > > Hi, > >> > > > >> > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 > >> > >> From: Umair Khan > >> > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 > >> > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > >> > >> > >> > >> It conforms to RM22 version of the reference codec. > >> > >> > >> > >> Signed-off-by: Umair Khan > >> > >> --- > >> > >> libavcodec/Makefile | 2 +- > >> > >> libavcodec/alsdec.c | 284 > >> > >> +- > >> > >> libavcodec/mlz.c | 171 + > >> > >> libavcodec/mlz.h | 69 ++ > >> > >> libavutil/softfloat_ieee754.h | 115 + > >> > >> 5 files changed, 638 insertions(+), 3 deletions(-) > >> > >> create mode 100644 libavcodec/mlz.c > >> > >> create mode 100644 libavcodec/mlz.h > >> > >> create mode 100644 libavutil/softfloat_ieee754.h > >> > >> > >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile > >> > >> index abef19e..a03adf5 100644 > >> > >> --- a/libavcodec/Makefile > >> > >> +++ b/libavcodec/Makefile > >> > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o > >> > >> alac_data.o alacdsp.o > >> > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > >> > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > >> > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > >> > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o > >> > >> mpeg4audio.o > >> > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o > >> > >> mpeg4audio.o > >> > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o > >> > >> \ > >> > >>celp_math.o > >> > >> acelp_filters.o \ > >> > >>acelp_vectors.o > >> > >> \ > >> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > >> > >> index a7e58a2..c710fc3 100644 > >> > >> --- a/libavcodec/alsdec.c > >> > >> +++ b/libavcodec/alsdec.c > >> > >> @@ -35,8 +35,11 @@ > >> > >> [...] > >> > >> > >> > >> +/** multiply two softfloats and handle the rounding off > >> > >> + */ > >> > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, > >> > >> SoftFloat_IEEE754 b) { > >> > >> [...] > >> > > > >> > > Why is this in alsdec.c? > >> > > >> > This is not the actual IEEE 754 multiplication. It is as is mentioned > >> > in the reference spec. > >> > The typical one for 754 floats, I've implemented here separately - > >> > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > >> > > >> > > [...] > >> > > > >> > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > >> > >> new file mode 100644 > >> > >> index 000..cb2ed6a > >> > >> --- /dev/null > >> > >> +++ b/libavcodec/mlz.c > >> > >> [...] > >> > > > >> > >> +static int input_code(GetBitContext* gb, int len) { > >> > >> +int tmp_code = 0; > >> > >> +int i; > >> > >> +for (i = 0; i < len; ++i) { > >> > >> +tmp_code += get_bits1(gb) << i; > >> > >> +} > >> > >> +return tmp_code; > >> > >> +} > >> > > > >> > > Is there nothing in get_bits.h that solves that already? > >> > > > >> > > -Thilo > >> > > >> > I'm not sure. It is just reading the bits in the reverse order. May be > >> > someone else can help. > >> > >> theres asv2_get_bits() > >> if it works here it could be shared > > > > note though asv2_get_bits() is maximum 8 bits, for more bits more > > table lookups or a bigger table is needed > > What should be the best way to use this function? It is not present in > any header file. it could be moved into a header and made static inlinw with a more generic name. That is if it works ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Avoid a single point of failure, be that a person or equipment. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Am 18.07.16 um 20:12 schrieb Umair Khan: > On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayer >wrote: >> On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >>> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: Hi, On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann wrote: > Hi, > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 >> From: Umair Khan >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> >> It conforms to RM22 version of the reference codec. >> >> Signed-off-by: Umair Khan >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + >> 5 files changed, 638 insertions(+), 3 deletions(-) >> create mode 100644 libavcodec/mlz.c >> create mode 100644 libavcodec/mlz.h >> create mode 100644 libavutil/softfloat_ieee754.h >> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index abef19e..a03adf5 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o >> alac_data.o alacdsp.o >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >> mpeg4audio.o >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ >>celp_math.o acelp_filters.o \ >>acelp_vectors.o \ >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >> index a7e58a2..c710fc3 100644 >> --- a/libavcodec/alsdec.c >> +++ b/libavcodec/alsdec.c >> @@ -35,8 +35,11 @@ >> [...] >> >> +/** multiply two softfloats and handle the rounding off >> + */ >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >> SoftFloat_IEEE754 b) { >> [...] > > Why is this in alsdec.c? This is not the actual IEEE 754 multiplication. It is as is mentioned in the reference spec. The typical one for 754 floats, I've implemented here separately - https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > [...] > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >> new file mode 100644 >> index 000..cb2ed6a >> --- /dev/null >> +++ b/libavcodec/mlz.c >> [...] > >> +static int input_code(GetBitContext* gb, int len) { >> +int tmp_code = 0; >> +int i; >> +for (i = 0; i < len; ++i) { >> +tmp_code += get_bits1(gb) << i; >> +} >> +return tmp_code; >> +} > > Is there nothing in get_bits.h that solves that already? > > -Thilo I'm not sure. It is just reading the bits in the reverse order. May be someone else can help. >>> >>> theres asv2_get_bits() >>> if it works here it could be shared >> >> note though asv2_get_bits() is maximum 8 bits, for more bits more >> table lookups or a bigger table is needed > > What should be the best way to use this function? It is not present in > any header file. But in a .c file... -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Sun, Jul 17, 2016 at 3:38 PM, Michael Niedermayerwrote: > On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: >> On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: >> > Hi, >> > >> > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann >> > wrote: >> > > Hi, >> > > >> > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 >> > >> From: Umair Khan >> > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> > >> >> > >> It conforms to RM22 version of the reference codec. >> > >> >> > >> Signed-off-by: Umair Khan >> > >> --- >> > >> libavcodec/Makefile | 2 +- >> > >> libavcodec/alsdec.c | 284 >> > >> +- >> > >> libavcodec/mlz.c | 171 + >> > >> libavcodec/mlz.h | 69 ++ >> > >> libavutil/softfloat_ieee754.h | 115 + >> > >> 5 files changed, 638 insertions(+), 3 deletions(-) >> > >> create mode 100644 libavcodec/mlz.c >> > >> create mode 100644 libavcodec/mlz.h >> > >> create mode 100644 libavutil/softfloat_ieee754.h >> > >> >> > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> > >> index abef19e..a03adf5 100644 >> > >> --- a/libavcodec/Makefile >> > >> +++ b/libavcodec/Makefile >> > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o >> > >> alac_data.o alacdsp.o >> > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >> > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >> > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >> > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o >> > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o >> > >> mpeg4audio.o >> > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ >> > >>celp_math.o acelp_filters.o \ >> > >>acelp_vectors.o \ >> > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >> > >> index a7e58a2..c710fc3 100644 >> > >> --- a/libavcodec/alsdec.c >> > >> +++ b/libavcodec/alsdec.c >> > >> @@ -35,8 +35,11 @@ >> > >> [...] >> > >> >> > >> +/** multiply two softfloats and handle the rounding off >> > >> + */ >> > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, >> > >> SoftFloat_IEEE754 b) { >> > >> [...] >> > > >> > > Why is this in alsdec.c? >> > >> > This is not the actual IEEE 754 multiplication. It is as is mentioned >> > in the reference spec. >> > The typical one for 754 floats, I've implemented here separately - >> > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 >> > >> > > [...] >> > > >> > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >> > >> new file mode 100644 >> > >> index 000..cb2ed6a >> > >> --- /dev/null >> > >> +++ b/libavcodec/mlz.c >> > >> [...] >> > > >> > >> +static int input_code(GetBitContext* gb, int len) { >> > >> +int tmp_code = 0; >> > >> +int i; >> > >> +for (i = 0; i < len; ++i) { >> > >> +tmp_code += get_bits1(gb) << i; >> > >> +} >> > >> +return tmp_code; >> > >> +} >> > > >> > > Is there nothing in get_bits.h that solves that already? >> > > >> > > -Thilo >> > >> > I'm not sure. It is just reading the bits in the reverse order. May be >> > someone else can help. >> >> theres asv2_get_bits() >> if it works here it could be shared > > note though asv2_get_bits() is maximum 8 bits, for more bits more > table lookups or a bigger table is needed What should be the best way to use this function? It is not present in any header file. - Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
On Sun, Jul 17, 2016 at 11:54:49AM +0200, Michael Niedermayer wrote: > On Sun, Jul 17, 2016 at 09:00:48AM +0530, Umair Khan wrote: > > Hi, > > > > On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmann> > wrote: > > > Hi, > > > > > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 > > >> From: Umair Khan > > >> Date: Sat, 16 Jul 2016 23:52:39 +0530 > > >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > > >> > > >> It conforms to RM22 version of the reference codec. > > >> > > >> Signed-off-by: Umair Khan > > >> --- > > >> libavcodec/Makefile | 2 +- > > >> libavcodec/alsdec.c | 284 > > >> +- > > >> libavcodec/mlz.c | 171 + > > >> libavcodec/mlz.h | 69 ++ > > >> libavutil/softfloat_ieee754.h | 115 + > > >> 5 files changed, 638 insertions(+), 3 deletions(-) > > >> create mode 100644 libavcodec/mlz.c > > >> create mode 100644 libavcodec/mlz.h > > >> create mode 100644 libavutil/softfloat_ieee754.h > > >> > > >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile > > >> index abef19e..a03adf5 100644 > > >> --- a/libavcodec/Makefile > > >> +++ b/libavcodec/Makefile > > >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o > > >> alac_data.o alacdsp.o > > >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > > >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > > >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > > >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o > > >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o > > >> mpeg4audio.o > > >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ > > >>celp_math.o acelp_filters.o \ > > >>acelp_vectors.o \ > > >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > > >> index a7e58a2..c710fc3 100644 > > >> --- a/libavcodec/alsdec.c > > >> +++ b/libavcodec/alsdec.c > > >> @@ -35,8 +35,11 @@ > > >> [...] > > >> > > >> +/** multiply two softfloats and handle the rounding off > > >> + */ > > >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, > > >> SoftFloat_IEEE754 b) { > > >> [...] > > > > > > Why is this in alsdec.c? > > > > This is not the actual IEEE 754 multiplication. It is as is mentioned > > in the reference spec. > > The typical one for 754 floats, I've implemented here separately - > > https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > > > > > [...] > > > > > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > > >> new file mode 100644 > > >> index 000..cb2ed6a > > >> --- /dev/null > > >> +++ b/libavcodec/mlz.c > > >> [...] > > > > > >> +static int input_code(GetBitContext* gb, int len) { > > >> +int tmp_code = 0; > > >> +int i; > > >> +for (i = 0; i < len; ++i) { > > >> +tmp_code += get_bits1(gb) << i; > > >> +} > > >> +return tmp_code; > > >> +} > > > > > > Is there nothing in get_bits.h that solves that already? > > > > > > -Thilo > > > > I'm not sure. It is just reading the bits in the reverse order. May be > > someone else can help. > > theres asv2_get_bits() > if it works here it could be shared note though asv2_get_bits() is maximum 8 bits, for more bits more table lookups or a bigger table is needed [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, On Sun, Jul 17, 2016 at 12:25 AM, Thilo Borgmannwrote: > Hi, > >> From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 >> From: Umair Khan >> Date: Sat, 16 Jul 2016 23:52:39 +0530 >> Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding >> >> It conforms to RM22 version of the reference codec. >> >> Signed-off-by: Umair Khan >> --- >> libavcodec/Makefile | 2 +- >> libavcodec/alsdec.c | 284 >> +- >> libavcodec/mlz.c | 171 + >> libavcodec/mlz.h | 69 ++ >> libavutil/softfloat_ieee754.h | 115 + >> 5 files changed, 638 insertions(+), 3 deletions(-) >> create mode 100644 libavcodec/mlz.c >> create mode 100644 libavcodec/mlz.h >> create mode 100644 libavutil/softfloat_ieee754.h >> >> diff --git a/libavcodec/Makefile b/libavcodec/Makefile >> index abef19e..a03adf5 100644 >> --- a/libavcodec/Makefile >> +++ b/libavcodec/Makefile >> @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o >> alac_data.o alacdsp.o >> OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o >> OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o >> OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o >> -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o >> +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o >> OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ >>celp_math.o acelp_filters.o \ >>acelp_vectors.o \ >> diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c >> index a7e58a2..c710fc3 100644 >> --- a/libavcodec/alsdec.c >> +++ b/libavcodec/alsdec.c >> @@ -35,8 +35,11 @@ >> [...] >> >> +/** multiply two softfloats and handle the rounding off >> + */ >> +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) >> { >> [...] > > Why is this in alsdec.c? This is not the actual IEEE 754 multiplication. It is as is mentioned in the reference spec. The typical one for 754 floats, I've implemented here separately - https://github.com/omerjerk/FFmpeg/commit/d6cd4bf66b9da46dd87580d7d974ce44abdcfba2#diff-4dd4b2d8d523f336fbefa96e9252187cR93 > [...] > >> diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c >> new file mode 100644 >> index 000..cb2ed6a >> --- /dev/null >> +++ b/libavcodec/mlz.c >> [...] > >> +static int input_code(GetBitContext* gb, int len) { >> +int tmp_code = 0; >> +int i; >> +for (i = 0; i < len; ++i) { >> +tmp_code += get_bits1(gb) << i; >> +} >> +return tmp_code; >> +} > > Is there nothing in get_bits.h that solves that already? > > -Thilo I'm not sure. It is just reading the bits in the reverse order. May be someone else can help. -Umair ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, > From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 > From: Umair Khan> Date: Sat, 16 Jul 2016 23:52:39 +0530 > Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding > > It conforms to RM22 version of the reference codec. > > Signed-off-by: Umair Khan > --- > libavcodec/Makefile | 2 +- > libavcodec/alsdec.c | 284 > +- > libavcodec/mlz.c | 171 + > libavcodec/mlz.h | 69 ++ > libavutil/softfloat_ieee754.h | 115 + > 5 files changed, 638 insertions(+), 3 deletions(-) > create mode 100644 libavcodec/mlz.c > create mode 100644 libavcodec/mlz.h > create mode 100644 libavutil/softfloat_ieee754.h > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index abef19e..a03adf5 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o > alac_data.o alacdsp.o > OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o > OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o > OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o > -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o > +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o > OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ >celp_math.o acelp_filters.o \ >acelp_vectors.o \ > diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c > index a7e58a2..c710fc3 100644 > --- a/libavcodec/alsdec.c > +++ b/libavcodec/alsdec.c > @@ -35,8 +35,11 @@ > [...] > > +/** multiply two softfloats and handle the rounding off > + */ > +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { > [...] Why is this in alsdec.c? [...] > diff --git a/libavcodec/mlz.c b/libavcodec/mlz.c > new file mode 100644 > index 000..cb2ed6a > --- /dev/null > +++ b/libavcodec/mlz.c > [...] > +static int input_code(GetBitContext* gb, int len) { > +int tmp_code = 0; > +int i; > +for (i = 0; i < len; ++i) { > +tmp_code += get_bits1(gb) << i; > +} > +return tmp_code; > +} Is there nothing in get_bits.h that solves that already? -Thilo ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avcodec/alsdec: implement floating point decoding
Hi, Patch attached. - Umair From 70e65b26cc3f84c9c664c30808b43a5e1cf16eaa Mon Sep 17 00:00:00 2001 From: Umair KhanDate: Sat, 16 Jul 2016 23:52:39 +0530 Subject: [PATCH 1/1] avcodec/alsdec: implement floating point decoding It conforms to RM22 version of the reference codec. Signed-off-by: Umair Khan --- libavcodec/Makefile | 2 +- libavcodec/alsdec.c | 284 +- libavcodec/mlz.c | 171 + libavcodec/mlz.h | 69 ++ libavutil/softfloat_ieee754.h | 115 + 5 files changed, 638 insertions(+), 3 deletions(-) create mode 100644 libavcodec/mlz.c create mode 100644 libavcodec/mlz.h create mode 100644 libavutil/softfloat_ieee754.h diff --git a/libavcodec/Makefile b/libavcodec/Makefile index abef19e..a03adf5 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -163,7 +163,7 @@ OBJS-$(CONFIG_ALAC_DECODER)+= alac.o alac_data.o alacdsp.o OBJS-$(CONFIG_ALAC_ENCODER)+= alacenc.o alac_data.o OBJS-$(CONFIG_ALIAS_PIX_DECODER) += aliaspixdec.o OBJS-$(CONFIG_ALIAS_PIX_ENCODER) += aliaspixenc.o -OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mpeg4audio.o +OBJS-$(CONFIG_ALS_DECODER) += alsdec.o bgmc.o mlz.o mpeg4audio.o OBJS-$(CONFIG_AMRNB_DECODER) += amrnbdec.o celp_filters.o \ celp_math.o acelp_filters.o \ acelp_vectors.o \ diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index a7e58a2..c710fc3 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -35,8 +35,11 @@ #include "bgmc.h" #include "bswapdsp.h" #include "internal.h" +#include "mlz.h" #include "libavutil/samplefmt.h" #include "libavutil/crc.h" +#include "libavutil/softfloat_ieee754.h" +#include "libavutil/intfloat.h" #include @@ -225,6 +228,14 @@ typedef struct ALSDecContext { int32_t **raw_samples; ///< decoded raw samples for each channel int32_t *raw_buffer;///< contains all decoded raw samples including carryover samples uint8_t *crc_buffer;///< buffer of byte order corrected samples used for CRC check +MLZ* mlz; ///< masked lz decompression structure +SoftFloat_IEEE754 *acf; ///< contains common multiplier for all channels +int *last_acf_mantissa; ///< contains the last acf mantissa data of common multiplier for all channels +int *shift_value; ///< value by which the binary point is to be shifted for all channels +int *last_shift_value; ///< contains last shift value for all channels +int **raw_mantissa; ///< decoded mantissa bits of the difference signal +unsigned char *larray; ///< buffer to store the output of masked lz decompression +int *nbits; ///< contains the number of bits to read for masked lz decompression for all samples } ALSDecContext; @@ -441,7 +452,6 @@ static int check_specific_config(ALSDecContext *ctx) } \ } -MISSING_ERR(sconf->floating, "Floating point decoding", AVERROR_PATCHWELCOME); MISSING_ERR(sconf->rlslms,"Adaptive RLS-LMS prediction", AVERROR_PATCHWELCOME); return error; @@ -1356,6 +1366,237 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, } +/** multiply two softfloats and handle the rounding off + */ +static SoftFloat_IEEE754 multiply(SoftFloat_IEEE754 a, SoftFloat_IEEE754 b) { +uint64_t mantissa_temp; +uint64_t mask_64; +int bit_count; +int cutoff_bit_count; +unsigned char last_2_bits; +unsigned int mantissa; +uint32_t return_val = 0; +int32_t sign; + +sign = a.sign ^ b.sign; + +// Multiply mantissa bits in a 64-bit register +mantissa_temp = (uint64_t)a.mant * (uint64_t)b.mant; + +// Count the valid bit count +for (bit_count=48, mask_64=(uint64_t)0x1 << 47; !(mantissa_temp & mask_64) && mask_64; bit_count--, mask_64>>=1); + +// Round off +cutoff_bit_count = bit_count - 24; +if (cutoff_bit_count > 0) { +last_2_bits = (unsigned char)(((unsigned int)mantissa_temp >> (cutoff_bit_count - 1)) & 0x3 ); +if ((last_2_bits == 0x3) || ((last_2_bits == 0x1) && ((unsigned int)mantissa_temp & ((0x1UL << (cutoff_bit_count - 1)) - 1 { +// Need to round up +mantissa_temp += (uint64_t)0x1 << cutoff_bit_count; +} +} + +mantissa = (unsigned int)(mantissa_temp >> cutoff_bit_count); + +// Need one more shift? +if (mantissa & 0x0100ul) { +bit_count++; +mantissa >>= 1; +} + +if (!sign) { +return_val = 0x8000U; +} + +return_val |= (a.exp + b.exp + bit_count - 47) << 23; +return_val |=