Yo > Patch 1 : 0004-libavcodec-texturedspenc-add-rgtc1u-encoding <snip> > +/** > + * Compress one block of RGBA pixels in a RGTC1U texture and store the > + * resulting bytes in 'dst'. Alpha is preserved. > + * > + * @param dst output buffer. > + * @param stride scanline in bytes. > + * @param block block to compress. > + * @return how much texture data has been written. > + */ > +static int rgtc1u_block(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) > +{ > + compress_alpha(dst, stride, block); > + > + return 8; > +}
Although this makes sense for Hap which stores an alpha channel in RGTC textures, this is not standard and a general purpose RGTC1U compressor should take its values from the red channel. This function should match your rgtc1u_alpha_block() from your 0006-libavodec-texturedsp-add-rgtc1u_alpha-uncompress-fun.patch > Patch 2 : 0005-libavcodec-hapenc-add-support-for-hap-alpha-only-enc > enable hap alpha only encoding in hapenc (and doc) > Ratio need to be 8 for RGTC1 otherwise, only ffmpeg can decode the frame > (the official hap lib failed to read the frame) 8 is correct so that makes sense > + case HAP_FMT_RGTC1: > + ratio = 8; > + avctx->codec_tag = MKTAG('H', 'a', 'p', 'A'); > + avctx->bits_per_coded_sample = 24; Some applications use the value from bits_per_coded_sample to determine the presence of alpha, so by convention this should probably be 32. Cheers - Tom > > To test : > FFmpeg need to be compile with snappy library (--enable-libsnappy) > > ./ffmpeg -i fileRgba -c:v hap -format hap_alpha_only res.mov > > I test the result in the 3 hap mode (with ffmpeg (with previous patch for > hap alpha only decoding decoding) and HapInAVFoundation test app (in OpenGL > mode)) > > compressor None > compressor snappy 1 chunk > compressor snappy 16 chunks > > > Martin > Jokyo Images > <0004-libavcodec-texturedspenc-add-rgtc1u-encoding.patch><0005-libavcodec-hapenc-add-support-for-hap-alpha-only-enc.patch>_______________________________________________ > 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