On Thu, Jul 16, 2015 at 01:23:23PM +0100, Tom Butterworth wrote: > --- > libavcodec/Makefile | 4 +- > libavcodec/hap.c | 51 +++++++++ > libavcodec/hap.h | 68 ++++++++---- > libavcodec/hapdec.c | 278 > ++++++++++++++++++++++++++++++++++++----------- > libavcodec/hapenc.c | 190 ++++++++++++++++++++++++++------ > tests/fate/video.mak | 3 + > tests/ref/fate/hap-chunk | 2 + > 7 files changed, 481 insertions(+), 115 deletions(-) > create mode 100644 libavcodec/hap.c > create mode 100644 tests/ref/fate/hap-chunk > > diff --git a/libavcodec/Makefile b/libavcodec/Makefile > index b7fe1c9..2796035 100644 > --- a/libavcodec/Makefile > +++ b/libavcodec/Makefile > @@ -283,8 +283,8 @@ OBJS-$(CONFIG_H264_MMAL_DECODER) += mmaldec.o > OBJS-$(CONFIG_H264_VDA_DECODER) += vda_h264_dec.o > OBJS-$(CONFIG_H264_QSV_DECODER) += qsvdec_h264.o > OBJS-$(CONFIG_H264_QSV_ENCODER) += qsvenc_h264.o > -OBJS-$(CONFIG_HAP_DECODER) += hapdec.o > -OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o > +OBJS-$(CONFIG_HAP_DECODER) += hapdec.o hap.o > +OBJS-$(CONFIG_HAP_ENCODER) += hapenc.o hap.o > OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o > hevc_sei.o \ > hevc_cabac.o hevc_refs.o > hevcpred.o \ > hevcdsp.o hevc_filter.o > hevc_parse.o hevc_data.o > diff --git a/libavcodec/hap.c b/libavcodec/hap.c > new file mode 100644 > index 0000000..c1685ad > --- /dev/null > +++ b/libavcodec/hap.c > @@ -0,0 +1,51 @@ > +/* > + * Vidvox Hap utility functions > + * Copyright (C) 2015 Tom Butterworth <bangno...@gmail.com> > + * > + * This file is part of FFmpeg. > + * > + * FFmpeg is free software; you can redistribute it and/or > + * modify it under the terms of the GNU Lesser General Public > + * License as published by the Free Software Foundation; either > + * version 2.1 of the License, or (at your option) any later version. > + * > + * FFmpeg is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > + * Lesser General Public License for more details. > + * > + * You should have received a copy of the GNU Lesser General Public > + * License along with FFmpeg; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 > USA > + */ > + > +/** > + * @file > + * Hap utilities > + */ > +#include "hap.h" > + > +int hap_set_chunk_count(HapContext *ctx, int count, int first_in_frame)
non static functions need ff_ or av_ prefixes > +{ > + int ret = 0; > + if (first_in_frame == 1 && ctx->chunk_count != count) { > + int ret = av_reallocp_array(&ctx->chunks, count, sizeof(HapChunk)); > + if (ret == 0) > + ret = av_reallocp_array(&ctx->chunk_results, count, sizeof(int)); > + if (ret < 0) { > + ctx->chunk_count = 0; > + } else { > + ctx->chunk_count = count; > + } > + } else if (ctx->chunk_count != count) { > + ret = AVERROR_INVALIDDATA; > + } > + return ret; > +} > + > +void hap_free_context(HapContext *ctx) > +{ > + av_freep(&ctx->tex_buf); > + av_freep(&ctx->chunks); > + av_freep(&ctx->chunk_results); > +} > diff --git a/libavcodec/hap.h b/libavcodec/hap.h > index bd0fd37..b877c4f 100644 > --- a/libavcodec/hap.h > +++ b/libavcodec/hap.h > @@ -1,6 +1,7 @@ > /* > * Vidvox Hap > * Copyright (C) 2015 Vittorio Giovara <vittorio.giov...@gmail.com> > + * and Tom Butterworth <bangno...@gmail.com> > * > * This file is part of FFmpeg. > * > @@ -29,37 +30,66 @@ > #include "bytestream.h" > #include "texturedsp.h" > > +enum HapTextureFormat { > + HAP_FMT_RGBDXT1 = 0x0B, > + HAP_FMT_RGBADXT5 = 0x0E, > + HAP_FMT_YCOCGDXT5 = 0x0F, > +}; > + > +enum HapCompressor { > + HAP_COMP_NONE = 0xA0, > + HAP_COMP_SNAPPY = 0xB0, > + HAP_COMP_COMPLEX = 0xC0, > +}; [...] > -enum { > - HAP_FMT_RGBDXT1 = 0x0B, > - HAP_FMT_RGBADXT5 = 0x0E, > - HAP_FMT_YCOCGDXT5 = 0x0F, > -}; > - > -enum { > - HAP_COMP_NONE = 0xA0, > - HAP_COMP_SNAPPY = 0xB0, > - HAP_COMP_COMPLEX = 0xC0, > -}; moving code around and giving enums names should be seperate patches from adding features more generically, cosmetic changes (like movig code) should be seperate from functional changes (like adding a feature) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel