Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
On Thu, Sep 6, 2018 at 11:34 AM Gagandeep Singh wrote: > > > On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer > wrote: > >> On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote: >> [...] >> > >> > > [...] >> > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, >> void >> > > *data, int *got_frame, >> > > > } >> > > > } >> > > > } >> > > > - >> > > > -if (!s->a_width || !s->a_height || s->a_format == >> AV_PIX_FMT_NONE || >> > > > -s->coded_width || s->coded_height || s->coded_format != >> > > AV_PIX_FMT_NONE) { >> > > >> > > > +//disabled to run mountain sample file >> > > > +#if 0 >> > > > +if ((!s->a_width || !s->a_height || s->a_format == >> AV_PIX_FMT_NONE >> > > || >> > > > +s->coded_width || s->coded_height || s->coded_format != >> > > AV_PIX_FMT_NONE) && s->sample_type != 1) { >> > > > av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n"); >> > > > ret = AVERROR(EINVAL); >> > > > goto end; >> > > > } >> > > > - >> > > > +#endif >> > > >> > > please elaborate why this needs to be disabled >> > > i presume this code was needed for something >> > > >> > I didn't need to disable this for any sample except one, where the image >> > height and width data wasn't transfered in accordance to how it was in >> the >> > rest of the sample so the flow of code was just causing the decoder to >> > crash. I can produce a more robust fix, though again will need to repost >> > other patches as well, please comment. >> > >> > > also this decoder with the patches should be tested with a fuzzer to >> > > reduce >> > > the chance of bugs >> > > >> > > I don't know how to use 'fuzzer', sorry, though i can look into that. >> >> had missed this reply as its not quoted correctly >> yes, please look into testing this with a fuzzer, we should make >> reasonable >> sure we dont add anomalies >> >> thx >> >> [...] >> -- >> 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 >> ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > Hi, > patch updated to add back the check. > The work around for the check is just to not to check for the coded_width == 0 and coded_height == 0 as these are used to set a_width and a_height during buffer allocation (which are also being checked for non zero values. coded_width and coded_height were later set to 0 for a loop exit (which has been taken care of in other way), and since i needed to update coded_width and coded_height with some other data in case they were not available in the sample(we have a sample for the same), thus it necessitates that the unneeded check be removed. Thanks Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
On Sat, Aug 18, 2018 at 1:47 AM Michael Niedermayer wrote: > On Fri, Aug 17, 2018 at 11:45:04AM +0530, Gagandeep Singh wrote: > [...] > > > > > [...] > > > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, > void > > > *data, int *got_frame, > > > > } > > > > } > > > > } > > > > - > > > > -if (!s->a_width || !s->a_height || s->a_format == > AV_PIX_FMT_NONE || > > > > -s->coded_width || s->coded_height || s->coded_format != > > > AV_PIX_FMT_NONE) { > > > > > > > +//disabled to run mountain sample file > > > > +#if 0 > > > > +if ((!s->a_width || !s->a_height || s->a_format == > AV_PIX_FMT_NONE > > > || > > > > +s->coded_width || s->coded_height || s->coded_format != > > > AV_PIX_FMT_NONE) && s->sample_type != 1) { > > > > av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n"); > > > > ret = AVERROR(EINVAL); > > > > goto end; > > > > } > > > > - > > > > +#endif > > > > > > please elaborate why this needs to be disabled > > > i presume this code was needed for something > > > > > I didn't need to disable this for any sample except one, where the image > > height and width data wasn't transfered in accordance to how it was in > the > > rest of the sample so the flow of code was just causing the decoder to > > crash. I can produce a more robust fix, though again will need to repost > > other patches as well, please comment. > > > > > also this decoder with the patches should be tested with a fuzzer to > > > reduce > > > the chance of bugs > > > > > > I don't know how to use 'fuzzer', sorry, though i can look into that. > > had missed this reply as its not quoted correctly > yes, please look into testing this with a fuzzer, we should make reasonable > sure we dont add anomalies > > thx > > [...] > -- > 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 > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi, patch updated to add back the check. From f99726110a9e9e127fc2c7b4bbc3945764ecbfdd Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Thu, 6 Sep 2018 11:08:57 +0530 Subject: [GSOC][PATCH 1/3] lavc/cfhd: 3d transform decoding added for both progressive and interlaced samples --- libavcodec/cfhd.c | 504 -- libavcodec/cfhd.h | 13 +- 2 files changed, 450 insertions(+), 67 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 846d334b9b..3929b54f31 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; s->avctx = avctx; +s->progressive = 0; return ff_cfhd_init_vlcs(s); } @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) s->pshift= 1; s->codebook = 0; s->difference_coding = 0; -s->progressive = 0; init_plane_defaults(s); init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level <
Re: [FFmpeg-devel] [GSOC][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples
Hi, The new patch is to applied on top of the new patches sent. Thanks Gagandeep Singh On Tue, Aug 14, 2018 at 1:14 PM Gagandeep Singh wrote: > Last patch adding frame thread support for ip samples in both progressive > and interlaced versions. > > Gagandeep Singh > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd
On Fri, Aug 17, 2018 at 11:34 AM Gagandeep Singh wrote: > > > On Thu, Aug 16, 2018 at 2:37 AM Kieran Kunhya wrote: > >> On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh >> wrote: >> >> > Second patch for fixing decompanding in table 9. >> > >> > Gagandeep Singh >> > >> >> Seems ok >> >> Kieran >> > > Thanks!! > > Gagandeep Singh > Hi, This patch is to be applied along with the other updated patches. Thanks Gagandeep Singh > ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > From 4f0c812aaf50738e579bde0bb12b9f2391eb15e5 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Thu, 6 Sep 2018 11:12:16 +0530 Subject: [GSOC][PATCH 2/3] lavc/cfhd: correct decompanding for old codebook (table 9) --- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 3929b54f31..e78fa81655 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] fate samples for lavc/cfhd to go along with the patches
Hi, I have truncated the samples files to ~ 1MB each for fate samples to be used for the patches in review. https://www.dropbox.com/sh/cqi23br0wm9z3qy/AAALQFRkLIFTCpRYURixysd9a?dl=0 Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH]lavc/cfhd: Drop an unused function
On Thu, Aug 23, 2018 at 7:33 PM Paul B Mahol wrote: > On 8/23/18, Carl Eugen Hoyos wrote: > > Hi! > > > > Attached patch removes an unused function from cfhd.c. > > > > Please comment, Carl Eugen > > > > Not acceptable. Function is needed, but was dropped due programmer's error. > I just noticed. Will add it back in the updated patch that i will work on saturday. Thanks. Gagandeep Singh > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] GSOC Complete
Hi, I would like to thank all the FFmpeg developers who have helped me in my 3 months of project. durandal_1707 thanks for the last minute check on the file. I also thank my mentor kierank, for his faith in me even though during the second month i was not feeling that i would be able to work on it anymore. I would continue to be involved in FFmpeg development (in my capacity - only a B.Tech student here :\ ). I also know that the project was comparatively easier and could have been finished sooner, so thanks for being patient with me. Sincerely Gagandeep Singh GSOC 2018 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
On Wed, Aug 15, 2018 at 3:12 AM Michael Niedermayer wrote: > On Tue, Aug 14, 2018 at 01:12:37PM +0530, Gagandeep Singh wrote: > > IP sample decoding patch attached herein. > > > > Gagandeep Singh > > > cfhd.c | 511 > - > > cfhd.h | 13 + > > 2 files changed, 454 insertions(+), 70 deletions(-) > > a155a004ae249d84063d9c49effb87a8f98b0fe7 patchip.patch > > From 6cc5636c48bca4e802ccca5f53560e31360760cb Mon Sep 17 00:00:00 2001 > > From: Gagandeep Singh > > Date: Tue, 14 Aug 2018 00:07:45 +0530 > > Subject: [GSOC][FFmpeg-devel][PATCH 1/3] lavc/cfhd:3d transform decoding > for both progressive and > > interlaced > > > [...] > > @@ -420,9 +486,15 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > > s->prescale_shift[1] = (data >> 3) & 0x7; > > s->prescale_shift[2] = (data >> 6) & 0x7; > > av_log(avctx, AV_LOG_DEBUG, "Prescale shift (VC-5): %x\n", > data); > > +} else if (tag == EncodingMethod) { > > +s->encode_method = data; > > +av_log(avctx, AV_LOG_DEBUG, "Encode Method for Subband %d : > %x\n",s->subband_num_actual, data); > > > } else if (tag == 27) { > > av_log(avctx, AV_LOG_DEBUG, "Lowpass width %"PRIu16"\n", > data); > > -if (data < 3 || data > > s->plane[s->channel_num].band[0][0].a_width) { > > +if (s->coded_width == 0){ > > +s->coded_width = data << 3; > > + } > > +if (data < 3) { > > av_log(avctx, AV_LOG_ERROR, "Invalid lowpass width\n"); > > ret = AVERROR(EINVAL); > > any checks should be done before the variable is used. > also teh indention looks rather odd here > > > [...] > > @@ -664,9 +742,14 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > > if (count > expected) > > break; > > > > -coeff = dequant_and_decompand(level, > s->quantisation, 0); > > +coeff = dequant_and_decompand(level, > s->quantisation, 0, (s->sample_type == 2 || s->sample_type == 3) && > s->pframe && s->subband_num_actual == 7 && s->encode_method == 5); > > for (i = 0; i < run; i++) > > -*coeff_data++ = coeff; > > +if (tag != 82) > > what is tag 82 ? > i think instead of litteral numbers named identifers should be used > tag 82 is to tell the decoder to use the next coefficients for the same subband, i.e, process the coefficients in the latest subband with the new coefficients. Yes, you are right, i should have used name instead of number, i can send the patch again but i would also have to send the other patches again. Or i can send a patch to be applied on top of the 3 patches i sent. Please comment. > > > [...] > > @@ -726,14 +814,15 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > > } > > } > > } > > - > > -if (!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE || > > -s->coded_width || s->coded_height || s->coded_format != > AV_PIX_FMT_NONE) { > > > +//disabled to run mountain sample file > > +#if 0 > > +if ((!s->a_width || !s->a_height || s->a_format == AV_PIX_FMT_NONE > || > > +s->coded_width || s->coded_height || s->coded_format != > AV_PIX_FMT_NONE) && s->sample_type != 1) { > > av_log(avctx, AV_LOG_ERROR, "Invalid dimensions\n"); > > ret = AVERROR(EINVAL); > > goto end; > > } > > - > > +#endif > > please elaborate why this needs to be disabled > i presume this code was needed for something > I didn't need to disable this for any sample except one, where the image height and width data wasn't transfered in accordance to how it was in the rest of the sample so the flow of code was just causing the decoder to crash. I can produce a more robust fix, though again will need to repost other patches as well, please comment. > also this decoder with the patches should be tested with a fuzzer to > reduce > the chance of bugs > > I don't know how to use 'fuzzer', sorry, though i can look into that. > als
Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd
On Thu, Aug 16, 2018 at 2:37 AM Kieran Kunhya wrote: > On Tue, 14 Aug 2018 at 08:43 Gagandeep Singh > wrote: > > > Second patch for fixing decompanding in table 9. > > > > Gagandeep Singh > > > > Seems ok > > Kieran > Thanks!! Gagandeep Singh > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd
On Tue, Aug 14, 2018 at 12:58 PM Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 25 - > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 3906d7a86d..2c538f0bbd 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, > int quantisation, int codeboo > { > if (lossless) > return level; > -if (codebook == 0 || codebook == 1) { > +if (codebook == 0) { > +if (level >= 40 && level < 264) { > +if (level >= 54) { > +level -= 54; > +level <<= 2; > +level += 54; > +} > +level -= 40; > +level <<= 2; > +level += 40; > +} else if (level <= -40) { > +level = -level; > +if (level >= 54) { > +level -= 54; > +level <<= 2; > +level += 54; > +} > +level -= 40; > +level <<= 2; > +level += 40; > +level = -level; > +} > +return level * quantisation; > +} else if (codebook == 1) { > int64_t abslevel = abs(level); > if (level < 264) > return (abslevel + ((768 * abslevel * abslevel * abslevel) / > (255 * 255 * 255))) * > -- > 2.17.1 > > Discard this thread, really sorry for the inconvenience. Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples
On Tue, Aug 14, 2018 at 12:58 PM Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 378 -- > libavcodec/cfhd.h | 8 +- > 2 files changed, 242 insertions(+), 144 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 2c538f0bbd..7c298056ca 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -63,13 +63,23 @@ enum CFHDParam { > > static av_cold int cfhd_init(AVCodecContext *avctx) > { > +int ret; > + > CFHDContext *s = avctx->priv_data; > +if (!avctx->internal->is_copy) { > +avctx->internal->allocate_progress = 1; > +ret = ff_cfhd_init_vlcs(s); > +} else > +ret = 0; > > avctx->bits_per_raw_sample = 10; > s->avctx = avctx; > s->progressive = 0; > +s->i_frame.f = av_frame_alloc(); > +s->p_frame.f = av_frame_alloc(); > > -return ff_cfhd_init_vlcs(s); > + > +return ret; > } > > static void init_plane_defaults(CFHDContext *s) > @@ -268,15 +278,18 @@ static void free_buffers(CFHDContext *s) > for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { > av_freep(&s->plane[i].idwt_buf); > av_freep(&s->plane[i].idwt_tmp); > -if (s->transform_type == 0) > +if (s->transform_type == 0) { > for (j = 0; j < 9; j++) > s->plane[i].subband[j] = NULL; > -else > +for (j = 0; j < 8; j++) > +s->plane[i].l_h[j] = NULL; > +} > +else { > for (j = 0; j < 17; j++) > s->plane[i].subband[j] = NULL; > - > -for (j = 0; j < 8; j++) > -s->plane[i].l_h[j] = NULL; > +for (j = 0; j < 12; j++) > +s->plane[i].l_h[j] = NULL; > +} > } > s->a_height = 0; > s->a_width = 0; > @@ -394,8 +407,10 @@ static int alloc_buffers(AVCodecContext *avctx) > s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; > if (s->transform_type == 2) { > frame2 = s->plane[i].idwt_tmp + 4 * w2 * h2; > -s->plane[i].l_h[8] = frame2; > -s->plane[i].l_h[9] = frame2 + 2 * w2 * h2; > +s->plane[i].l_h[8] = frame2; > +s->plane[i].l_h[9] = frame2 + 2 * w4 * h4; > +s->plane[i].l_h[10] = frame2; > +s->plane[i].l_h[11] = frame2 + 2 * w2 * h2; > } > } > > @@ -406,14 +421,28 @@ static int alloc_buffers(AVCodecContext *avctx) > return 0; > } > > +static int update_thread_context(AVCodecContext *dst, const > AVCodecContext *src) > +{ > +CFHDContext *csrc = src->priv_data; > +CFHDContext *cdst = dst->priv_data; > +cdst->transform_type = csrc->transform_type; > +if (csrc->sample_type != 1 && csrc->transform_type != 0) { > +cdst->progressive = csrc->progressive; > +cdst->picture = &csrc->p_frame; > +cdst->connection = &csrc->i_frame; > +cdst->buffers = csrc->plane; > +} > + > +return 0; > +} > + > static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, > AVPacket *avpkt) > { > CFHDContext *s = avctx->priv_data; > GetByteContext gb; > ThreadFrame frame = { .f = data }; > -AVFrame *pic = data; > -int ret = 0, i, j, planes, plane, got_buffer = 0; > +int ret = 0, i, j, planes, plane, got_buffer = 0, progress1 = 1, > progress2 = 1; > int16_t *coeff_data; > > s->coded_format = AV_PIX_FMT_YUV422P10; > @@ -537,7 +566,9 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > } else if (tag == 1) { > s->sample_type = data; > if (data == 2) > -s->pframe = 1; > +s->pframe = 1; > +else if (data == 1) > +s->transform_type = 2; > av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data); > } else if (tag == 10) { > s->transform_type = data; > @@ -657,21 +688,54 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > return ret; > } > } > -ret = ff_set_dimensions(avctx, s->coded_width, > s->coded_height); > -if (ret < 0) > -return ret; > -if (s->cropped_heig
[FFmpeg-devel] [GSOC][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples
Last patch adding frame thread support for ip samples in both progressive and interlaced versions. Gagandeep Singh From fa23549c61a6d8413cdc79c570376c53795a6ff1 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 12:43:20 +0530 Subject: [GSOC][FFmpeg-devel][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples --- libavcodec/cfhd.c | 378 -- libavcodec/cfhd.h | 8 +- 2 files changed, 242 insertions(+), 144 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 2c538f0bbd..7c298056ca 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -63,13 +63,23 @@ enum CFHDParam { static av_cold int cfhd_init(AVCodecContext *avctx) { +int ret; + CFHDContext *s = avctx->priv_data; +if (!avctx->internal->is_copy) { +avctx->internal->allocate_progress = 1; +ret = ff_cfhd_init_vlcs(s); +} else +ret = 0; avctx->bits_per_raw_sample = 10; s->avctx = avctx; s->progressive = 0; +s->i_frame.f = av_frame_alloc(); +s->p_frame.f = av_frame_alloc(); -return ff_cfhd_init_vlcs(s); + +return ret; } static void init_plane_defaults(CFHDContext *s) @@ -268,15 +278,18 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); -if (s->transform_type == 0) +if (s->transform_type == 0) { for (j = 0; j < 9; j++) s->plane[i].subband[j] = NULL; -else +for (j = 0; j < 8; j++) +s->plane[i].l_h[j] = NULL; +} +else { for (j = 0; j < 17; j++) s->plane[i].subband[j] = NULL; - -for (j = 0; j < 8; j++) -s->plane[i].l_h[j] = NULL; +for (j = 0; j < 12; j++) +s->plane[i].l_h[j] = NULL; +} } s->a_height = 0; s->a_width = 0; @@ -394,8 +407,10 @@ static int alloc_buffers(AVCodecContext *avctx) s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; if (s->transform_type == 2) { frame2 = s->plane[i].idwt_tmp + 4 * w2 * h2; -s->plane[i].l_h[8] = frame2; -s->plane[i].l_h[9] = frame2 + 2 * w2 * h2; +s->plane[i].l_h[8] = frame2; +s->plane[i].l_h[9] = frame2 + 2 * w4 * h4; +s->plane[i].l_h[10] = frame2; +s->plane[i].l_h[11] = frame2 + 2 * w2 * h2; } } @@ -406,14 +421,28 @@ static int alloc_buffers(AVCodecContext *avctx) return 0; } +static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ +CFHDContext *csrc = src->priv_data; +CFHDContext *cdst = dst->priv_data; +cdst->transform_type = csrc->transform_type; +if (csrc->sample_type != 1 && csrc->transform_type != 0) { +cdst->progressive = csrc->progressive; +cdst->picture = &csrc->p_frame; +cdst->connection = &csrc->i_frame; +cdst->buffers = csrc->plane; +} + +return 0; +} + static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CFHDContext *s = avctx->priv_data; GetByteContext gb; ThreadFrame frame = { .f = data }; -AVFrame *pic = data; -int ret = 0, i, j, planes, plane, got_buffer = 0; +int ret = 0, i, j, planes, plane, got_buffer = 0, progress1 = 1, progress2 = 1; int16_t *coeff_data; s->coded_format = AV_PIX_FMT_YUV422P10; @@ -537,7 +566,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } else if (tag == 1) { s->sample_type = data; if (data == 2) -s->pframe = 1; +s->pframe = 1; +else if (data == 1) +s->transform_type = 2; av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data); } else if (tag == 10) { s->transform_type = data; @@ -657,21 +688,54 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, return ret; } } -ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); -if (ret < 0) -return ret; -if (s->cropped_height) -avctx->height = s->cropped_height; -frame.f->width = -frame.f->height = 0; - -if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) -return ret; - +if (s->transform_type == 2) { +
[FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd
Second patch for fixing decompanding in table 9. Gagandeep Singh From d6ac8a4ee2f08a6d3cab7e7500d740c661062c9f Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 00:20:06 +0530 Subject: [GSOC][FFmpeg-devel][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd --- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 3906d7a86d..2c538f0bbd 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
IP sample decoding patch attached herein. Gagandeep Singh From 6cc5636c48bca4e802ccca5f53560e31360760cb Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 00:07:45 +0530 Subject: [GSOC][FFmpeg-devel][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced --- libavcodec/cfhd.c | 511 -- libavcodec/cfhd.h | 13 +- 2 files changed, 454 insertions(+), 70 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 76838f0869..3906d7a86d 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; s->avctx = avctx; +s->progressive = 0; return ff_cfhd_init_vlcs(s); } @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) s->pshift= 1; s->codebook = 0; s->difference_coding = 0; -s->progressive = 0; init_plane_defaults(s); init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level < 264) @@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } -static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, - int width, int linesize, int plane) +static inline void inverse_temporal_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int temporal_for_highpass) { int i; int16_t even, odd; for (i = 0; i < width; i++) { even = (low[i] - high[i])/2; odd = (low[i] + high[i])/2; -output[i]= av_clip_uintp2(even, 10); -output[i + linesize] = av_clip_uintp2(odd, 10); +if (!temporal_for_highpass) { +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} else { +low[i] = even; +high[i] = odd; +} } } static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, @@ -231,9 +245,12 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); - -for (j = 0; j < 9; j++) -s->plane[i].subband[j] = NULL; +if (s->transform_type == 0) +for (j = 0; j < 9; j++) +s->plane[i].subband[j] = NULL; +else +for (j = 0; j < 17; j++) +s->plane[i].subband[j] = NULL; for (j = 0; j < 8; j++) s->plane[i].l_h[j] = NULL; @@ -247,7 +264,7 @@ static int alloc_buffers(AVCodecContext *avctx) CFHDContext *s = avctx->priv_data; int i, j, ret, planes; int chroma_x_shift, chroma_y_shift; -unsigned k; +unsigned k, t; if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0) return ret; @@ -261,6 +278,7 @@ static int alloc_buffers(AVCodecContext *avctx) for (i = 0; i < planes; i++) { int w8, h8, w4, h4, w2, h2; +int16_t *frame2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; @@ -277,28 +295,68 @@ static int alloc_buffers(AVCodecContext *avctx) w2 = w4 * 2; h2 = h4 * 2; -s->plane[i].idwt_buf = -av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); -s->plane[i].idwt_tmp = -av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp))
Re: [FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:3d transform decoding for both progressive and interlaced
On Tue, Aug 14, 2018 at 12:58 AM Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 511 -- > libavcodec/cfhd.h | 13 +- > 2 files changed, 454 insertions(+), 70 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 76838f0869..3906d7a86d 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -41,12 +41,15 @@ > #define ALPHA_COMPAND_GAIN 9400 > > enum CFHDParam { > +TransformType= 10, > ChannelCount = 12, > SubbandCount = 14, > +Pframe = 19, > ImageWidth = 20, > ImageHeight = 21, > LowpassPrecision = 35, > SubbandNumber= 48, > +EncodingMethod = 52, > Quantization = 53, > ChannelNumber= 62, > SampleFlags = 68, > @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) > > avctx->bits_per_raw_sample = 10; > s->avctx = avctx; > +s->progressive = 0; > > return ff_cfhd_init_vlcs(s); > } > @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) > > static void init_frame_defaults(CFHDContext *s) > { > +s->sample_type = 0; > +s->transform_type= 0; > +s->pframe= 0; > +s->first_wavelet = 0; > s->coded_width = 0; > s->coded_height = 0; > s->cropped_height= 0; > @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) > s->pshift= 1; > s->codebook = 0; > s->difference_coding = 0; > -s->progressive = 0; > init_plane_defaults(s); > init_peak_table_defaults(s); > } > > /* TODO: merge with VLC tables or use LUT */ > -static inline int dequant_and_decompand(int level, int quantisation, int > codebook) > +static inline int dequant_and_decompand(int level, int quantisation, int > codebook, int lossless) > { > +if (lossless) > +return level; > if (codebook == 0 || codebook == 1) { > int64_t abslevel = abs(level); > if (level < 264) > @@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t > out_stride, > } > } > > -static inline void interlaced_vertical_filter(int16_t *output, int16_t > *low, int16_t *high, > - int width, int linesize, int plane) > +static inline void inverse_temporal_filter(int16_t *output, int16_t *low, > int16_t *high, > + int width, int linesize, int > temporal_for_highpass) > { > int i; > int16_t even, odd; > for (i = 0; i < width; i++) { > even = (low[i] - high[i])/2; > odd = (low[i] + high[i])/2; > -output[i]= av_clip_uintp2(even, 10); > -output[i + linesize] = av_clip_uintp2(odd, 10); > +if (!temporal_for_highpass) { > +output[i]= av_clip_uintp2(even, 10); > +output[i + linesize] = av_clip_uintp2(odd, 10); > +} else { > +low[i] = even; > +high[i] = odd; > +} > } > } > static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, > @@ -231,9 +245,12 @@ static void free_buffers(CFHDContext *s) > for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { > av_freep(&s->plane[i].idwt_buf); > av_freep(&s->plane[i].idwt_tmp); > - > -for (j = 0; j < 9; j++) > -s->plane[i].subband[j] = NULL; > +if (s->transform_type == 0) > +for (j = 0; j < 9; j++) > +s->plane[i].subband[j] = NULL; > +else > +for (j = 0; j < 17; j++) > +s->plane[i].subband[j] = NULL; > > for (j = 0; j < 8; j++) > s->plane[i].l_h[j] = NULL; > @@ -247,7 +264,7 @@ static int alloc_buffers(AVCodecContext *avctx) > CFHDContext *s = avctx->priv_data; > int i, j, ret, planes; > int chroma_x_shift, chroma_y_shift; > -unsigned k; > +unsigned k, t; > > if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) > < 0) > return ret; > @@ -261,6 +278,7 @@ static int alloc_buffers(AVCodecContext *avctx) > > for (i = 0; i < planes; i++) { > int w8, h8, w4, h4, w2, h2; > +int16_t *frame2; > int width = i ? avctx->width >> chroma_x_shift : avctx->width; > int height = i ? avctx->height >> chroma_y_shift : avctx->height; > ptrdiff_t stride = F
[FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
--- libavcodec/cfhd.c | 511 -- libavcodec/cfhd.h | 13 +- 2 files changed, 454 insertions(+), 70 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 76838f0869..3906d7a86d 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; s->avctx = avctx; +s->progressive = 0; return ff_cfhd_init_vlcs(s); } @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) s->pshift= 1; s->codebook = 0; s->difference_coding = 0; -s->progressive = 0; init_plane_defaults(s); init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level < 264) @@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } -static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, - int width, int linesize, int plane) +static inline void inverse_temporal_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int temporal_for_highpass) { int i; int16_t even, odd; for (i = 0; i < width; i++) { even = (low[i] - high[i])/2; odd = (low[i] + high[i])/2; -output[i]= av_clip_uintp2(even, 10); -output[i + linesize] = av_clip_uintp2(odd, 10); +if (!temporal_for_highpass) { +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} else { +low[i] = even; +high[i] = odd; +} } } static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, @@ -231,9 +245,12 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); - -for (j = 0; j < 9; j++) -s->plane[i].subband[j] = NULL; +if (s->transform_type == 0) +for (j = 0; j < 9; j++) +s->plane[i].subband[j] = NULL; +else +for (j = 0; j < 17; j++) +s->plane[i].subband[j] = NULL; for (j = 0; j < 8; j++) s->plane[i].l_h[j] = NULL; @@ -247,7 +264,7 @@ static int alloc_buffers(AVCodecContext *avctx) CFHDContext *s = avctx->priv_data; int i, j, ret, planes; int chroma_x_shift, chroma_y_shift; -unsigned k; +unsigned k, t; if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0) return ret; @@ -261,6 +278,7 @@ static int alloc_buffers(AVCodecContext *avctx) for (i = 0; i < planes; i++) { int w8, h8, w4, h4, w2, h2; +int16_t *frame2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; @@ -277,28 +295,68 @@ static int alloc_buffers(AVCodecContext *avctx) w2 = w4 * 2; h2 = h4 * 2; -s->plane[i].idwt_buf = -av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); -s->plane[i].idwt_tmp = -av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); -if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) -return AVERROR(ENOMEM); - -s->plane[i].subband[0] = s->plane[i].idwt_buf; -s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; -s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; -s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; -s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; -s
Re: [FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
On Tue, Aug 14, 2018 at 1:03 PM Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 511 -- > libavcodec/cfhd.h | 13 +- > 2 files changed, 454 insertions(+), 70 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 76838f0869..3906d7a86d 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -41,12 +41,15 @@ > #define ALPHA_COMPAND_GAIN 9400 > > enum CFHDParam { > +TransformType= 10, > ChannelCount = 12, > SubbandCount = 14, > +Pframe = 19, > ImageWidth = 20, > ImageHeight = 21, > LowpassPrecision = 35, > SubbandNumber= 48, > +EncodingMethod = 52, > Quantization = 53, > ChannelNumber= 62, > SampleFlags = 68, > @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) > > avctx->bits_per_raw_sample = 10; > s->avctx = avctx; > +s->progressive = 0; > > return ff_cfhd_init_vlcs(s); > } > @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) > > static void init_frame_defaults(CFHDContext *s) > { > +s->sample_type = 0; > +s->transform_type= 0; > +s->pframe= 0; > +s->first_wavelet = 0; > s->coded_width = 0; > s->coded_height = 0; > s->cropped_height= 0; > @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) > s->pshift= 1; > s->codebook = 0; > s->difference_coding = 0; > -s->progressive = 0; > init_plane_defaults(s); > init_peak_table_defaults(s); > } > > /* TODO: merge with VLC tables or use LUT */ > -static inline int dequant_and_decompand(int level, int quantisation, int > codebook) > +static inline int dequant_and_decompand(int level, int quantisation, int > codebook, int lossless) > { > +if (lossless) > +return level; > if (codebook == 0 || codebook == 1) { > int64_t abslevel = abs(level); > if (level < 264) > @@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t > out_stride, > } > } > > -static inline void interlaced_vertical_filter(int16_t *output, int16_t > *low, int16_t *high, > - int width, int linesize, int plane) > +static inline void inverse_temporal_filter(int16_t *output, int16_t *low, > int16_t *high, > + int width, int linesize, int > temporal_for_highpass) > { > int i; > int16_t even, odd; > for (i = 0; i < width; i++) { > even = (low[i] - high[i])/2; > odd = (low[i] + high[i])/2; > -output[i]= av_clip_uintp2(even, 10); > -output[i + linesize] = av_clip_uintp2(odd, 10); > +if (!temporal_for_highpass) { > +output[i]= av_clip_uintp2(even, 10); > +output[i + linesize] = av_clip_uintp2(odd, 10); > +} else { > +low[i] = even; > +high[i] = odd; > +} > } > } > static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, > @@ -231,9 +245,12 @@ static void free_buffers(CFHDContext *s) > for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { > av_freep(&s->plane[i].idwt_buf); > av_freep(&s->plane[i].idwt_tmp); > - > -for (j = 0; j < 9; j++) > -s->plane[i].subband[j] = NULL; > +if (s->transform_type == 0) > +for (j = 0; j < 9; j++) > +s->plane[i].subband[j] = NULL; > +else > +for (j = 0; j < 17; j++) > +s->plane[i].subband[j] = NULL; > > for (j = 0; j < 8; j++) > s->plane[i].l_h[j] = NULL; > @@ -247,7 +264,7 @@ static int alloc_buffers(AVCodecContext *avctx) > CFHDContext *s = avctx->priv_data; > int i, j, ret, planes; > int chroma_x_shift, chroma_y_shift; > -unsigned k; > +unsigned k, t; > > if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) > < 0) > return ret; > @@ -261,6 +278,7 @@ static int alloc_buffers(AVCodecContext *avctx) > > for (i = 0; i < planes; i++) { > int w8, h8, w4, h4, w2, h2; > +int16_t *frame2; > int width = i ? avctx->width >> chroma_x_shift : avctx->width; > int height = i ? avctx->height >> chroma_y_shift : avctx->height; > ptrdiff_t stride = FFA
[FFmpeg-devel] [GSOC][PATCH 1/3] lavc/cfhd:3d transform decoding for both progressive and interlaced
high += lowpass_width * 2; +dst += pic->linesize[act_plane]; +} +} +} +} else if (s->sample_type == 1) { +int16_t *low, *high, *dst; +int lowpass_height, lowpass_width; +for (plane = 0; plane < planes && !ret; plane++) { +int act_plane = plane == 1 ? 2 : plane == 2 ? 1 : plane; +lowpass_height = s->plane[plane].band[4][1].height; +lowpass_width = s->plane[plane].band[4][1].width; +if (s->progressive) { +dst = (int16_t *)pic->data[act_plane]; +low = s->plane[plane].l_h[8]; +high = s->plane[plane].l_h[9]; +for (i = 0; i < lowpass_height * 2; i++) { +horiz_filter(dst, low, high, lowpass_width); +low += lowpass_width; +high += lowpass_width; +dst += pic->linesize[act_plane] / 2; +} +} else { +dst = (int16_t *)pic->data[act_plane]; +low = s->plane[plane].l_h[8]; +high = s->plane[plane].l_h[9]; +for (i = 0; i < lowpass_height; i++) { +inverse_temporal_filter(dst, low, high, lowpass_width * 2, pic->linesize[act_plane]/2, 0); +low += lowpass_width * 2; +high += lowpass_width * 2; +dst += pic->linesize[act_plane]; +} +} +} +} end: if (ret < 0) @@ -961,6 +1342,6 @@ AVCodec ff_cfhd_decoder = { .init = cfhd_init, .close= cfhd_close, .decode = cfhd_decode, -.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, -.caps_internal= FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, +.capabilities = AV_CODEC_CAP_DR1, +.caps_internal= FF_CODEC_CAP_INIT_CLEANUP, }; diff --git a/libavcodec/cfhd.h b/libavcodec/cfhd.h index 4f2c82d8bc..047c0f2028 100644 --- a/libavcodec/cfhd.h +++ b/libavcodec/cfhd.h @@ -31,15 +31,14 @@ #include "vlc.h" #define VLC_BITS 9 -#define SUBBAND_COUNT 10 - +#define SUBBAND_COUNT 17 typedef struct CFHD_RL_VLC_ELEM { int16_t level; int8_t len; uint16_t run; } CFHD_RL_VLC_ELEM; -#define DWT_LEVELS 3 +#define DWT_LEVELS 6 typedef struct SubBand { int level; @@ -64,7 +63,7 @@ typedef struct Plane { /* TODO: merge this into SubBand structure */ int16_t *subband[SUBBAND_COUNT]; -int16_t *l_h[8]; +int16_t *l_h[10]; SubBand band[DWT_LEVELS][4]; } Plane; @@ -83,9 +82,13 @@ typedef struct CFHDContext { CFHD_RL_VLC_ELEM table_18_rl_vlc[4572]; VLC vlc_18; - GetBitContext gb; +int sample_type; +int transform_type; +int encode_method; +int first_wavelet; +int pframe; int coded_width; int coded_height; int cropped_height; -- 2.17.1 From d6ac8a4ee2f08a6d3cab7e7500d740c661062c9f Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 00:20:06 +0530 Subject: [GSOC][FFmpeg-devel][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd --- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 3906d7a86d..2c538f0bbd 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.17.1 From fa23549c61a6d8413cdc79c570376c53795a6ff1 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 12:43:20 +0530 Subject: [GSOC][FFmpeg-devel][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples --- libavcodec/cfhd.c | 378 -- libavco
[FFmpeg-devel] [GSOC][PATCH 2/3] lavc/cfhd:corrected decompanding for table 9 used in cfhd
--- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 3906d7a86d..2c538f0bbd 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [GSOC][PATCH 3/3] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples
--- libavcodec/cfhd.c | 378 -- libavcodec/cfhd.h | 8 +- 2 files changed, 242 insertions(+), 144 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 2c538f0bbd..7c298056ca 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -63,13 +63,23 @@ enum CFHDParam { static av_cold int cfhd_init(AVCodecContext *avctx) { +int ret; + CFHDContext *s = avctx->priv_data; +if (!avctx->internal->is_copy) { +avctx->internal->allocate_progress = 1; +ret = ff_cfhd_init_vlcs(s); +} else +ret = 0; avctx->bits_per_raw_sample = 10; s->avctx = avctx; s->progressive = 0; +s->i_frame.f = av_frame_alloc(); +s->p_frame.f = av_frame_alloc(); -return ff_cfhd_init_vlcs(s); + +return ret; } static void init_plane_defaults(CFHDContext *s) @@ -268,15 +278,18 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); -if (s->transform_type == 0) +if (s->transform_type == 0) { for (j = 0; j < 9; j++) s->plane[i].subband[j] = NULL; -else +for (j = 0; j < 8; j++) +s->plane[i].l_h[j] = NULL; +} +else { for (j = 0; j < 17; j++) s->plane[i].subband[j] = NULL; - -for (j = 0; j < 8; j++) -s->plane[i].l_h[j] = NULL; +for (j = 0; j < 12; j++) +s->plane[i].l_h[j] = NULL; +} } s->a_height = 0; s->a_width = 0; @@ -394,8 +407,10 @@ static int alloc_buffers(AVCodecContext *avctx) s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; if (s->transform_type == 2) { frame2 = s->plane[i].idwt_tmp + 4 * w2 * h2; -s->plane[i].l_h[8] = frame2; -s->plane[i].l_h[9] = frame2 + 2 * w2 * h2; +s->plane[i].l_h[8] = frame2; +s->plane[i].l_h[9] = frame2 + 2 * w4 * h4; +s->plane[i].l_h[10] = frame2; +s->plane[i].l_h[11] = frame2 + 2 * w2 * h2; } } @@ -406,14 +421,28 @@ static int alloc_buffers(AVCodecContext *avctx) return 0; } +static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ +CFHDContext *csrc = src->priv_data; +CFHDContext *cdst = dst->priv_data; +cdst->transform_type = csrc->transform_type; +if (csrc->sample_type != 1 && csrc->transform_type != 0) { +cdst->progressive = csrc->progressive; +cdst->picture = &csrc->p_frame; +cdst->connection = &csrc->i_frame; +cdst->buffers = csrc->plane; +} + +return 0; +} + static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CFHDContext *s = avctx->priv_data; GetByteContext gb; ThreadFrame frame = { .f = data }; -AVFrame *pic = data; -int ret = 0, i, j, planes, plane, got_buffer = 0; +int ret = 0, i, j, planes, plane, got_buffer = 0, progress1 = 1, progress2 = 1; int16_t *coeff_data; s->coded_format = AV_PIX_FMT_YUV422P10; @@ -537,7 +566,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } else if (tag == 1) { s->sample_type = data; if (data == 2) -s->pframe = 1; +s->pframe = 1; +else if (data == 1) +s->transform_type = 2; av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data); } else if (tag == 10) { s->transform_type = data; @@ -657,21 +688,54 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, return ret; } } -ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); -if (ret < 0) -return ret; -if (s->cropped_height) -avctx->height = s->cropped_height; -frame.f->width = -frame.f->height = 0; - -if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) -return ret; - +if (s->transform_type == 2) { +if (s->sample_type != 1) { +s->picture = &s->i_frame; +s->connection = &s->p_frame; +s->buffers = s->plane; +} +ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); +if (ret < 0) +return ret; +if (s->sample_type != 1) { +if (s->i_frame.f->data[0]) +ff_thread_release_buffer(avctx, &s->i_frame); +if (s->p_frame.f->data[0]) +ff_thread_release_buffer(avctx, &s->p_frame); +
Re: [FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:corrected decompanding for table 9 used in cfhd
On Tue, Aug 14, 2018 at 12:58 AM Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 25 - > 1 file changed, 24 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 3906d7a86d..2c538f0bbd 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, > int quantisation, int codeboo > { > if (lossless) > return level; > -if (codebook == 0 || codebook == 1) { > +if (codebook == 0) { > +if (level >= 40 && level < 264) { > +if (level >= 54) { > +level -= 54; > +level <<= 2; > +level += 54; > +} > +level -= 40; > +level <<= 2; > +level += 40; > +} else if (level <= -40) { > +level = -level; > +if (level >= 54) { > +level -= 54; > +level <<= 2; > +level += 54; > +} > +level -= 40; > +level <<= 2; > +level += 40; > +level = -level; > +} > +return level * quantisation; > +} else if (codebook == 1) { > int64_t abslevel = abs(level); > if (level < 264) > return (abslevel + ((768 * abslevel * abslevel * abslevel) / > (255 * 255 * 255))) * > -- > 2.17.1 > Updated patches are in new thread. Sorry for inconvenience. Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:frame threading support added for temporal transform decoding
On Tue, Aug 14, 2018 at 12:46 PM Gagandeep Singh wrote: > > > On Tue, Aug 14, 2018 at 1:17 AM James Almer wrote: > >> On 8/13/2018 4:29 PM, Gagandeep Singh wrote: >> > --- >> > libavcodec/cfhd.c | 370 -- >> > libavcodec/cfhd.h | 8 +- >> > 2 files changed, 235 insertions(+), 143 deletions(-) >> > >> > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c >> > index 2c538f0bbd..042f63c6d2 100644 >> > --- a/libavcodec/cfhd.c >> > +++ b/libavcodec/cfhd.c >> > @@ -65,9 +65,13 @@ static av_cold int cfhd_init(AVCodecContext *avctx) >> > { >> > CFHDContext *s = avctx->priv_data; >> > >> > +avctx->internal->allocate_progress = 1; >> >> Shouldn't this be under a !avctx->internal->is_copy check? Probably also >> the ff_cfhd_init_vlcs call below. >> >> Alternatively, add a new function meant to be used only with >> AVCodec->init_thread_copy(). >> >> > avctx->bits_per_raw_sample = 10; >> > s->avctx = avctx; >> > s->progressive = 0; >> > +s->i_frame.f = av_frame_alloc(); >> > +s->p_frame.f = av_frame_alloc(); >> > + >> > >> > return ff_cfhd_init_vlcs(s); >> > } >> >> > Thanks for the feedback. Updated patch attatched. > > Gagandeep Singh > Updated patches are in new thread. Sorry for inconvenience. Gagandeep Singh > ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:frame threading support added for temporal transform decoding
On Tue, Aug 14, 2018 at 1:17 AM James Almer wrote: > On 8/13/2018 4:29 PM, Gagandeep Singh wrote: > > --- > > libavcodec/cfhd.c | 370 -- > > libavcodec/cfhd.h | 8 +- > > 2 files changed, 235 insertions(+), 143 deletions(-) > > > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > > index 2c538f0bbd..042f63c6d2 100644 > > --- a/libavcodec/cfhd.c > > +++ b/libavcodec/cfhd.c > > @@ -65,9 +65,13 @@ static av_cold int cfhd_init(AVCodecContext *avctx) > > { > > CFHDContext *s = avctx->priv_data; > > > > +avctx->internal->allocate_progress = 1; > > Shouldn't this be under a !avctx->internal->is_copy check? Probably also > the ff_cfhd_init_vlcs call below. > > Alternatively, add a new function meant to be used only with > AVCodec->init_thread_copy(). > > > avctx->bits_per_raw_sample = 10; > > s->avctx = avctx; > > s->progressive = 0; > > +s->i_frame.f = av_frame_alloc(); > > +s->p_frame.f = av_frame_alloc(); > > + > > > > return ff_cfhd_init_vlcs(s); > > } > > Thanks for the feedback. Updated patch attatched. Gagandeep Singh > _______ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > From fa23549c61a6d8413cdc79c570376c53795a6ff1 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 14 Aug 2018 12:43:20 +0530 Subject: [GSOC][FFmpeg-devel][PATCH] lavc/cfhd:frame threading support for 3d transform progressive and interlaced samples --- libavcodec/cfhd.c | 378 -- libavcodec/cfhd.h | 8 +- 2 files changed, 242 insertions(+), 144 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 2c538f0bbd..7c298056ca 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -63,13 +63,23 @@ enum CFHDParam { static av_cold int cfhd_init(AVCodecContext *avctx) { +int ret; + CFHDContext *s = avctx->priv_data; +if (!avctx->internal->is_copy) { +avctx->internal->allocate_progress = 1; +ret = ff_cfhd_init_vlcs(s); +} else +ret = 0; avctx->bits_per_raw_sample = 10; s->avctx = avctx; s->progressive = 0; +s->i_frame.f = av_frame_alloc(); +s->p_frame.f = av_frame_alloc(); -return ff_cfhd_init_vlcs(s); + +return ret; } static void init_plane_defaults(CFHDContext *s) @@ -268,15 +278,18 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); -if (s->transform_type == 0) +if (s->transform_type == 0) { for (j = 0; j < 9; j++) s->plane[i].subband[j] = NULL; -else +for (j = 0; j < 8; j++) +s->plane[i].l_h[j] = NULL; +} +else { for (j = 0; j < 17; j++) s->plane[i].subband[j] = NULL; - -for (j = 0; j < 8; j++) -s->plane[i].l_h[j] = NULL; +for (j = 0; j < 12; j++) +s->plane[i].l_h[j] = NULL; +} } s->a_height = 0; s->a_width = 0; @@ -394,8 +407,10 @@ static int alloc_buffers(AVCodecContext *avctx) s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; if (s->transform_type == 2) { frame2 = s->plane[i].idwt_tmp + 4 * w2 * h2; -s->plane[i].l_h[8] = frame2; -s->plane[i].l_h[9] = frame2 + 2 * w2 * h2; +s->plane[i].l_h[8] = frame2; +s->plane[i].l_h[9] = frame2 + 2 * w4 * h4; +s->plane[i].l_h[10] = frame2; +s->plane[i].l_h[11] = frame2 + 2 * w2 * h2; } } @@ -406,14 +421,28 @@ static int alloc_buffers(AVCodecContext *avctx) return 0; } +static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ +CFHDContext *csrc = src->priv_data; +CFHDContext *cdst = dst->priv_data; +cdst->transform_type = csrc->transform_type; +if (csrc->sample_type != 1 && csrc->transform_type != 0) { +cdst->progressive = csrc->progressive; +cdst->picture = &csrc->p_frame; +cdst->connection = &csrc->i_frame; +cdst->buffers = csrc->plane; +} + +return 0; +} + static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CFHDContext *s = avctx->priv_data; GetByteContext gb; ThreadFram
[FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:corrected decompanding for table 9 used in cfhd
--- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 3906d7a86d..2c538f0bbd 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -114,7 +114,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:frame threading support added for temporal transform decoding
--- libavcodec/cfhd.c | 370 -- libavcodec/cfhd.h | 8 +- 2 files changed, 235 insertions(+), 143 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 2c538f0bbd..042f63c6d2 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -65,9 +65,13 @@ static av_cold int cfhd_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; +avctx->internal->allocate_progress = 1; avctx->bits_per_raw_sample = 10; s->avctx = avctx; s->progressive = 0; +s->i_frame.f = av_frame_alloc(); +s->p_frame.f = av_frame_alloc(); + return ff_cfhd_init_vlcs(s); } @@ -268,15 +272,18 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); -if (s->transform_type == 0) +if (s->transform_type == 0) { for (j = 0; j < 9; j++) s->plane[i].subband[j] = NULL; -else +for (j = 0; j < 8; j++) +s->plane[i].l_h[j] = NULL; +} +else { for (j = 0; j < 17; j++) s->plane[i].subband[j] = NULL; - -for (j = 0; j < 8; j++) -s->plane[i].l_h[j] = NULL; +for (j = 0; j < 12; j++) +s->plane[i].l_h[j] = NULL; +} } s->a_height = 0; s->a_width = 0; @@ -394,8 +401,10 @@ static int alloc_buffers(AVCodecContext *avctx) s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; if (s->transform_type == 2) { frame2 = s->plane[i].idwt_tmp + 4 * w2 * h2; -s->plane[i].l_h[8] = frame2; -s->plane[i].l_h[9] = frame2 + 2 * w2 * h2; +s->plane[i].l_h[8] = frame2; +s->plane[i].l_h[9] = frame2 + 2 * w4 * h4; +s->plane[i].l_h[10] = frame2; +s->plane[i].l_h[11] = frame2 + 2 * w2 * h2; } } @@ -406,14 +415,28 @@ static int alloc_buffers(AVCodecContext *avctx) return 0; } +static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) +{ +CFHDContext *csrc = src->priv_data; +CFHDContext *cdst = dst->priv_data; +cdst->transform_type = csrc->transform_type; +if (csrc->sample_type != 1 && csrc->transform_type != 0) { +cdst->progressive = csrc->progressive; +cdst->picture = &csrc->p_frame; +cdst->connection = &csrc->i_frame; +cdst->buffers = csrc->plane; +} + +return 0; +} + static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { CFHDContext *s = avctx->priv_data; GetByteContext gb; ThreadFrame frame = { .f = data }; -AVFrame *pic = data; -int ret = 0, i, j, planes, plane, got_buffer = 0; +int ret = 0, i, j, planes, plane, got_buffer = 0, progress1 = 1, progress2 = 1; int16_t *coeff_data; s->coded_format = AV_PIX_FMT_YUV422P10; @@ -537,7 +560,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } else if (tag == 1) { s->sample_type = data; if (data == 2) -s->pframe = 1; +s->pframe = 1; +else if (data == 1) +s->transform_type = 2; av_log(avctx, AV_LOG_DEBUG, "Sample type? %"PRIu16"\n", data); } else if (tag == 10) { s->transform_type = data; @@ -657,21 +682,54 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, return ret; } } -ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); -if (ret < 0) -return ret; -if (s->cropped_height) -avctx->height = s->cropped_height; -frame.f->width = -frame.f->height = 0; - -if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) -return ret; - +if (s->transform_type == 2) { +if (s->sample_type != 1) { +s->picture = &s->i_frame; +s->connection = &s->p_frame; +s->buffers = s->plane; +} +ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height); +if (ret < 0) +return ret; +if (s->sample_type != 1) { +if (s->i_frame.f->data[0]) +ff_thread_release_buffer(avctx, &s->i_frame); +if (s->p_frame.f->data[0]) +ff_thread_release_buffer(avctx, &s->p_frame); +av_frame_copy_props(s->i_frame.f, frame.f); +av_frame_copy_props(s->p_frame.f, frame.f); +if (s->cropped_height) +avctx->height = s->cropped_heig
[FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:3d transform decoding for both progressive and interlaced
--- libavcodec/cfhd.c | 511 -- libavcodec/cfhd.h | 13 +- 2 files changed, 454 insertions(+), 70 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 76838f0869..3906d7a86d 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -64,6 +67,7 @@ static av_cold int cfhd_init(AVCodecContext *avctx) avctx->bits_per_raw_sample = 10; s->avctx = avctx; +s->progressive = 0; return ff_cfhd_init_vlcs(s); } @@ -84,6 +88,10 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -97,14 +105,15 @@ static void init_frame_defaults(CFHDContext *s) s->pshift= 1; s->codebook = 0; s->difference_coding = 0; -s->progressive = 0; init_plane_defaults(s); init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level < 264) @@ -193,16 +202,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } -static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, - int width, int linesize, int plane) +static inline void inverse_temporal_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int temporal_for_highpass) { int i; int16_t even, odd; for (i = 0; i < width; i++) { even = (low[i] - high[i])/2; odd = (low[i] + high[i])/2; -output[i]= av_clip_uintp2(even, 10); -output[i + linesize] = av_clip_uintp2(odd, 10); +if (!temporal_for_highpass) { +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} else { +low[i] = even; +high[i] = odd; +} } } static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, @@ -231,9 +245,12 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); - -for (j = 0; j < 9; j++) -s->plane[i].subband[j] = NULL; +if (s->transform_type == 0) +for (j = 0; j < 9; j++) +s->plane[i].subband[j] = NULL; +else +for (j = 0; j < 17; j++) +s->plane[i].subband[j] = NULL; for (j = 0; j < 8; j++) s->plane[i].l_h[j] = NULL; @@ -247,7 +264,7 @@ static int alloc_buffers(AVCodecContext *avctx) CFHDContext *s = avctx->priv_data; int i, j, ret, planes; int chroma_x_shift, chroma_y_shift; -unsigned k; +unsigned k, t; if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0) return ret; @@ -261,6 +278,7 @@ static int alloc_buffers(AVCodecContext *avctx) for (i = 0; i < planes; i++) { int w8, h8, w4, h4, w2, h2; +int16_t *frame2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; @@ -277,28 +295,68 @@ static int alloc_buffers(AVCodecContext *avctx) w2 = w4 * 2; h2 = h4 * 2; -s->plane[i].idwt_buf = -av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); -s->plane[i].idwt_tmp = -av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); -if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) -return AVERROR(ENOMEM); - -s->plane[i].subband[0] = s->plane[i].idwt_buf; -s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; -s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; -s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; -s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; -s
[FFmpeg-devel] +R on channel
Hi, I have been working on cineform under GSOC and recently due to the spam the irc has restricted unregistered users and I can't send the message on irc. Please advise on what I need to do to continue on the channel. Thanks Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: added correct decompanding to codebook0
output of samples using codebook 0 improved --- libavcodec/cfhd.c | 25 - 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index bf80cb9c07..226b135c07 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -115,7 +115,30 @@ static inline int dequant_and_decompand(int level, int quantisation, int codeboo { if (lossless) return level; -if (codebook == 0 || codebook == 1) { +if (codebook == 0) { +if (level >= 40 && level < 264) { +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +} else if (level <= -40) { +level = -level; +if (level >= 54) { +level -= 54; +level <<= 2; +level += 54; +} +level -= 40; +level <<= 2; +level += 40; +level = -level; +} +return level * quantisation; +} else if (codebook == 1) { int64_t abslevel = abs(level); if (level < 264) return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: 3d wavelets(temporal transforms) added
though the output is not satisfactory, samples are now being processed --- libavcodec/cfhd.c | 469 ++ libavcodec/cfhd.h | 16 +- 2 files changed, 418 insertions(+), 67 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 051d210355..bf80cb9c07 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -84,6 +87,11 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->num_frames= 0; +s->pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -103,8 +111,10 @@ static void init_frame_defaults(CFHDContext *s) } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level < 264) @@ -193,16 +203,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } -static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, - int width, int linesize, int plane) +static inline void temporal_inverse_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int temporal_for_highpass) { int i; int16_t even, odd; for (i = 0; i < width; i++) { even = (low[i] - high[i])/2; odd = (low[i] + high[i])/2; -output[i]= av_clip_uintp2(even, 10); -output[i + linesize] = av_clip_uintp2(odd, 10); +if (!temporal_for_highpass) { +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} else { +low[i] = even; +high[i] = odd; +} } } static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, @@ -231,9 +246,12 @@ static void free_buffers(CFHDContext *s) for (i = 0; i < FF_ARRAY_ELEMS(s->plane); i++) { av_freep(&s->plane[i].idwt_buf); av_freep(&s->plane[i].idwt_tmp); - -for (j = 0; j < 9; j++) -s->plane[i].subband[j] = NULL; +if (s->transform_type == 0) +for (j = 0; j < 9; j++) +s->plane[i].subband[j] = NULL; +else +for (j = 0; j < 17; j++) +s->plane[i].subband[j] = NULL; for (j = 0; j < 8; j++) s->plane[i].l_h[j] = NULL; @@ -261,6 +279,7 @@ static int alloc_buffers(AVCodecContext *avctx) for (i = 0; i < planes; i++) { int w8, h8, w4, h4, w2, h2; +int16_t *frame2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; @@ -277,28 +296,85 @@ static int alloc_buffers(AVCodecContext *avctx) w2 = w4 * 2; h2 = h4 * 2; -s->plane[i].idwt_buf = -av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); -s->plane[i].idwt_tmp = -av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); -if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) -return AVERROR(ENOMEM); - -s->plane[i].subband[0] = s->plane[i].idwt_buf; -s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; -s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; -s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; -s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; -s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4; -s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4; -s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2; -s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2; -s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2; - -for (j = 0; j < DWT_LEVELS; j++) { -for (k = 0; k < FF_ARRAY_ELEMS(s->plane[i].band[j]); k++) { -s->plane[i].band[j][k].a_width = w8 << j; -s->plane[i].band[j][k].a_height = h8 << j; +if (s->transform_type == 0) { +
Re: [FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:IP frame decoding (inverse 3d transform) introduced
On Thu, May 31, 2018 at 4:55 PM, Gagandeep Singh wrote: > --- > libavcodec/cfhd.c | 462 ++ > > libavcodec/cfhd.h | 15 +- > 2 files changed, 411 insertions(+), 66 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index 051d210355..c0cd25a95e 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -41,12 +41,15 @@ > #define ALPHA_COMPAND_GAIN 9400 > > enum CFHDParam { > +TransformType= 10, > ChannelCount = 12, > SubbandCount = 14, > +Pframe = 19, > ImageWidth = 20, > ImageHeight = 21, > LowpassPrecision = 35, > SubbandNumber= 48, > +EncodingMethod = 52, > Quantization = 53, > ChannelNumber= 62, > SampleFlags = 68, > @@ -84,6 +87,11 @@ static void init_peak_table_defaults(CFHDContext *s) > > static void init_frame_defaults(CFHDContext *s) > { > +s->sample_type = 0; > +s->transform_type= 0; > +s->num_frames= 0; > +s->Pframe= 0; > +s->first_wavelet = 0; > s->coded_width = 0; > s->coded_height = 0; > s->cropped_height= 0; > @@ -103,8 +111,10 @@ static void init_frame_defaults(CFHDContext *s) > } > > /* TODO: merge with VLC tables or use LUT */ > -static inline int dequant_and_decompand(int level, int quantisation, int > codebook) > +static inline int dequant_and_decompand(int level, int quantisation, int > codebook, int lossless) > { > +if (lossless) > +return level; > if (codebook == 0 || codebook == 1) { > int64_t abslevel = abs(level); > if (level < 264) > @@ -193,16 +203,21 @@ static inline void filter(int16_t *output, ptrdiff_t > out_stride, > } > } > > -static inline void interlaced_vertical_filter(int16_t *output, int16_t > *low, int16_t *high, > - int width, int linesize, int plane) > +static inline void temporal_inverse_filter(int16_t *output, int16_t > *low, int16_t *high, > + int width, int linesize, int > temporal_for_highpass) > { > int i; > int16_t even, odd; > for (i = 0; i < width; i++) { > even = (low[i] - high[i])/2; > odd = (low[i] + high[i])/2; > -output[i]= av_clip_uintp2(even, 10); > -output[i + linesize] = av_clip_uintp2(odd, 10); > +if (!temporal_for_highpass) { > +output[i]= av_clip_uintp2(even, 10); > +output[i + linesize] = av_clip_uintp2(odd, 10); > +} else { > +low[i] = even; > +high[i] = odd; > +} > } > } > static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, > @@ -261,6 +276,7 @@ static int alloc_buffers(AVCodecContext *avctx) > > for (i = 0; i < planes; i++) { > int w8, h8, w4, h4, w2, h2; > +int16_t *frame2; > int width = i ? avctx->width >> chroma_x_shift : avctx->width; > int height = i ? avctx->height >> chroma_y_shift : avctx->height; > ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; > @@ -277,28 +293,85 @@ static int alloc_buffers(AVCodecContext *avctx) > w2 = w4 * 2; > h2 = h4 * 2; > > -s->plane[i].idwt_buf = > -av_mallocz_array(height * stride, > sizeof(*s->plane[i].idwt_buf)); > -s->plane[i].idwt_tmp = > -av_malloc_array(height * stride, > sizeof(*s->plane[i].idwt_tmp)); > -if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) > -return AVERROR(ENOMEM); > - > -s->plane[i].subband[0] = s->plane[i].idwt_buf; > -s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; > -s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; > -s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; > -s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; > -s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4; > -s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4; > -s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2; > -s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2; > -s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2; > - > -for (j = 0; j < DWT_LEVELS; j++) { > -for (k = 0; k < FF_ARRAY_ELEMS(s->plane[i].band[j]); k++) { > -s->p
[FFmpeg-devel] [GSOC][PATCH] lavc/cfhd:IP frame decoding (inverse 3d transform) introduced
--- libavcodec/cfhd.c | 462 ++ libavcodec/cfhd.h | 15 +- 2 files changed, 411 insertions(+), 66 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 051d210355..c0cd25a95e 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -41,12 +41,15 @@ #define ALPHA_COMPAND_GAIN 9400 enum CFHDParam { +TransformType= 10, ChannelCount = 12, SubbandCount = 14, +Pframe = 19, ImageWidth = 20, ImageHeight = 21, LowpassPrecision = 35, SubbandNumber= 48, +EncodingMethod = 52, Quantization = 53, ChannelNumber= 62, SampleFlags = 68, @@ -84,6 +87,11 @@ static void init_peak_table_defaults(CFHDContext *s) static void init_frame_defaults(CFHDContext *s) { +s->sample_type = 0; +s->transform_type= 0; +s->num_frames= 0; +s->Pframe= 0; +s->first_wavelet = 0; s->coded_width = 0; s->coded_height = 0; s->cropped_height= 0; @@ -103,8 +111,10 @@ static void init_frame_defaults(CFHDContext *s) } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation, int codebook) +static inline int dequant_and_decompand(int level, int quantisation, int codebook, int lossless) { +if (lossless) +return level; if (codebook == 0 || codebook == 1) { int64_t abslevel = abs(level); if (level < 264) @@ -193,16 +203,21 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } -static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, - int width, int linesize, int plane) +static inline void temporal_inverse_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int temporal_for_highpass) { int i; int16_t even, odd; for (i = 0; i < width; i++) { even = (low[i] - high[i])/2; odd = (low[i] + high[i])/2; -output[i]= av_clip_uintp2(even, 10); -output[i + linesize] = av_clip_uintp2(odd, 10); +if (!temporal_for_highpass) { +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} else { +low[i] = even; +high[i] = odd; +} } } static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, @@ -261,6 +276,7 @@ static int alloc_buffers(AVCodecContext *avctx) for (i = 0; i < planes; i++) { int w8, h8, w4, h4, w2, h2; +int16_t *frame2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; @@ -277,28 +293,85 @@ static int alloc_buffers(AVCodecContext *avctx) w2 = w4 * 2; h2 = h4 * 2; -s->plane[i].idwt_buf = -av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); -s->plane[i].idwt_tmp = -av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); -if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) -return AVERROR(ENOMEM); - -s->plane[i].subband[0] = s->plane[i].idwt_buf; -s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; -s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; -s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; -s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; -s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4; -s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4; -s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2; -s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2; -s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2; - -for (j = 0; j < DWT_LEVELS; j++) { -for (k = 0; k < FF_ARRAY_ELEMS(s->plane[i].band[j]); k++) { -s->plane[i].band[j][k].a_width = w8 << j; -s->plane[i].band[j][k].a_height = h8 << j; +if (s->transform_type == 0) { +s->plane[i].idwt_buf = +av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); +s->plane[i].idwt_tmp = +av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); +if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) +return AVERROR(ENOMEM); +} else if (s->transform_type == 2) { +s->plane[i].idwt_buf = +av_mallocz_array(2 * height * stride, sizeof(*s->plane[i].idwt_buf)); +s->plane[i].idwt_tmp = +av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); +if
Re: [FFmpeg-devel] [PATCH][ticket #5522] lavc/cfhd: interlaced frame decoding added
On Wed, 23 May 2018, 04:05 Carl Eugen Hoyos, wrote: > 2018-05-23 0:21 GMT+02:00, Hendrik Leppkes : > > On Tue, May 22, 2018 at 10:35 PM, Carl Eugen Hoyos > > wrote: > >> 2018-05-22 17:40 GMT+02:00, Gagandeep Singh >: > >> > >>> +low= s->plane[plane].subband[0]; > >>> +high = s->plane[plane].subband[8]; > >>> +output = s->plane[plane].l_h[6]; > >>> +for (i = 0; i < lowpass_width; i++) { > >>> +vert_filter(output, lowpass_width, low, lowpass_width, > >>> high, highpass_stride, lowpass_height); > >>> +low++; > >>> +high++; > >>> +output++; > >>> +} > >>> > >>> -low= s->plane[plane].subband[0]; > >>> -high = s->plane[plane].subband[8]; > >>> -output = s->plane[plane].l_h[6]; > >>> -for (i = 0; i < lowpass_width; i++) { > >>> -vert_filter(output, lowpass_width, low, lowpass_width, > high, > >>> highpass_stride, lowpass_height); > >>> -low++; > >>> -high++; > >>> -output++; > >>> -} > >> > >> The patch will get much more readable (and easier to review) > >> if you do not re-indent, instead send a second patch with the > >> cosmetic changes only. > >> > > > > Except, no sane developer works like that. > > It's great to know that you are so much smarter than most developers, > I will forward the next regression directly to you to fix it. > > Thank you, Carl Eugen > I will keep the cosmetic patch also in mind next time Gagandeep Singh > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH][ticket #5522] lavc/cfhd: interlaced frame decoding added
ticket #5522 output of given samples significantly improved --- libavcodec/cfhd.c | 181 +++--- libavcodec/cfhd.h | 9 +++ 2 files changed, 155 insertions(+), 35 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 7ceb803595..051d210355 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -49,12 +49,15 @@ enum CFHDParam { SubbandNumber= 48, Quantization = 53, ChannelNumber= 62, +SampleFlags = 68, BitsPerComponent = 101, ChannelWidth = 104, ChannelHeight= 105, PrescaleShift= 109, }; + + static av_cold int cfhd_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; @@ -72,6 +75,13 @@ static void init_plane_defaults(CFHDContext *s) s->subband_num_actual = 0; } +static void init_peak_table_defaults(CFHDContext *s) +{ +s->peak.level = 0; +s->peak.offset = 0; +s->peak.base = NULL; +} + static void init_frame_defaults(CFHDContext *s) { s->coded_width = 0; @@ -86,15 +96,44 @@ static void init_frame_defaults(CFHDContext *s) s->wavelet_depth = 3; s->pshift= 1; s->codebook = 0; +s->difference_coding = 0; +s->progressive = 0; init_plane_defaults(s); +init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation) +static inline int dequant_and_decompand(int level, int quantisation, int codebook) +{ +if (codebook == 0 || codebook == 1) { +int64_t abslevel = abs(level); +if (level < 264) +return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * + FFSIGN(level) * quantisation; +else +return level * quantisation; +} else +return level * quantisation; +} + +static inline void difference_coding(int16_t *band, int width, int height) +{ + +int i,j; +for (i = 0; i < height; i++) { +for (j = 1; j < width; j++) { + band[j] += band[j-1]; +} +band += width; +} +} + +static inline void peak_table(int16_t *band, Peak *peak, int length) { -int64_t abslevel = abs(level); -return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * - FFSIGN(level) * quantisation; +int i; +for (i = 0; i < length; i++) +if (abs(band[i]) > peak->level) +band[i] = *(peak->base++); } static inline void process_alpha(int16_t *alpha, int width) @@ -154,6 +193,18 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } +static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int plane) +{ +int i; +int16_t even, odd; +for (i = 0; i < width; i++) { +even = (low[i] - high[i])/2; +odd = (low[i] + high[i])/2; +output[i]= av_clip_uintp2(even, 10); +output[i + linesize] = av_clip_uintp2(odd, 10); +} +} static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, int width) { @@ -295,6 +346,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, uint16_t data = bytestream2_get_be16(&gb); if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) { av_log(avctx, AV_LOG_DEBUG, "large len %x\n", ((tagu & 0xff) << 16) | data); +} else if (tag == SampleFlags) { +av_log(avctx, AV_LOG_DEBUG, "Progressive?%"PRIu16"\n", data); +s->progressive = data & 0x0001; } else if (tag == ImageWidth) { av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16"\n", data); s->coded_width = data; @@ -393,6 +447,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } av_log(avctx, AV_LOG_DEBUG, "Transform-type? %"PRIu16"\n", data); } else if (abstag >= 0x4000 && abstag <= 0x40ff) { +if (abstag == 0x4001) +s->peak.level = 0; av_log(avctx, AV_LOG_DEBUG, "Small chunk length %d %s\n", data * 4, tag < 0 ? "optional" : "required"); bytestream2_skipu(&gb, data * 4); } else if (tag == 23) { @@ -450,7 +506,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, s->codebook = data; av_log(avctx, AV_LOG_DEBUG, "Codebook %i\n", s->codebook); } else if (tag == 72) { -s->codebook = data; +s->codebook = data & 0xf; +s->difference_coding = (data >> 4) & 1; av_log(avctx, AV_LOG_DEBUG, "Other codebook? %i\n", s->codebook); } else if (tag == 70) { av_log(avctx, AV_LOG_DEBUG, "Subsampling or bit-depth flag? %i\n", data); @@ -477,6 +534,19 @@ static int cfhd_decode(AVCodecContext *avctx, void *da
[FFmpeg-devel] [PATCH] lavc/cfhd: deinterlacing introduced in cfhd
--- libavcodec/cfhd.c | 177 +- libavcodec/cfhd.h | 9 +++ 2 files changed, 158 insertions(+), 28 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 7ceb803595..d70c13592c 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -49,12 +49,15 @@ enum CFHDParam { SubbandNumber= 48, Quantization = 53, ChannelNumber= 62, +SampleFlags = 68, BitsPerComponent = 101, ChannelWidth = 104, ChannelHeight= 105, PrescaleShift= 109, }; + + static av_cold int cfhd_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; @@ -72,6 +75,13 @@ static void init_plane_defaults(CFHDContext *s) s->subband_num_actual = 0; } +static void init_peak_table_defaults(CFHDContext *s) +{ +s->peak.level = 0; +s->peak.offset = 0; +s->peak.base = NULL; +} + static void init_frame_defaults(CFHDContext *s) { s->coded_width = 0; @@ -86,15 +96,45 @@ static void init_frame_defaults(CFHDContext *s) s->wavelet_depth = 3; s->pshift= 1; s->codebook = 0; +s->difference_coding = 0; +s->progressive = 0; init_plane_defaults(s); +init_peak_table_defaults(s); } /* TODO: merge with VLC tables or use LUT */ -static inline int dequant_and_decompand(int level, int quantisation) +static inline int dequant_and_decompand(int level, int quantisation, int codebook) { -int64_t abslevel = abs(level); -return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * - FFSIGN(level) * quantisation; +if (codebook == 0 || codebook == 1) { +int64_t abslevel = abs(level); +if (level < 264) +return (abslevel + ((768 * abslevel * abslevel * abslevel) / (255 * 255 * 255))) * + FFSIGN(level) * quantisation; +else +return level * quantisation; + } +else +return level * quantisation; +} + +static inline void difference_coding(int16_t *band, int width, int height) +{ + +int i,j; +for (i = 0; i < height; i++) { + for (j = 1; j < width; j++) { +band[j] += band[j-1]; + } + band += width; +} +} + +static inline void peak_table(int16_t *band, Peak *peak, int length) +{ +int i; +for (i = 0; i < length; i++) +if (abs(band[i]) > peak->level) +band[i] = *(++peak->base); } static inline void process_alpha(int16_t *alpha, int width) @@ -154,6 +194,26 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } +static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int plane) +{ +int i; +int16_t even, odd; +for (i = 0; i < width; i++) { + even = (*low - *high)/2; + odd = (*low + *high)/2; + + even = FFMIN(1023, even); + even = FFMAX(0, even); + odd = FFMIN(1023, odd); + odd = FFMAX(0, odd); + + output[i] = even; + output[i + linesize] = odd; + low++; + high++; +} +} static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, int width) { @@ -295,6 +355,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, uint16_t data = bytestream2_get_be16(&gb); if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) { av_log(avctx, AV_LOG_DEBUG, "large len %x\n", ((tagu & 0xff) << 16) | data); +} else if (tag == SampleFlags) { +av_log(avctx, AV_LOG_DEBUG, "Progressive?%"PRIu16"\n", data); +s->progressive = data & 0x0001; } else if (tag == ImageWidth) { av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16"\n", data); s->coded_width = data; @@ -393,6 +456,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } av_log(avctx, AV_LOG_DEBUG, "Transform-type? %"PRIu16"\n", data); } else if (abstag >= 0x4000 && abstag <= 0x40ff) { +if (abstag == 0x4001) +s->peak.level = 0; av_log(avctx, AV_LOG_DEBUG, "Small chunk length %d %s\n", data * 4, tag < 0 ? "optional" : "required"); bytestream2_skipu(&gb, data * 4); } else if (tag == 23) { @@ -450,7 +515,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, s->codebook = data; av_log(avctx, AV_LOG_DEBUG, "Codebook %i\n", s->codebook); } else if (tag == 72) { -s->codebook = data; +s->codebook = data & 0xf; +s->difference_coding = (data >> 4) & 1; av_log(avctx, AV_LOG_DEBUG, "Other codebook? %i\n", s->codebook); } else if (tag == 70) { av_log(avctx, AV_LOG_DEBUG, "Subsampling or bit-depth flag? %i\n", data); @@ -477,6 +543,19 @@ static int cfhd_decode(AV
[FFmpeg-devel] Feeling Ecstatic for Getting selected in GSOC
Hi Guys, I am really happy for your trust in me to handle the project, and for giving me the opportunity by approving the project for GSOC. I will try to do my best for the same. Kierank and Durandal_1707, special thanks for the support throughout. Sincerely, Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] Decrease in activity for a month
As I had written in a previous mail that I will be trying to participate in gsoc for FFmpeg, that part I have committed to myself for the last month, but since my collage exams are after 3 weeks so for the this month I will usually be difficult to reach from irc. If anyone needs to contact me please use mailing list. Gagandeep Singh ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: debugged padding issue for last 8 pixels distortion
On Tue, 27 Mar 2018, 12:54 Gagandeep Singh, wrote: > fate reference has also been updated and can be tested that the patched > output is better for the sample cfhd_odd.mov in fate reference. fixes > ticket #6675. > --- > libavcodec/cfhd.c | 5 +++-- > tests/ref/fate/cfhd-3 | 20 ++-- > 2 files changed, 13 insertions(+), 12 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index e35732df45..f10742f4fa 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx) > int width = i ? avctx->width >> chroma_x_shift : avctx->width; > int height = i ? avctx->height >> chroma_y_shift : avctx->height; > ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; > -height = FFALIGN(height / 8, 2) * 8; > +if (chroma_y_shift) > +height = FFALIGN(height / 8, 2) * 8; > s->plane[i].width = width; > s->plane[i].height = height; > s->plane[i].stride = stride; > > w8 = FFALIGN(s->plane[i].width / 8, 8); > -h8 = FFALIGN(s->plane[i].height / 8, 2); > +h8 = height / 8; > w4 = w8 * 2; > h4 = h8 * 2; > w2 = w4 * 2; > diff --git a/tests/ref/fate/cfhd-3 b/tests/ref/fate/cfhd-3 > index 60e13c64a7..59fdc92260 100644 > --- a/tests/ref/fate/cfhd-3 > +++ b/tests/ref/fate/cfhd-3 > @@ -3,13 +3,13 @@ > #codec_id 0: rawvideo > #dimensions 0: 496x241 > #sar 0: 0/1 > -0, 0, 0,1, 478144, 0x6ed01dcd > -0, 1, 1,1, 478144, 0x6ed01dcd > -0, 2, 2,1, 478144, 0x6ed01dcd > -0, 3, 3,1, 478144, 0xb1b4a74b > -0, 4, 4,1, 478144, 0x94c345c3 > -0, 5, 5,1, 478144, 0x05e0388d > -0, 6, 6,1, 478144, 0xe747476a > -0, 7, 7,1, 478144, 0x8c1561f1 > -0, 8, 8,1, 478144, 0x8c1561f1 > -0, 9, 9,1, 478144, 0x8c1561f1 > +0, 0, 0,1, 478144, 0x48a01dbb > +0, 1, 1,1, 478144, 0x48a01dbb > +0, 2, 2,1, 478144, 0x48a01dbb > +0, 3, 3,1, 478144, 0xb978a72f > +0, 4, 4,1, 478144, 0x7bbb4679 > +0, 5, 5,1, 478144, 0xc3fd3f59 > +0, 6, 6,1, 478144, 0xfd2a4816 > +0, 7, 7,1, 478144, 0x207f65d3 > +0, 8, 8,1, 478144, 0x207f65d3 > +0, 9, 9,1, 478144, 0x207f65d3 > -- 2.14.1 > Guys, this patch hasn't been applied yet, please comment if there are any issues. Gagandeep Singh > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] lavc/cfhd: error due to improper allocation of height in buffers
On Tue, 27 Mar 2018, 12:41 Gagandeep Singh, wrote: > ticket #6675 the distortion in the bottom 8 pixels fixed > --- > libavcodec/cfhd.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index e35732df45..f10742f4fa 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx) > int width = i ? avctx->width >> chroma_x_shift : avctx->width; > int height = i ? avctx->height >> chroma_y_shift : avctx->height; > ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; > -height = FFALIGN(height / 8, 2) * 8; > +if (chroma_y_shift) > +height = FFALIGN(height / 8, 2) * 8; > s->plane[i].width = width; > s->plane[i].height = height; > s->plane[i].stride = stride; > > w8 = FFALIGN(s->plane[i].width / 8, 8); > -h8 = FFALIGN(s->plane[i].height / 8, 2); > +h8 = height / 8; > w4 = w8 * 2; > h4 = h8 * 2; > w2 = w4 * 2; > -- > 2.14.1 > > > From b1912774babcf737bd20ce0264c9b10fd0ca0183 Mon Sep 17 00:00:00 2001 > From: Gagandeep Singh > Date: Tue, 27 Mar 2018 12:34:27 +0530 > Subject: [FFmpeg-devel][PATCH 2/2] tests/ref/fate/cfhd-3: updated > reference to work with the > patch > > the output can be confirmed to be better than the one with the reference > hash. > --- > tests/ref/fate/cfhd-3 | 20 ++-- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/tests/ref/fate/cfhd-3 b/tests/ref/fate/cfhd-3 > index 60e13c64a7..59fdc92260 100644 > --- a/tests/ref/fate/cfhd-3 > +++ b/tests/ref/fate/cfhd-3 > @@ -3,13 +3,13 @@ > #codec_id 0: rawvideo > #dimensions 0: 496x241 > #sar 0: 0/1 > -0, 0, 0,1, 478144, 0x6ed01dcd > -0, 1, 1,1, 478144, 0x6ed01dcd > -0, 2, 2,1, 478144, 0x6ed01dcd > -0, 3, 3,1, 478144, 0xb1b4a74b > -0, 4, 4,1, 478144, 0x94c345c3 > -0, 5, 5,1, 478144, 0x05e0388d > -0, 6, 6,1, 478144, 0xe747476a > -0, 7, 7,1, 478144, 0x8c1561f1 > -0, 8, 8,1, 478144, 0x8c1561f1 > -0, 9, 9,1, 478144, 0x8c1561f1 > +0, 0, 0,1, 478144, 0x48a01dbb > +0, 1, 1,1, 478144, 0x48a01dbb > +0, 2, 2,1, 478144, 0x48a01dbb > +0, 3, 3,1, 478144, 0xb978a72f > +0, 4, 4,1, 478144, 0x7bbb4679 > +0, 5, 5,1, 478144, 0xc3fd3f59 > +0, 6, 6,1, 478144, 0xfd2a4816 > +0, 7, 7,1, 478144, 0x207f65d3 > +0, 8, 8,1, 478144, 0x207f65d3 > +0, 9, 9,1, 478144, 0x207f65d3 > -- > 2.14.1 > Don't use this patch, I have sent updated patch mail , here I messed up combining two commits > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: debugged padding issue for last 8 pixels distortion
fate reference has also been updated and can be tested that the patched output is better for the sample cfhd_odd.mov in fate reference. fixes ticket #6675. --- libavcodec/cfhd.c | 5 +++-- tests/ref/fate/cfhd-3 | 20 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index e35732df45..f10742f4fa 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx) int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -height = FFALIGN(height / 8, 2) * 8; +if (chroma_y_shift) +height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); -h8 = FFALIGN(s->plane[i].height / 8, 2); +h8 = height / 8; w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; diff --git a/tests/ref/fate/cfhd-3 b/tests/ref/fate/cfhd-3 index 60e13c64a7..59fdc92260 100644 --- a/tests/ref/fate/cfhd-3 +++ b/tests/ref/fate/cfhd-3 @@ -3,13 +3,13 @@ #codec_id 0: rawvideo #dimensions 0: 496x241 #sar 0: 0/1 -0, 0, 0,1, 478144, 0x6ed01dcd -0, 1, 1,1, 478144, 0x6ed01dcd -0, 2, 2,1, 478144, 0x6ed01dcd -0, 3, 3,1, 478144, 0xb1b4a74b -0, 4, 4,1, 478144, 0x94c345c3 -0, 5, 5,1, 478144, 0x05e0388d -0, 6, 6,1, 478144, 0xe747476a -0, 7, 7,1, 478144, 0x8c1561f1 -0, 8, 8,1, 478144, 0x8c1561f1 -0, 9, 9,1, 478144, 0x8c1561f1 +0, 0, 0,1, 478144, 0x48a01dbb +0, 1, 1,1, 478144, 0x48a01dbb +0, 2, 2,1, 478144, 0x48a01dbb +0, 3, 3,1, 478144, 0xb978a72f +0, 4, 4,1, 478144, 0x7bbb4679 +0, 5, 5,1, 478144, 0xc3fd3f59 +0, 6, 6,1, 478144, 0xfd2a4816 +0, 7, 7,1, 478144, 0x207f65d3 +0, 8, 8,1, 478144, 0x207f65d3 +0, 9, 9,1, 478144, 0x207f65d3 -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] lavc/cfhd: error due to improper allocation of height in buffers
ticket #6675 the distortion in the bottom 8 pixels fixed --- libavcodec/cfhd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index e35732df45..f10742f4fa 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx) int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -height = FFALIGN(height / 8, 2) * 8; +if (chroma_y_shift) +height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); -h8 = FFALIGN(s->plane[i].height / 8, 2); +h8 = height / 8; w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; -- 2.14.1 From b1912774babcf737bd20ce0264c9b10fd0ca0183 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Tue, 27 Mar 2018 12:34:27 +0530 Subject: [FFmpeg-devel][PATCH 2/2] tests/ref/fate/cfhd-3: updated reference to work with the patch the output can be confirmed to be better than the one with the reference hash. --- tests/ref/fate/cfhd-3 | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/ref/fate/cfhd-3 b/tests/ref/fate/cfhd-3 index 60e13c64a7..59fdc92260 100644 --- a/tests/ref/fate/cfhd-3 +++ b/tests/ref/fate/cfhd-3 @@ -3,13 +3,13 @@ #codec_id 0: rawvideo #dimensions 0: 496x241 #sar 0: 0/1 -0, 0, 0,1, 478144, 0x6ed01dcd -0, 1, 1,1, 478144, 0x6ed01dcd -0, 2, 2,1, 478144, 0x6ed01dcd -0, 3, 3,1, 478144, 0xb1b4a74b -0, 4, 4,1, 478144, 0x94c345c3 -0, 5, 5,1, 478144, 0x05e0388d -0, 6, 6,1, 478144, 0xe747476a -0, 7, 7,1, 478144, 0x8c1561f1 -0, 8, 8,1, 478144, 0x8c1561f1 -0, 9, 9,1, 478144, 0x8c1561f1 +0, 0, 0,1, 478144, 0x48a01dbb +0, 1, 1,1, 478144, 0x48a01dbb +0, 2, 2,1, 478144, 0x48a01dbb +0, 3, 3,1, 478144, 0xb978a72f +0, 4, 4,1, 478144, 0x7bbb4679 +0, 5, 5,1, 478144, 0xc3fd3f59 +0, 6, 6,1, 478144, 0xfd2a4816 +0, 7, 7,1, 478144, 0x207f65d3 +0, 8, 8,1, 478144, 0x207f65d3 +0, 9, 9,1, 478144, 0x207f65d3 -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: error due to improper allocation of height in buffers
ticket #6675 the distortion in the bottom 8 pixels fixed --- libavcodec/cfhd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index e35732df45..f10742f4fa 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx) int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -height = FFALIGN(height / 8, 2) * 8; +if (chroma_y_shift) +height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); -h8 = FFALIGN(s->plane[i].height / 8, 2); +h8 = height / 8; w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12
On Fri, 23 Mar 2018, 11:04 Gagandeep Singh, wrote: > > > On Fri, 23 Mar 2018, 04:26 Aurelien Jacobs, wrote: > >> On Wed, Mar 21, 2018 at 10:19:58PM +0530, Gagandeep Singh wrote: >> > alpha decompanding curve added to post process the decoded alpha channel >> > --- >> > libavcodec/cfhd.c | 19 +++ >> > 1 file changed, 19 insertions(+) >> > >> > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c >> > index fd834b..e35732df45 100644 >> > --- a/libavcodec/cfhd.c >> > +++ b/libavcodec/cfhd.c >> > @@ -37,6 +37,9 @@ >> > #include "thread.h" >> > #include "cfhd.h" >> > >> > +#define ALPHA_COMPAND_DC_OFFSET 256 >> > +#define ALPHA_COMPAND_GAIN 9400 >> > + >> > enum CFHDParam { >> > ChannelCount = 12, >> > SubbandCount = 14, >> > @@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, >> int quantisation) >> > FFSIGN(level) * quantisation; >> > } >> > >> > +static inline void process_alpha(int16_t *alpha, int width) >> > +{ >> > +int i, channel; >> > +for (i = 0; i < width; i++) { >> > +channel = alpha[i]; >> > +channel -= ALPHA_COMPAND_DC_OFFSET; >> > +channel <<= 3; >> > +channel *= ALPHA_COMPAND_GAIN; >> >> Any reason why you can't merge the << 3 (ie. * 8) with the >> * ALPHA_COMPAND_GAIN ? >> >> > +channel >>= 16; >> >> > +channel = av_clip_uintp2(channel, 12); >> > +alpha[i] = channel; >> >> Here you should affect the result of av_clip_uintp2 directly to alpha[i]. >> >> Actually, I think it would be more readable by dropping the channel >> intermediate variable entirely. You could write this function like this >> (untested): >> >> static inline void process_alpha(int16_t *alpha, int width) >> { >> for (int i = 0; i < width; i++) >> alpha[i] = av_clip_uintp2(((alpha[i] - 256) * 75200) >> 16, 12); >> } >> >> Of course, you can use DC_OFFSET and GAIN constants in there if you >> think it is more readable. >> > > I will test it, I remember the problem was with the bit shifting in alpha > as it is originally smaller than channel, so I used 32 bit channel, but I > will see if it can also work your way. > Basically the max alpha value (4095) was overflowing on directly using alpha, I might be able to shorten it using some type change > ___ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12
On Fri, 23 Mar 2018, 04:26 Aurelien Jacobs, wrote: > On Wed, Mar 21, 2018 at 10:19:58PM +0530, Gagandeep Singh wrote: > > alpha decompanding curve added to post process the decoded alpha channel > > --- > > libavcodec/cfhd.c | 19 +++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > > index fd834b..e35732df45 100644 > > --- a/libavcodec/cfhd.c > > +++ b/libavcodec/cfhd.c > > @@ -37,6 +37,9 @@ > > #include "thread.h" > > #include "cfhd.h" > > > > +#define ALPHA_COMPAND_DC_OFFSET 256 > > +#define ALPHA_COMPAND_GAIN 9400 > > + > > enum CFHDParam { > > ChannelCount = 12, > > SubbandCount = 14, > > @@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, > int quantisation) > > FFSIGN(level) * quantisation; > > } > > > > +static inline void process_alpha(int16_t *alpha, int width) > > +{ > > +int i, channel; > > +for (i = 0; i < width; i++) { > > +channel = alpha[i]; > > +channel -= ALPHA_COMPAND_DC_OFFSET; > > +channel <<= 3; > > +channel *= ALPHA_COMPAND_GAIN; > > Any reason why you can't merge the << 3 (ie. * 8) with the > * ALPHA_COMPAND_GAIN ? > > > +channel >>= 16; > > > +channel = av_clip_uintp2(channel, 12); > > +alpha[i] = channel; > > Here you should affect the result of av_clip_uintp2 directly to alpha[i]. > > Actually, I think it would be more readable by dropping the channel > intermediate variable entirely. You could write this function like this > (untested): > > static inline void process_alpha(int16_t *alpha, int width) > { > for (int i = 0; i < width; i++) > alpha[i] = av_clip_uintp2(((alpha[i] - 256) * 75200) >> 16, 12); > } > > Of course, you can use DC_OFFSET and GAIN constants in there if you > think it is more readable. > I will test it, I remember the problem was with the bit shifting in alpha as it is originally smaller than channel, so I used 32 bit channel, but I will see if it can also work your way. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12 ticket #6265
alpha decompanding curve added to post process the decoded alpha channel ticket #6265 --- libavcodec/cfhd.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index fd834b..e35732df45 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -37,6 +37,9 @@ #include "thread.h" #include "cfhd.h" +#define ALPHA_COMPAND_DC_OFFSET 256 +#define ALPHA_COMPAND_GAIN 9400 + enum CFHDParam { ChannelCount = 12, SubbandCount = 14, @@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, int quantisation) FFSIGN(level) * quantisation; } +static inline void process_alpha(int16_t *alpha, int width) +{ +int i, channel; +for (i = 0; i < width; i++) { +channel = alpha[i]; +channel -= ALPHA_COMPAND_DC_OFFSET; +channel <<= 3; +channel *= ALPHA_COMPAND_GAIN; +channel >>= 16; +channel = av_clip_uintp2(channel, 12); +alpha[i] = channel; +} +} + static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, @@ -792,6 +809,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, high = s->plane[plane].l_h[7]; for (i = 0; i < lowpass_height * 2; i++) { horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); +if (act_plane == 3) +process_alpha(dst, lowpass_width * 2); low += lowpass_width; high += lowpass_width; dst += pic->linesize[act_plane] / 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12
On Thu 22 Mar, 2018, 1:54 AM Carl Eugen Hoyos, wrote: > 2018-03-21 17:52 GMT+01:00, Gagandeep Singh : > > On Wed, 21 Mar 2018, 22:20 Gagandeep Singh, > > wrote: > > > ticket #6265 > > Should be part of the commit message. > > Carl Eugen > So, should I send the mail again with proper commit this time. > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12
On Wed, 21 Mar 2018, 22:20 Gagandeep Singh, wrote: > alpha decompanding curve added to post process the decoded alpha channel > --- > libavcodec/cfhd.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index fd834b..e35732df45 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -37,6 +37,9 @@ > #include "thread.h" > #include "cfhd.h" > > +#define ALPHA_COMPAND_DC_OFFSET 256 > +#define ALPHA_COMPAND_GAIN 9400 > + > enum CFHDParam { > ChannelCount = 12, > SubbandCount = 14, > @@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, int > quantisation) > FFSIGN(level) * quantisation; > } > > +static inline void process_alpha(int16_t *alpha, int width) > +{ > +int i, channel; > +for (i = 0; i < width; i++) { > +channel = alpha[i]; > +channel -= ALPHA_COMPAND_DC_OFFSET; > +channel <<= 3; > +channel *= ALPHA_COMPAND_GAIN; > +channel >>= 16; > +channel = av_clip_uintp2(channel, 12); > +alpha[i] = channel; > +} > +} > + > static inline void filter(int16_t *output, ptrdiff_t out_stride, >int16_t *low, ptrdiff_t low_stride, >int16_t *high, ptrdiff_t high_stride, > @@ -792,6 +809,8 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > high = s->plane[plane].l_h[7]; > for (i = 0; i < lowpass_height * 2; i++) { > horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); > +if (act_plane == 3) > +process_alpha(dst, lowpass_width * 2); > low += lowpass_width; > high += lowpass_width; > dst += pic->linesize[act_plane] / 2; > -- > 2.14.1 > ticket #6265 > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: added alpha decompanding in rgba12
alpha decompanding curve added to post process the decoded alpha channel --- libavcodec/cfhd.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index fd834b..e35732df45 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -37,6 +37,9 @@ #include "thread.h" #include "cfhd.h" +#define ALPHA_COMPAND_DC_OFFSET 256 +#define ALPHA_COMPAND_GAIN 9400 + enum CFHDParam { ChannelCount = 12, SubbandCount = 14, @@ -94,6 +97,20 @@ static inline int dequant_and_decompand(int level, int quantisation) FFSIGN(level) * quantisation; } +static inline void process_alpha(int16_t *alpha, int width) +{ +int i, channel; +for (i = 0; i < width; i++) { +channel = alpha[i]; +channel -= ALPHA_COMPAND_DC_OFFSET; +channel <<= 3; +channel *= ALPHA_COMPAND_GAIN; +channel >>= 16; +channel = av_clip_uintp2(channel, 12); +alpha[i] = channel; +} +} + static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, @@ -792,6 +809,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, high = s->plane[plane].l_h[7]; for (i = 0; i < lowpass_height * 2; i++) { horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); +if (act_plane == 3) +process_alpha(dst, lowpass_width * 2); low += lowpass_width; high += lowpass_width; dst += pic->linesize[act_plane] / 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: alpha decompanding added to rgba12 output
Guys, can you analyse this patch. On Wed, 21 Mar 2018, 10:25 Gagandeep Singh, wrote: > decompanding curve or offset were required ticket #6265 > --- > libavcodec/cfhd.c | 19 +++ > 1 file changed, 19 insertions(+) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index a064cd1599..480bf93566 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -94,6 +94,22 @@ static inline int dequant_and_decompand(int level, int > quantisation) > FFSIGN(level) * quantisation; > } > > +static inline void process_alpha(int16_t *alpha, int width) > +{ > +int alphacompandDCoffset = 256; > +int alphacompandGain = 9400; > +int i, channel; > +for (i = 0; i < width; i++) { > +channel = alpha[i]; > +channel -= alphacompandDCoffset; > +channel <<= 3; > +channel *= alphacompandGain; > +channel >>= 16; > +channel = av_clip_uintp2(channel, 12); > +alpha[i] = channel; > +} > +} > + > static inline void filter(int16_t *output, ptrdiff_t out_stride, >int16_t *low, ptrdiff_t low_stride, >int16_t *high, ptrdiff_t high_stride, > @@ -792,6 +808,9 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > high = s->plane[plane].l_h[7]; > for (i = 0; i < lowpass_height * 2; i++) { > horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); > +if (act_plane == 3) { > +process_alpha(dst, lowpass_width * 2); > +} > low += lowpass_width; > high += lowpass_width; > dst += pic->linesize[act_plane] / 2; > -- > 2.14.1 > > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd: alpha decompanding added to rgba12 output
decompanding curve or offset were required ticket #6265 --- libavcodec/cfhd.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a064cd1599..480bf93566 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -94,6 +94,22 @@ static inline int dequant_and_decompand(int level, int quantisation) FFSIGN(level) * quantisation; } +static inline void process_alpha(int16_t *alpha, int width) +{ +int alphacompandDCoffset = 256; +int alphacompandGain = 9400; +int i, channel; +for (i = 0; i < width; i++) { +channel = alpha[i]; +channel -= alphacompandDCoffset; +channel <<= 3; +channel *= alphacompandGain; +channel >>= 16; +channel = av_clip_uintp2(channel, 12); +alpha[i] = channel; +} +} + static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, @@ -792,6 +808,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, high = s->plane[plane].l_h[7]; for (i = 0; i < lowpass_height * 2; i++) { horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); +if (act_plane == 3) { +process_alpha(dst, lowpass_width * 2); +} low += lowpass_width; high += lowpass_width; dst += pic->linesize[act_plane] / 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [FFmpeg][PATCH] lavc/cfhd: alpha decoding added
some post processing was required --- libavcodec/cfhd.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a064cd1599..a950dc0f28 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -94,6 +94,21 @@ static inline int dequant_and_decompand(int level, int quantisation) FFSIGN(level) * quantisation; } +static inline void process_alpha(int16_t *alpha, int width) +{ +int i, channel; +for (i = 0; i < width; i++){ +channel = alpha[i]; +channel -= 16 << 4; +channel <<= 8; +channel -= 128; +channel /= 223; +channel = FFMIN(channel, (1 << 12) - 1); +channel = FFMAX(channel, 0); +alpha[i] = channel; +} +} + static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, @@ -792,6 +807,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, high = s->plane[plane].l_h[7]; for (i = 0; i < lowpass_height * 2; i++) { horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); +if(act_plane == 3) +process_alpha(dst, lowpass_width * 2); low += lowpass_width; high += lowpass_width; dst += pic->linesize[act_plane] / 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd:fixed alpha channel decoding in gbrap12
On Tue, 20 Mar 2018, 16:31 Kieran Kunhya, wrote: > > > > ticket #6265, oops forgot this > > > > Can you confirm this makes the png in the ticket look as expected? > I was expecting the companding curve to also change for alpha. > > Kieran > preserving the limits (max and min) --- libavcodec/cfhd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index d64acab8d4..a950dc0f28 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -103,6 +103,8 @@ static inline void process_alpha(int16_t *alpha, int width) channel <<= 8; channel -= 128; channel /= 223; +channel = FFMIN(channel, (1 << 12) - 1); +channel = FFMAX(channel, 0); alpha[i] = channel; } } -- 2.14.1 > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] lavc/cfhd:fixed alpha channel decoding in gbrap12
On Tue, 20 Mar 2018, 12:44 Gagandeep Singh, wrote: > alpha channel required a post processing after it's decoding > --- > libavcodec/cfhd.c | 15 +++ > 1 file changed, 15 insertions(+) > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > index a064cd1599..d64acab8d4 100644 > --- a/libavcodec/cfhd.c > +++ b/libavcodec/cfhd.c > @@ -94,6 +94,19 @@ static inline int dequant_and_decompand(int level, int > quantisation) > FFSIGN(level) * quantisation; > } > > +static inline void process_alpha(int16_t *alpha, int width) > +{ > +int i, channel; > +for (i = 0; i < width; i++){ > +channel = alpha[i]; > +channel -= 16 << 4; > +channel <<= 8; > +channel -= 128; > +channel /= 223; > +alpha[i] = channel; > +} > +} > + > static inline void filter(int16_t *output, ptrdiff_t out_stride, >int16_t *low, ptrdiff_t low_stride, >int16_t *high, ptrdiff_t high_stride, > @@ -792,6 +805,8 @@ static int cfhd_decode(AVCodecContext *avctx, void > *data, int *got_frame, > high = s->plane[plane].l_h[7]; > for (i = 0; i < lowpass_height * 2; i++) { > horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); > +if(act_plane == 3) > +process_alpha(dst, lowpass_width * 2); > low += lowpass_width; > high += lowpass_width; > dst += pic->linesize[act_plane] / 2; > -- > 2.14.1 > ticket #6265, oops forgot this > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavc/cfhd:fixed alpha channel decoding in gbrap12
alpha channel required a post processing after it's decoding --- libavcodec/cfhd.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a064cd1599..d64acab8d4 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -94,6 +94,19 @@ static inline int dequant_and_decompand(int level, int quantisation) FFSIGN(level) * quantisation; } +static inline void process_alpha(int16_t *alpha, int width) +{ +int i, channel; +for (i = 0; i < width; i++){ +channel = alpha[i]; +channel -= 16 << 4; +channel <<= 8; +channel -= 128; +channel /= 223; +alpha[i] = channel; +} +} + static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, @@ -792,6 +805,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, high = s->plane[plane].l_h[7]; for (i = 0; i < lowpass_height * 2; i++) { horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); +if(act_plane == 3) +process_alpha(dst, lowpass_width * 2); low += lowpass_width; high += lowpass_width; dst += pic->linesize[act_plane] / 2; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [FFmpeg][PATCH] lavc/cfhd: introduced interlaced using temporal horizontal transform
interlaced files require horizontal-temporal transform that has been added. Output is not satisfactory yet! --- libavcodec/cfhd.c | 137 +- libavcodec/cfhd.h | 3 +- 2 files changed, 107 insertions(+), 33 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a064cd1599..da0f0fadf6 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -46,6 +46,7 @@ enum CFHDParam { SubbandNumber= 48, Quantization = 53, ChannelNumber= 62, +Progressive = 68, BitsPerComponent = 101, ChannelWidth = 104, ChannelHeight= 105, @@ -83,6 +84,7 @@ static void init_frame_defaults(CFHDContext *s) s->wavelet_depth = 3; s->pshift= 1; s->codebook = 0; +s->progressive = 0; init_plane_defaults(s); } @@ -137,6 +139,43 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } +static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int plane) +{ +int i; +int even, odd; +for (i = 0; i < width; i++) { + even = (*low - *high)/2; + odd = (*low + *high)/2; + + even = FFMIN(even, 1023); + even = FFMAX(even, 0); + odd = FFMIN(odd, 1023); + odd = FFMAX(odd, 0); + + output[i] = even; + output[i + linesize] = odd; + low++; + high++; +} +} + +static inline void horiz_haar_filter(int16_t *output, int16_t *low, int16_t *high, + int width) +{ +int i; +int even, odd; +for (i = 0; i < width; i+=2) { + even = (*low - *high); + odd = (*low + *high); + + output[i] = even; + output[i + 1] =odd; + low++; + high++; +} +} + static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, int width) { @@ -196,7 +235,8 @@ static int alloc_buffers(AVCodecContext *avctx) int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -if (chroma_y_shift) height = FFALIGN(height / 8, 2) * 8; +if (chroma_y_shift) +height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; @@ -207,7 +247,6 @@ static int alloc_buffers(AVCodecContext *avctx) h4 = h8 * 2; w2 = w4 * 2; h2 = h4 * 2; - s->plane[i].idwt_buf = av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); s->plane[i].idwt_tmp = @@ -247,7 +286,6 @@ static int alloc_buffers(AVCodecContext *avctx) s->a_height = s->coded_height; s->a_width = s->coded_width; s->a_format = s->coded_format; - return 0; } @@ -277,6 +315,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, uint16_t data = bytestream2_get_be16(&gb); if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) { av_log(avctx, AV_LOG_DEBUG, "large len %x\n", ((tagu & 0xff) << 16) | data); +} else if (tag == Progressive) { +av_log(avctx, AV_LOG_DEBUG, "Progressive? %"PRIu16"\n", 0x0001 & data); +s->progressive = 0x0001 & data; } else if (tag == ImageWidth) { av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16"\n", data); s->coded_width = data; @@ -757,7 +798,6 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, lowpass_height = s->plane[plane].band[2][1].height; lowpass_width = s->plane[plane].band[2][1].width; highpass_stride = s->plane[plane].band[2][1].stride; - if (lowpass_height > s->plane[plane].band[2][1].a_height || lowpass_width > s->plane[plane].band[2][1].a_width || !highpass_stride || s->plane[plane].band[2][1].width > s->plane[plane].band[2][1].a_width) { av_log(avctx, AV_LOG_ERROR, "Invalid plane dimensions\n"); @@ -766,36 +806,69 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } av_log(avctx, AV_LOG_DEBUG, "Level 3 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride); +if (s->progressive) { + low= s->plane[plane].subband[0]; + high = s->plane[plane].subband[8]; + output = s->plane[plane].l_h[6]; + for (i = 0; i < lowpass_width; i++) { + vert_filter(output, lowpass_width, low, lowpass_width, high, highpass_stride, lowpass_height); + low++; + high++; + output++; + } + + low= s->plane[plane].subband[7]; + high = s->plane[plane].subband[9]; + output = s->plane[plane].l_h[7]; + for (i = 0; i < lowpass_width; i++
Re: [FFmpeg-devel] [PATCH] lavc/cfhd: added interlaced frame decoding
On Sat, Mar 17, 2018 at 5:00 PM, Carl Eugen Hoyos wrote: > 2018-03-17 10:42 GMT+01:00, Gagandeep Singh : > > ticket #5522: interlaced frame required horizontal-temporal inverse > > transform. though the output is not satisfactory yet. > > > diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c > > index a064cd1599..b17c7c1dc5 100644 > > --- a/libavcodec/cfhd.c > > +++ b/libavcodec/cfhd.c > > @@ -50,8 +50,11 @@ enum CFHDParam { > > ChannelWidth = 104, > > ChannelHeight= 105, > > PrescaleShift= 109, > > +Progressive = 68, > > I suspect this can be ordered better. > > > }; > > > > + > > + > > Please do not add random cosmetic changes to your patch. > > [...] > > > +static inline void interlaced_vertical_filter(int16_t *output, int16_t > > *low, int16_t *high, > > + int width, int linesize, int plane) > > +{ > > +int i; > > > +int16_t even, odd; > > Could the code be simplified by using an unsigned type? > Why not a standard type? > > > +for (i = 0; i < width; i++) { > > > + > > + > > Maybe you disagree, but these empty lines make > reading the code more difficult imo. > > > + even = (*low - *high)/2; > > + odd = (*low + *high)/2; > > + > > + if (even > 1023) even = 1023; > > + if (even < 0) even = 0; > > + if (odd > 1023) odd = 1023; > > + if (odd < 0) odd = 0; > > FFMIN / FFMAX > > [...] > > > + } > > + else { > > Please merge these lines. > > Thank you, Carl Eugen > libavcodec/cfhd.c | 107 +- 1 file changed, 58 insertions(+), 49 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index b17c7c1dc5..57e0042d01 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -46,15 +46,13 @@ enum CFHDParam { SubbandNumber= 48, Quantization = 53, ChannelNumber= 62, +Progressive = 68, BitsPerComponent = 101, ChannelWidth = 104, ChannelHeight= 105, PrescaleShift= 109, -Progressive = 68, }; - - static av_cold int cfhd_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; @@ -145,17 +143,15 @@ static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int int width, int linesize, int plane) { int i; -int16_t even, odd; +int even, odd; for (i = 0; i < width; i++) { - - even = (*low - *high)/2; odd = (*low + *high)/2; - if (even > 1023) even = 1023; - if (even < 0) even = 0; - if (odd > 1023) odd = 1023; - if (odd < 0) odd = 0; + even = FFMIN(even, 1023); + even = FFMAX(even, 0); + odd = FFMIN(odd, 1023); + odd = FFMAX(odd, 0); output[i] = even; output[i + linesize] = odd; @@ -163,6 +159,23 @@ static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int high++; } } + +static inline void horiz_haar_filter(int16_t *output, int16_t *low, int16_t *high, + int width) +{ +int i; +int even, odd; +for (i = 0; i < width; i+=2) { + even = (*low - *high); + odd = (*low + *high); + + output[i] = even; + output[i + 1] =odd; + low++; + high++; +} +} + static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, int width) { @@ -222,7 +235,8 @@ static int alloc_buffers(AVCodecContext *avctx) int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -if (chroma_y_shift) height = FFALIGN(height / 8, 2) * 8; +if (chroma_y_shift) +height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; @@ -233,7 +247,6 @@ static int alloc_buffers(AVCodecContext *avctx) h4 = h8 * 2; w2 = w4 * 2; h2 = h4 * 2; - s->plane[i].idwt_buf = av_mallocz_array(height * stride, sizeof(*s->plane[i].idwt_buf)); s->plane[i].idwt_tmp = @@ -273,7 +286,6 @@ static int alloc_buffers(AVCodecContext *avctx) s->a_height = s->coded_height; s->a_width = s->coded_width; s->a_format = s->coded_format; - return 0; } @@ -304,8 +316,8 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) {
[FFmpeg-devel] [PATCH] lavc/cfhd: added interlaced frame decoding
ticket #5522: interlaced frame required horizontal-temporal inverse transform. though the output is not satisfactory yet. --- libavcodec/cfhd.c | 102 -- libavcodec/cfhd.h | 3 +- 2 files changed, 85 insertions(+), 20 deletions(-) diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index a064cd1599..b17c7c1dc5 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -50,8 +50,11 @@ enum CFHDParam { ChannelWidth = 104, ChannelHeight= 105, PrescaleShift= 109, +Progressive = 68, }; + + static av_cold int cfhd_init(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; @@ -83,6 +86,7 @@ static void init_frame_defaults(CFHDContext *s) s->wavelet_depth = 3; s->pshift= 1; s->codebook = 0; +s->progressive = 0; init_plane_defaults(s); } @@ -137,6 +141,28 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, } } +static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, + int width, int linesize, int plane) +{ +int i; +int16_t even, odd; +for (i = 0; i < width; i++) { + + + even = (*low - *high)/2; + odd = (*low + *high)/2; + + if (even > 1023) even = 1023; + if (even < 0) even = 0; + if (odd > 1023) odd = 1023; + if (odd < 0) odd = 0; + + output[i] = even; + output[i + linesize] = odd; + low++; + high++; +} +} static void horiz_filter(int16_t *output, int16_t *low, int16_t *high, int width) { @@ -277,6 +303,9 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, uint16_t data = bytestream2_get_be16(&gb); if (abs_tag8 >= 0x60 && abs_tag8 <= 0x6f) { av_log(avctx, AV_LOG_DEBUG, "large len %x\n", ((tagu & 0xff) << 16) | data); +} else if (tag == Progressive) { +av_log(avctx, AV_LOG_DEBUG, "Progressive?%"PRIu16"\n", data); +s->progressive = data; } else if (tag == ImageWidth) { av_log(avctx, AV_LOG_DEBUG, "Width %"PRIu16"\n", data); s->coded_width = data; @@ -766,36 +795,71 @@ static int cfhd_decode(AVCodecContext *avctx, void *data, int *got_frame, } av_log(avctx, AV_LOG_DEBUG, "Level 3 plane %i %i %i %i\n", plane, lowpass_height, lowpass_width, highpass_stride); - +if (s->progressive) { + low= s->plane[plane].subband[0]; + high = s->plane[plane].subband[8]; + output = s->plane[plane].l_h[6]; + for (i = 0; i < lowpass_width; i++) { + vert_filter(output, lowpass_width, low, lowpass_width, high, highpass_stride, lowpass_height); + low++; + high++; + output++; + } + + low= s->plane[plane].subband[7]; + high = s->plane[plane].subband[9]; + output = s->plane[plane].l_h[7]; + for (i = 0; i < lowpass_width; i++) { + vert_filter(output, lowpass_width, low, highpass_stride, high, highpass_stride, lowpass_height); + low++; + high++; + output++; + } + + dst = (int16_t *)pic->data[act_plane]; + low = s->plane[plane].l_h[6]; + high = s->plane[plane].l_h[7]; + for (i = 0; i < lowpass_height * 2; i++) { + horiz_filter_clip(dst, low, high, lowpass_width, s->bpc); + low += lowpass_width; + high += lowpass_width; + dst += pic->linesize[act_plane] / 2; + } + } + else { + +av_log(avctx, AV_LOG_DEBUG, "interlaced frame ? %d", pic->interlaced_frame); +pic->interlaced_frame = 1; low= s->plane[plane].subband[0]; -high = s->plane[plane].subband[8]; +high = s->plane[plane].subband[7]; output = s->plane[plane].l_h[6]; -for (i = 0; i < lowpass_width; i++) { -vert_filter(output, lowpass_width, low, lowpass_width, high, highpass_stride, lowpass_height); -low++; -high++; -output++; +for (i = 0; i < lowpass_height; i++) { +horiz_filter(output, low, high, lowpass_width); +low+= lowpass_width; +high += lowpass_width; +output += lowpass_width * 2; } -low= s->plane[plane].subband[7]; +low= s->plane[plane].subband[8]; high = s->plane[plane].subband[9]; output = s->plane[plane].l_h[7]; -for (i = 0; i < lowpass_width; i++) { -vert_filter(output, lowpass_width, low, highpass_stride, high, highpass_stride, lowpass_height); -low++; -high++; -output++; +for (i = 0; i < lowpass_height; i++) { +horiz_filter(output, low, high, lowpass_width); +low
Re: [FFmpeg-devel] [PATCH] area changed:in cfhd height initialization was buggy for chroma plane
Thanks, sure will take care next time :) On Fri, 16 Mar 2018, 20:26 Carl Eugen Hoyos, wrote: > 2018-03-16 11:27 GMT+01:00, Gagandeep Singh : > > From: Gagandeep Singh > > Thank you for the important patch! > > The first line of the commit message should not start with "area changed" > but something similar to "lavc/cfhd: " which means you can also remove > "cfhd" from the rest of the first line. > > > description:when the chroma_y_shift was not present, the FFALIGN used to > > round the height was unnecessary for 0 chroma shift in y direction. > > The word description is unnecessary. > Please mention ticket #6675, without it is impossible to ever do a > regression test. > > > --- > > libavcodec/cfhd.c | 6 +++--- > > > libavcodec/tests/codec_desc | Bin 0 -> 189776 bytes > > You should not add the file codec_desc to your commit... > > Thank you, Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] area changed:in cfhd height initialization was buggy for chroma plane
From: Gagandeep Singh description:when the chroma_y_shift was not present, the FFALIGN used to round the height was unnecessary for 0 chroma shift in y direction. --- libavcodec/cfhd.c | 6 +++--- libavcodec/tests/codec_desc | Bin 0 -> 189776 bytes 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100755 libavcodec/tests/codec_desc diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index fd834b..a064cd1599 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -195,14 +195,14 @@ static int alloc_buffers(AVCodecContext *avctx) int w8, h8, w4, h4, w2, h2; int width = i ? avctx->width >> chroma_x_shift : avctx->width; int height = i ? avctx->height >> chroma_y_shift : avctx->height; -ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; -height = FFALIGN(height / 8, 2) * 8; +ptrdiff_t stride = FFALIGN(width / 8, 8) * 8; +if (chroma_y_shift) height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); -h8 = FFALIGN(s->plane[i].height / 8, 2); +h8 = height / 8; w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; diff --git a/libavcodec/tests/codec_desc b/libavcodec/tests/codec_desc new file mode 100755 index ..9ab8ff99476f136327817d3b270f6fe072be1ed6 GIT binary patch literal 189776 zcmc${3s_v$x&OaOh#@vQSQCr4c56w6HY7ku1Y4B}1KH@1OadWzD@=v~#xTreE@Wc8 z;2~6|h^42tO;0^7ww{)@o;JOu)MG6qnxLnxcrD)1svV3M>J@L{|9#hf_b~G&sqO!H z&hwj=S$lofyVvDiYrX3_@w!T9)x3-h&HBvOF3`v~eWgjtIUxJVdHkel2;a-J zT00km_UJvWhI3GJmMLJloPUj7t9(>8`m19uU56QqX1OFwAJ+?! zW_o`33FSS)eVMaixz>9d@t(@3`PxT*XS2j6PVZQH$!5J+E+?<8Z1-(lQ?jzXxuD(G z5sekZO4k&uDOnK?tSDCHrua#A-TKWcC8}>rRg~u?_#;N)XT9+7nSY5+fAZnKEm(2J zO?w_Yr)Srf=w0g%kN@=NFeE>I6zRo?>}Y(;G5D>=i0345{V4JO_89Va9fS8CgP(qk z{5*RM`FoDRe{>99d5rikI0lb{>xfH!{swR~eO`JD{^~LKw~xWkK1P0ib`1H4j=^^x zgBO77_>-TNNcU_B;r}E4j#l1v$KVSP54DveKIk{WNL$G3Zl=yss5MsC)igGHL*7W788zCS5kEmLLAzw$Ng(A~hg3(A=y&v3(pw4hdN?@xu;_c|fizqO?m==h*C{4;) z$P?VDVry*l#N3T7z7FL2Dletz@dqJ7<)RXVB8`5xuS07IdA-^?XZ6~O#^M#lD^@3; zi%OD@b5E;Qlpu~)f1rcoXhb#5gFTw3Y!rQGs%LsK*#e9L6mI>I{5&wrre(ldp~^L~ zdpiE2r}-Aq$ZMY0Ip?sZ~odhVXhZwZ3ri}#OFJKMvO4~Bd5~)^R;W(Z^kz- z8J{(7S>w(0HcCa)X5P@1YwIg51s`O-NATO3j|je(`MBVt%qIlDpZT=lPcYZs(v|+K zdU=6)w%~6v*9EuqQz-c2Kd5LmL-6beP2MK>QsyziKgGOP@Ot}&%9UgA2Q!9xb}#d z&mqC@X8B>kb(S9!{2`W~5PXVxLhuYO?~LFE$Dj3%t}HAo%Z?w+VhX^O)d&WH-9Krw2@#G2q7IQ=JtN%k&AD7@aFpmj- zGxILNzsG#H;N@(Oh6KNz<@X5w3+5Ao|Cafr;5j@`$oe2%KXNG1DCvd=c{*!9T%V`!HQUXE4tb zypVaJ;O8=L5d1>sO@dc4j|r~x_}wdbEz1uGemV1D!CRP*2;RW$At88><);PjW%-=L z>H4{f<#oY_S>6zQ7t6Z@k28-6{ypYhg5Sn`NbozD?-4xl2eUm)2tLB{lY$>$o;90Z z-Updy3!Xh<#$PJp{gMxRl{BFUYW%)tDr0HSo6lkET1R1&b(0YVa~rH_#n?G8U$a)@iYm(oO!R{=P@4;`~v2~f>$vg z5xj|1WzsP(@@cG|0^|nWF z8}kXlKh1nn@a4?27NnQ=eCFAL8(d$dg0E%ya>0Wv-zNAvmJbTPo8@;4Uc>T(f)BI& znBXV<7q@@GH*q{Og1eb($DO5Kw8n*2=6QneU|uNr)yx|Nk27x){3hnTg8T0>^FJW? z1ebSEaBF{USn&Vg_(uf)F7t%ocQT(Ae1v(VofN`9i_1^D{&6UvfMy!4sU% zCc*c-sjGa%1mDH!b_w3gd`R$HneP$&N6g0rALRYk3Bljkqq3t-3jPa@C+ozs()9Kx z=GlTjz`RuOCzzKD{tWXr!Czq>6#QN0y9Iyp4m1CQf-nBQ$;Sl$B=d2>v-g|wGlHMZ z@|x|eG(D8Fe4gM-eqqK_DEK)XPlMn^%$o!+VcskFkk!8guVnc_!L4)RVZpCp`4Pdr z%oBoN#e7=uAnPF~J6%85v%D_&0LvSK_p-c8@SB*&1izVim*BgZ4+;K#=6eLco%w{| zzhyot`0tr#os?eQ{miokKghgP@MoBp3;tK;ZGwNuJSh0_KQPe$Cwuiehu>m!TXsv3I28Fy@LN2^8vws%6wSxdzg<1 zelPQc;Eyt&7Tk(I=j3!fJi+q1;CuF)^<@bD49mL&|10yD;M#3wJY9k>U_K=HY0UQs z{%PhDf|oI$6x_i)Ye{-}>zQW@ei`#p!RxH`j^JUIZxj40%!7j8%zU@t-(x-~_yp^J zOzFRd*<5GbUlnR&lCI+=7oYk#=JrBXPGw%o?zZ9_zd#_!9Qd^EcjyH z4;c|$yW4D63BgZc`DwxPSU%^JbUmEK^19%kVQvUs&fFz<74w+jmoo1X+{1iG@F?>= zf?v&iLhx@gpA`Jt%(Fg`Ufy3a&lY?y^HRYNGA|eW0p@Ljzrs8yc#!qKTkyA8eo*kk z%*O;@_(QYa#|1x$`HbLs%(a|!Jrpp{6Wq?cP;i5JgWwyOHwj+HyjSoJ<^zIw5y8L4JR$fGnNJJ;6Xx2f>H6v7baMp%1Iz1z-^<(({5j?>!T-iQCiol7 zy9A$MJ|y^Ybio>*J%TT0J|Xxr=97YdmU-4`>3UelJX>%l^HRY*%*zEI;P&4pcpJ+H z1#f5GD|i#{&+Ha_2g?r%{w3yPg5S)1T=4HQpAr1W%(c_g_4D7%^90|)^Z!D@hgrT{ z@F2Ih2El*N@=bytWZob4I$} zPT+ZkF8Ha;4Z%Oh+$DH|%M}xRHOqGiUdDV#@O8}h2!1j13BhZbPYT|^JnPK#@`jmb z3w{;zQo(zfmkXYAkJ;bb1n+10px_3}?-u;uS$YAu;4E;9})Zw<_W>IADi_uE%+ek zC+Ab?dRV~ny5Pq%Hw4dP?h?F!c}#GFd6(eUI%r7n8kXN9_$KBPg8P|I3O>f=&C=7$ z8)Erv!LMOnD)@JpmkU0~yiM>smEzDhlN0`S1|99qHf`5zokl;UKzDMxiGM^Cq0P{(~ zA7GyK>GbkG&pcc31oKkCKVV)ixb{;X7X&|uP`O@e=$c~Ec{x7%L9OMYYOb3pK)aXiC<-^YAJ z@Q0Zv1b>?OwBUbbp0g}nKN+{1`OyVGj=3TDS~KI=2-dT3?&Y{9oPFBSYI=H-HSar|w9?`HX+;6p6GTk!9* z{Gi}JW1^+b5 z4+vhsd|2>{n2!ja;P?}Q*RlMx;MoVw{O9DQ>*0$muM1wt@`m7TEbkIL#5^YWSDAMS z?&A1|1phY6?-4x4@)LspfaNCz-_7z_`RV2TIm>4YKFqvS@KNUFf{$?gZGu0@@$Q1C96ZxDPQ{g4}< zCc%eTz