* qatar/master: libschroedinger: Switch to function names more in line with Libav style. Move code shared between libdirac and libschroedinger to libschroedinger. lavfi: uninline avfilter_copy_buffer_ref_props(). lavf: add missing '*' in a doxy. h264: Remove a commented-out function pointer typedef. txd: Remove write-only variable in txd_decode_frame(). mmvideo.c: Remove unused variable in mm_decode_pal(). build: cosmetics: Add missing end-of-line backslashes to item lists. build: cosmetics: Split HEADERS/OBJS/PROGS lists into one entry per line. libschroedinger: Move a function to avoid a forward declaration. pthread: warn on high thread counts vf_yadif: fix missing error handling for avfilter_poll_frame() avprobe: allow showing only one container/stream property. lavfi: support audio in avfilter_copy_frame_props(). lavfi: avfilter_merge_formats: handle case where inputs are same lavc: add sample rate and channel layout to AVFrame. zerocodec: check if the previous frame is missing doc: clarify check for NULL pointer style Conflicts: doc/APIchanges doc/developer.texi ffprobe.c libavcodec/Makefile libavcodec/avcodec.h libavcodec/libdirac_libschro.c libavcodec/libdirac_libschro.h libavcodec/mmvideo.c libavcodec/txd.c libavcodec/version.h libavcodec/zerocodec.c libavfilter/Makefile libavfilter/avfilter.c libavfilter/version.h libavformat/Makefile libavutil/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>tags/n0.11
| @@ -106,6 +106,11 @@ stream. | |||||
| All the container format information is printed within a section with | All the container format information is printed within a section with | ||||
| name "FORMAT". | name "FORMAT". | ||||
| @item -show_format_entry @var{name} | |||||
| Like @option{-show_format}, but only prints the specified entry of the | |||||
| container format information, rather than all. This option may be given more | |||||
| than once, then all specified entries will be shown. | |||||
| @item -show_packets | @item -show_packets | ||||
| Show information about each packet contained in the input multimedia | Show information about each packet contained in the input multimedia | ||||
| stream. | stream. | ||||
| @@ -50,6 +50,7 @@ static int do_read_packets = 0; | |||||
| static int do_show_error = 0; | static int do_show_error = 0; | ||||
| static int do_show_format = 0; | static int do_show_format = 0; | ||||
| static int do_show_frames = 0; | static int do_show_frames = 0; | ||||
| static AVDictionary *fmt_entries_to_show = NULL; | |||||
| static int do_show_packets = 0; | static int do_show_packets = 0; | ||||
| static int do_show_streams = 0; | static int do_show_streams = 0; | ||||
| static int do_show_program_version = 0; | static int do_show_program_version = 0; | ||||
| @@ -81,6 +82,7 @@ static uint64_t *nb_streams_frames; | |||||
| void av_noreturn exit_program(int ret) | void av_noreturn exit_program(int ret) | ||||
| { | { | ||||
| av_dict_free(&fmt_entries_to_show); | |||||
| exit(ret); | exit(ret); | ||||
| } | } | ||||
| @@ -279,8 +281,10 @@ static inline void writer_print_section_footer(WriterContext *wctx, | |||||
| static inline void writer_print_integer(WriterContext *wctx, | static inline void writer_print_integer(WriterContext *wctx, | ||||
| const char *key, long long int val) | const char *key, long long int val) | ||||
| { | { | ||||
| wctx->writer->print_integer(wctx, key, val); | |||||
| wctx->nb_item++; | |||||
| if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |||||
| wctx->writer->print_integer(wctx, key, val); | |||||
| wctx->nb_item++; | |||||
| } | |||||
| } | } | ||||
| static inline void writer_print_string(WriterContext *wctx, | static inline void writer_print_string(WriterContext *wctx, | ||||
| @@ -288,8 +292,10 @@ static inline void writer_print_string(WriterContext *wctx, | |||||
| { | { | ||||
| if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) | if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) | ||||
| return; | return; | ||||
| wctx->writer->print_string(wctx, key, val); | |||||
| wctx->nb_item++; | |||||
| if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |||||
| wctx->writer->print_string(wctx, key, val); | |||||
| wctx->nb_item++; | |||||
| } | |||||
| } | } | ||||
| static void writer_print_time(WriterContext *wctx, const char *key, | static void writer_print_time(WriterContext *wctx, const char *key, | ||||
| @@ -297,12 +303,14 @@ static void writer_print_time(WriterContext *wctx, const char *key, | |||||
| { | { | ||||
| char buf[128]; | char buf[128]; | ||||
| if (ts == AV_NOPTS_VALUE) { | |||||
| writer_print_string(wctx, key, "N/A", 1); | |||||
| } else { | |||||
| double d = ts * av_q2d(*time_base); | |||||
| value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str}); | |||||
| writer_print_string(wctx, key, buf, 0); | |||||
| if (!fmt_entries_to_show || (key && av_dict_get(fmt_entries_to_show, key, NULL, 0))) { | |||||
| if (ts == AV_NOPTS_VALUE) { | |||||
| writer_print_string(wctx, key, "N/A", 1); | |||||
| } else { | |||||
| double d = ts * av_q2d(*time_base); | |||||
| value_string(buf, sizeof(buf), (struct unit_value){.val.d=d, .unit=unit_second_str}); | |||||
| writer_print_string(wctx, key, buf, 0); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -1428,6 +1436,20 @@ static void show_streams(WriterContext *w, AVFormatContext *fmt_ctx) | |||||
| show_stream(w, fmt_ctx, i); | show_stream(w, fmt_ctx, i); | ||||
| } | } | ||||
| static void print_format_entry(const char *tag, | |||||
| const char *val) | |||||
| { | |||||
| if (!fmt_entries_to_show) { | |||||
| if (tag) { | |||||
| printf("%s=%s\n", tag, val); | |||||
| } else { | |||||
| printf("%s\n", val); | |||||
| } | |||||
| } else if (tag && av_dict_get(fmt_entries_to_show, tag, NULL, 0)) { | |||||
| printf("%s=%s\n", tag, val); | |||||
| } | |||||
| } | |||||
| static void show_format(WriterContext *w, AVFormatContext *fmt_ctx) | static void show_format(WriterContext *w, AVFormatContext *fmt_ctx) | ||||
| { | { | ||||
| char val_str[128]; | char val_str[128]; | ||||
| @@ -1621,6 +1643,13 @@ static int opt_format(const char *opt, const char *arg) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static int opt_show_format_entry(const char *opt, const char *arg) | |||||
| { | |||||
| do_show_format = 1; | |||||
| av_dict_set(&fmt_entries_to_show, arg, "", 0); | |||||
| return 0; | |||||
| } | |||||
| static void opt_input_file(void *optctx, const char *arg) | static void opt_input_file(void *optctx, const char *arg) | ||||
| { | { | ||||
| if (input_filename) { | if (input_filename) { | ||||
| @@ -1678,6 +1707,8 @@ static const OptionDef options[] = { | |||||
| { "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" }, | { "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" }, | ||||
| { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, | { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, | ||||
| { "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" }, | { "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" }, | ||||
| { "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry}, | |||||
| "show a particular entry from the format/container info", "entry" }, | |||||
| { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, | { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, | ||||
| { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, | { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, | ||||
| { "count_frames", OPT_BOOL, {(void*)&do_count_frames}, "count the number of frames per stream" }, | { "count_frames", OPT_BOOL, {(void*)&do_count_frames}, "count the number of frames per stream" }, | ||||
| @@ -3,7 +3,14 @@ include $(SUBDIR)../config.mak | |||||
| NAME = avcodec | NAME = avcodec | ||||
| FFLIBS = avutil | FFLIBS = avutil | ||||
| HEADERS = avcodec.h avfft.h dxva2.h vaapi.h vda.h vdpau.h version.h xvmc.h | |||||
| HEADERS = avcodec.h \ | |||||
| avfft.h \ | |||||
| dxva2.h \ | |||||
| vaapi.h \ | |||||
| vda.h \ | |||||
| vdpau.h \ | |||||
| version.h \ | |||||
| xvmc.h \ | |||||
| OBJS = allcodecs.o \ | OBJS = allcodecs.o \ | ||||
| audioconvert.o \ | audioconvert.o \ | ||||
| @@ -651,11 +658,9 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o | |||||
| OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o | OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o | ||||
| OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o | OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o | ||||
| OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ | OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ | ||||
| libschroedinger.o \ | |||||
| libdirac_libschro.o | |||||
| libschroedinger.o | |||||
| OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ | OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ | ||||
| libschroedinger.o \ | |||||
| libdirac_libschro.o | |||||
| libschroedinger.o | |||||
| OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o | OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o | ||||
| OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o | OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o | ||||
| OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o | OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o | ||||
| @@ -753,7 +758,8 @@ SKIPHEADERS += %_tablegen.h \ | |||||
| aac_tablegen_decl.h \ | aac_tablegen_decl.h \ | ||||
| fft-internal.h \ | fft-internal.h \ | ||||
| tableprint.h \ | tableprint.h \ | ||||
| $(ARCH)/vp56_arith.h | |||||
| $(ARCH)/vp56_arith.h \ | |||||
| SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h | SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h | ||||
| SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h | SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h | ||||
| SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h | SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h | ||||
| @@ -762,13 +768,28 @@ SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h | |||||
| SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h | SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h | ||||
| SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h | SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h | ||||
| TESTPROGS = cabac dct fft fft-fixed golomb iirfilter rangecoder snowenc | |||||
| TESTPROGS = cabac \ | |||||
| dct \ | |||||
| fft \ | |||||
| fft-fixed \ | |||||
| golomb \ | |||||
| iirfilter \ | |||||
| rangecoder \ | |||||
| snowenc \ | |||||
| TESTPROGS-$(HAVE_MMX) += motion | TESTPROGS-$(HAVE_MMX) += motion | ||||
| TESTOBJS = dctref.o | TESTOBJS = dctref.o | ||||
| HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \ | |||||
| dv_tablegen motionpixels_tablegen mpegaudio_tablegen \ | |||||
| pcm_tablegen qdm2_tablegen sinewin_tablegen | |||||
| HOSTPROGS = aac_tablegen \ | |||||
| aacps_tablegen \ | |||||
| cbrt_tablegen \ | |||||
| cos_tablegen \ | |||||
| dv_tablegen \ | |||||
| motionpixels_tablegen \ | |||||
| mpegaudio_tablegen \ | |||||
| pcm_tablegen \ | |||||
| qdm2_tablegen \ | |||||
| sinewin_tablegen \ | |||||
| CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) | CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) | ||||
| @@ -1242,6 +1242,22 @@ typedef struct AVFrame { | |||||
| */ | */ | ||||
| uint8_t motion_subsample_log2; | uint8_t motion_subsample_log2; | ||||
| /** | |||||
| * Sample rate of the audio data. | |||||
| * | |||||
| * - encoding: unused | |||||
| * - decoding: read by user | |||||
| */ | |||||
| int sample_rate; | |||||
| /** | |||||
| * Channel layout of the audio data. | |||||
| * | |||||
| * - encoding: unused | |||||
| * - decoding: read by user. | |||||
| */ | |||||
| uint64_t channel_layout; | |||||
| /** | /** | ||||
| * frame timestamp estimated using various heuristics, in stream time base | * frame timestamp estimated using various heuristics, in stream time base | ||||
| * Code outside libavcodec should access this field using: | * Code outside libavcodec should access this field using: | ||||
| @@ -1260,24 +1276,6 @@ typedef struct AVFrame { | |||||
| */ | */ | ||||
| int64_t pkt_pos; | int64_t pkt_pos; | ||||
| /** | |||||
| * channel layout of the audio frame | |||||
| * - encoding: unused | |||||
| * - decoding: read by user. | |||||
| * Code outside libavcodec should access this field using: | |||||
| * av_frame_get_channel_layout(frame) | |||||
| */ | |||||
| int64_t channel_layout; | |||||
| /** | |||||
| * sample rate of the audio frame | |||||
| * - encoding: unused | |||||
| * - decoding: read by user. | |||||
| * Code outside libavcodec should access this field using: | |||||
| * av_frame_get_channel_layout(frame) | |||||
| */ | |||||
| int sample_rate; | |||||
| } AVFrame; | } AVFrame; | ||||
| /** | /** | ||||
| @@ -30,7 +30,6 @@ | |||||
| #include <stdint.h> | #include <stdint.h> | ||||
| #include "dsputil.h" | #include "dsputil.h" | ||||
| //typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); | |||||
| typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, | typedef void (*h264_weight_func)(uint8_t *block, int stride, int height, | ||||
| int log2_denom, int weight, int offset); | int log2_denom, int weight, int offset); | ||||
| typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, | typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height, | ||||
| @@ -1,113 +0,0 @@ | |||||
| /* | |||||
| * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot 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 | |||||
| * functions common to libdirac and libschroedinger | |||||
| */ | |||||
| #include "libdirac_libschro.h" | |||||
| static const DiracSchroVideoFormatInfo ff_dirac_schro_video_format_info[] = { | |||||
| { 640, 480, 24000, 1001}, | |||||
| { 176, 120, 15000, 1001}, | |||||
| { 176, 144, 25, 2 }, | |||||
| { 352, 240, 15000, 1001}, | |||||
| { 352, 288, 25, 2 }, | |||||
| { 704, 480, 15000, 1001}, | |||||
| { 704, 576, 25, 2 }, | |||||
| { 720, 480, 30000, 1001}, | |||||
| { 720, 576, 25, 1 }, | |||||
| { 1280, 720, 60000, 1001}, | |||||
| { 1280, 720, 50, 1 }, | |||||
| { 1920, 1080, 30000, 1001}, | |||||
| { 1920, 1080, 25, 1 }, | |||||
| { 1920, 1080, 60000, 1001}, | |||||
| { 1920, 1080, 50, 1 }, | |||||
| { 2048, 1080, 24, 1 }, | |||||
| { 4096, 2160, 24, 1 }, | |||||
| }; | |||||
| unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext) | |||||
| { | |||||
| unsigned int ret_idx = 0; | |||||
| unsigned int idx; | |||||
| unsigned int num_formats = sizeof(ff_dirac_schro_video_format_info) / | |||||
| sizeof(ff_dirac_schro_video_format_info[0]); | |||||
| for (idx = 1; idx < num_formats; ++idx) { | |||||
| const DiracSchroVideoFormatInfo *vf = &ff_dirac_schro_video_format_info[idx]; | |||||
| if (avccontext->width == vf->width && | |||||
| avccontext->height == vf->height) { | |||||
| ret_idx = idx; | |||||
| if (avccontext->time_base.den == vf->frame_rate_num && | |||||
| avccontext->time_base.num == vf->frame_rate_denom) | |||||
| return idx; | |||||
| } | |||||
| } | |||||
| return ret_idx; | |||||
| } | |||||
| void ff_dirac_schro_queue_init(DiracSchroQueue *queue) | |||||
| { | |||||
| queue->p_head = queue->p_tail = NULL; | |||||
| queue->size = 0; | |||||
| } | |||||
| void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | |||||
| void (*free_func)(void *)) | |||||
| { | |||||
| while (queue->p_head) | |||||
| free_func(ff_dirac_schro_queue_pop(queue)); | |||||
| } | |||||
| int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data) | |||||
| { | |||||
| DiracSchroQueueElement *p_new = av_mallocz(sizeof(DiracSchroQueueElement)); | |||||
| if (!p_new) | |||||
| return -1; | |||||
| p_new->data = p_data; | |||||
| if (!queue->p_head) | |||||
| queue->p_head = p_new; | |||||
| else | |||||
| queue->p_tail->next = p_new; | |||||
| queue->p_tail = p_new; | |||||
| ++queue->size; | |||||
| return 0; | |||||
| } | |||||
| void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue) | |||||
| { | |||||
| DiracSchroQueueElement *top = queue->p_head; | |||||
| if (top) { | |||||
| void *data = top->data; | |||||
| queue->p_head = queue->p_head->next; | |||||
| --queue->size; | |||||
| av_freep(&top); | |||||
| return data; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| @@ -1,105 +0,0 @@ | |||||
| /* | |||||
| * Copyright (c) 2008 BBC, Anuradha Suraparaju <asuraparaju at gmail dot 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 | |||||
| * data structures common to libdirac and libschroedinger | |||||
| */ | |||||
| #ifndef AVCODEC_LIBDIRAC_LIBSCHRO_H | |||||
| #define AVCODEC_LIBDIRAC_LIBSCHRO_H | |||||
| #include "avcodec.h" | |||||
| typedef struct { | |||||
| uint16_t width; | |||||
| uint16_t height; | |||||
| uint16_t frame_rate_num; | |||||
| uint16_t frame_rate_denom; | |||||
| } DiracSchroVideoFormatInfo; | |||||
| /** | |||||
| * Returns the index into the Dirac Schro common video format info table | |||||
| */ | |||||
| unsigned int ff_dirac_schro_get_video_format_idx(AVCodecContext *avccontext); | |||||
| /** | |||||
| * contains a single encoded frame returned from Dirac or Schroedinger | |||||
| */ | |||||
| typedef struct DiracSchroEncodedFrame { | |||||
| /** encoded frame data */ | |||||
| uint8_t *p_encbuf; | |||||
| /** encoded frame size */ | |||||
| uint32_t size; | |||||
| /** encoded frame number. Will be used as pts */ | |||||
| uint32_t frame_num; | |||||
| /** key frame flag. 1 : is key frame , 0 : in not key frame */ | |||||
| uint16_t key_frame; | |||||
| } DiracSchroEncodedFrame; | |||||
| /** | |||||
| * queue element | |||||
| */ | |||||
| typedef struct DiracSchroQueueElement { | |||||
| /** Data to be stored in queue*/ | |||||
| void *data; | |||||
| /** Pointer to next element queue */ | |||||
| struct DiracSchroQueueElement *next; | |||||
| } DiracSchroQueueElement; | |||||
| /** | |||||
| * A simple queue implementation used in libdirac and libschroedinger | |||||
| */ | |||||
| typedef struct DiracSchroQueue { | |||||
| /** Pointer to head of queue */ | |||||
| DiracSchroQueueElement *p_head; | |||||
| /** Pointer to tail of queue */ | |||||
| DiracSchroQueueElement *p_tail; | |||||
| /** Queue size*/ | |||||
| int size; | |||||
| } DiracSchroQueue; | |||||
| /** | |||||
| * Initialise the queue | |||||
| */ | |||||
| void ff_dirac_schro_queue_init(DiracSchroQueue *queue); | |||||
| /** | |||||
| * Add an element to the end of the queue | |||||
| */ | |||||
| int ff_dirac_schro_queue_push_back(DiracSchroQueue *queue, void *p_data); | |||||
| /** | |||||
| * Return the first element in the queue | |||||
| */ | |||||
| void *ff_dirac_schro_queue_pop(DiracSchroQueue *queue); | |||||
| /** | |||||
| * Free the queue resources. free_func is a function supplied by the caller to | |||||
| * free any resources allocated by the caller. The data field of the queue | |||||
| * element is passed to it. | |||||
| */ | |||||
| void ff_dirac_schro_queue_free(DiracSchroQueue *queue, | |||||
| void (*free_func)(void *)); | |||||
| #endif /* AVCODEC_LIBDIRAC_LIBSCHRO_H */ | |||||
| @@ -23,12 +23,97 @@ | |||||
| * function definitions common to libschroedinger decoder and encoder | * function definitions common to libschroedinger decoder and encoder | ||||
| */ | */ | ||||
| #include "libdirac_libschro.h" | |||||
| #include "libschroedinger.h" | #include "libschroedinger.h" | ||||
| static const SchroVideoFormatInfo ff_schro_video_format_info[] = { | |||||
| { 640, 480, 24000, 1001}, | |||||
| { 176, 120, 15000, 1001}, | |||||
| { 176, 144, 25, 2 }, | |||||
| { 352, 240, 15000, 1001}, | |||||
| { 352, 288, 25, 2 }, | |||||
| { 704, 480, 15000, 1001}, | |||||
| { 704, 576, 25, 2 }, | |||||
| { 720, 480, 30000, 1001}, | |||||
| { 720, 576, 25, 1 }, | |||||
| { 1280, 720, 60000, 1001}, | |||||
| { 1280, 720, 50, 1 }, | |||||
| { 1920, 1080, 30000, 1001}, | |||||
| { 1920, 1080, 25, 1 }, | |||||
| { 1920, 1080, 60000, 1001}, | |||||
| { 1920, 1080, 50, 1 }, | |||||
| { 2048, 1080, 24, 1 }, | |||||
| { 4096, 2160, 24, 1 }, | |||||
| }; | |||||
| static unsigned int get_video_format_idx(AVCodecContext *avccontext) | |||||
| { | |||||
| unsigned int ret_idx = 0; | |||||
| unsigned int idx; | |||||
| unsigned int num_formats = sizeof(ff_schro_video_format_info) / | |||||
| sizeof(ff_schro_video_format_info[0]); | |||||
| for (idx = 1; idx < num_formats; ++idx) { | |||||
| const SchroVideoFormatInfo *vf = &ff_schro_video_format_info[idx]; | |||||
| if (avccontext->width == vf->width && | |||||
| avccontext->height == vf->height) { | |||||
| ret_idx = idx; | |||||
| if (avccontext->time_base.den == vf->frame_rate_num && | |||||
| avccontext->time_base.num == vf->frame_rate_denom) | |||||
| return idx; | |||||
| } | |||||
| } | |||||
| return ret_idx; | |||||
| } | |||||
| void ff_schro_queue_init(FFSchroQueue *queue) | |||||
| { | |||||
| queue->p_head = queue->p_tail = NULL; | |||||
| queue->size = 0; | |||||
| } | |||||
| void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)) | |||||
| { | |||||
| while (queue->p_head) | |||||
| free_func(ff_schro_queue_pop(queue)); | |||||
| } | |||||
| int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data) | |||||
| { | |||||
| FFSchroQueueElement *p_new = av_mallocz(sizeof(FFSchroQueueElement)); | |||||
| if (!p_new) | |||||
| return -1; | |||||
| p_new->data = p_data; | |||||
| if (!queue->p_head) | |||||
| queue->p_head = p_new; | |||||
| else | |||||
| queue->p_tail->next = p_new; | |||||
| queue->p_tail = p_new; | |||||
| ++queue->size; | |||||
| return 0; | |||||
| } | |||||
| void *ff_schro_queue_pop(FFSchroQueue *queue) | |||||
| { | |||||
| FFSchroQueueElement *top = queue->p_head; | |||||
| if (top) { | |||||
| void *data = top->data; | |||||
| queue->p_head = queue->p_head->next; | |||||
| --queue->size; | |||||
| av_freep(&top); | |||||
| return data; | |||||
| } | |||||
| return NULL; | |||||
| } | |||||
| /** | /** | ||||
| * Schroedinger video preset table. Ensure that this tables matches up correctly | * Schroedinger video preset table. Ensure that this tables matches up correctly | ||||
| * with the ff_dirac_schro_video_format_info table in libdirac_libschro.c. | |||||
| * with the ff_schro_video_format_info table. | |||||
| */ | */ | ||||
| static const SchroVideoFormatEnum ff_schro_video_formats[]={ | static const SchroVideoFormatEnum ff_schro_video_formats[]={ | ||||
| SCHRO_VIDEO_FORMAT_CUSTOM , | SCHRO_VIDEO_FORMAT_CUSTOM , | ||||
| @@ -55,7 +140,7 @@ SchroVideoFormatEnum ff_get_schro_video_format_preset(AVCodecContext *avccontext | |||||
| unsigned int num_formats = sizeof(ff_schro_video_formats) / | unsigned int num_formats = sizeof(ff_schro_video_formats) / | ||||
| sizeof(ff_schro_video_formats[0]); | sizeof(ff_schro_video_formats[0]); | ||||
| unsigned int idx = ff_dirac_schro_get_video_format_idx (avccontext); | |||||
| unsigned int idx = get_video_format_idx(avccontext); | |||||
| return (idx < num_formats) ? ff_schro_video_formats[idx] : | return (idx < num_formats) ? ff_schro_video_formats[idx] : | ||||
| SCHRO_VIDEO_FORMAT_CUSTOM; | SCHRO_VIDEO_FORMAT_CUSTOM; | ||||
| @@ -78,7 +163,7 @@ int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt, | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| static void FreeSchroFrame(SchroFrame *frame, void *priv) | |||||
| static void free_schro_frame(SchroFrame *frame, void *priv) | |||||
| { | { | ||||
| AVPicture *p_pic = priv; | AVPicture *p_pic = priv; | ||||
| @@ -110,7 +195,7 @@ SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext, | |||||
| p_frame->format = schro_frame_fmt; | p_frame->format = schro_frame_fmt; | ||||
| p_frame->width = y_width; | p_frame->width = y_width; | ||||
| p_frame->height = y_height; | p_frame->height = y_height; | ||||
| schro_frame_set_free_callback(p_frame, FreeSchroFrame, (void *)p_pic); | |||||
| schro_frame_set_free_callback(p_frame, free_schro_frame, (void *)p_pic); | |||||
| for (i = 0; i < 3; ++i) { | for (i = 0; i < 3; ++i) { | ||||
| p_frame->components[i].width = i ? uv_width : y_width; | p_frame->components[i].width = i ? uv_width : y_width; | ||||
| @@ -28,8 +28,78 @@ | |||||
| #include <schroedinger/schrobitstream.h> | #include <schroedinger/schrobitstream.h> | ||||
| #include <schroedinger/schroframe.h> | #include <schroedinger/schroframe.h> | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| typedef struct { | |||||
| uint16_t width; | |||||
| uint16_t height; | |||||
| uint16_t frame_rate_num; | |||||
| uint16_t frame_rate_denom; | |||||
| } SchroVideoFormatInfo; | |||||
| /** | |||||
| * contains a single encoded frame returned from Dirac or Schroedinger | |||||
| */ | |||||
| typedef struct FFSchroEncodedFrame { | |||||
| /** encoded frame data */ | |||||
| uint8_t *p_encbuf; | |||||
| /** encoded frame size */ | |||||
| uint32_t size; | |||||
| /** encoded frame number. Will be used as pts */ | |||||
| uint32_t frame_num; | |||||
| /** key frame flag. 1 : is key frame , 0 : in not key frame */ | |||||
| uint16_t key_frame; | |||||
| } FFSchroEncodedFrame; | |||||
| /** | |||||
| * queue element | |||||
| */ | |||||
| typedef struct FFSchroQueueElement { | |||||
| /** Data to be stored in queue*/ | |||||
| void *data; | |||||
| /** Pointer to next element queue */ | |||||
| struct FFSchroQueueElement *next; | |||||
| } FFSchroQueueElement; | |||||
| /** | |||||
| * A simple queue implementation used in libschroedinger | |||||
| */ | |||||
| typedef struct FFSchroQueue { | |||||
| /** Pointer to head of queue */ | |||||
| FFSchroQueueElement *p_head; | |||||
| /** Pointer to tail of queue */ | |||||
| FFSchroQueueElement *p_tail; | |||||
| /** Queue size*/ | |||||
| int size; | |||||
| } FFSchroQueue; | |||||
| /** | |||||
| * Initialise the queue | |||||
| */ | |||||
| void ff_schro_queue_init(FFSchroQueue *queue); | |||||
| /** | |||||
| * Add an element to the end of the queue | |||||
| */ | |||||
| int ff_schro_queue_push_back(FFSchroQueue *queue, void *p_data); | |||||
| /** | |||||
| * Return the first element in the queue | |||||
| */ | |||||
| void *ff_schro_queue_pop(FFSchroQueue *queue); | |||||
| /** | |||||
| * Free the queue resources. free_func is a function supplied by the caller to | |||||
| * free any resources allocated by the caller. The data field of the queue | |||||
| * element is passed to it. | |||||
| */ | |||||
| void ff_schro_queue_free(FFSchroQueue *queue, void (*free_func)(void *)); | |||||
| static const struct { | static const struct { | ||||
| enum PixelFormat ff_pix_fmt; | enum PixelFormat ff_pix_fmt; | ||||
| SchroChromaFormat schro_pix_fmt; | SchroChromaFormat schro_pix_fmt; | ||||
| @@ -29,7 +29,6 @@ | |||||
| #include "libavutil/imgutils.h" | #include "libavutil/imgutils.h" | ||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "libdirac_libschro.h" | |||||
| #include "libschroedinger.h" | #include "libschroedinger.h" | ||||
| #undef NDEBUG | #undef NDEBUG | ||||
| @@ -52,7 +51,7 @@ typedef struct SchroDecoderParams { | |||||
| SchroDecoder* decoder; | SchroDecoder* decoder; | ||||
| /** queue storing decoded frames */ | /** queue storing decoded frames */ | ||||
| DiracSchroQueue dec_frame_queue; | |||||
| FFSchroQueue dec_frame_queue; | |||||
| /** end of sequence signalled */ | /** end of sequence signalled */ | ||||
| int eos_signalled; | int eos_signalled; | ||||
| @@ -71,16 +70,19 @@ typedef struct SchroParseUnitContext { | |||||
| static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, | static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, | ||||
| void *priv); | |||||
| void *priv) | |||||
| { | |||||
| av_freep(&priv); | |||||
| } | |||||
| static void SchroParseContextInit(SchroParseUnitContext *parse_ctx, | |||||
| const uint8_t *buf, int buf_size) | |||||
| static void parse_context_init(SchroParseUnitContext *parse_ctx, | |||||
| const uint8_t *buf, int buf_size) | |||||
| { | { | ||||
| parse_ctx->buf = buf; | parse_ctx->buf = buf; | ||||
| parse_ctx->buf_size = buf_size; | parse_ctx->buf_size = buf_size; | ||||
| } | } | ||||
| static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx) | |||||
| static SchroBuffer *find_next_parse_unit(SchroParseUnitContext *parse_ctx) | |||||
| { | { | ||||
| SchroBuffer *enc_buf = NULL; | SchroBuffer *enc_buf = NULL; | ||||
| int next_pu_offset = 0; | int next_pu_offset = 0; | ||||
| @@ -152,16 +154,10 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext) | |||||
| return -1; | return -1; | ||||
| /* Initialize the decoded frame queue. */ | /* Initialize the decoded frame queue. */ | ||||
| ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | |||||
| ff_schro_queue_init(&p_schro_params->dec_frame_queue); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf, | |||||
| void *priv) | |||||
| { | |||||
| av_freep(&priv); | |||||
| } | |||||
| static void libschroedinger_decode_frame_free(void *frame) | static void libschroedinger_decode_frame_free(void *frame) | ||||
| { | { | ||||
| schro_frame_unref(frame); | schro_frame_unref(frame); | ||||
| @@ -223,7 +219,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, | |||||
| *data_size = 0; | *data_size = 0; | ||||
| SchroParseContextInit(&parse_ctx, buf, buf_size); | |||||
| parse_context_init(&parse_ctx, buf, buf_size); | |||||
| if (!buf_size) { | if (!buf_size) { | ||||
| if (!p_schro_params->eos_signalled) { | if (!p_schro_params->eos_signalled) { | ||||
| state = schro_decoder_push_end_of_stream(decoder); | state = schro_decoder_push_end_of_stream(decoder); | ||||
| @@ -233,7 +229,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, | |||||
| /* Loop through all the individual parse units in the input buffer */ | /* Loop through all the individual parse units in the input buffer */ | ||||
| do { | do { | ||||
| if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) { | |||||
| if ((enc_buf = find_next_parse_unit(&parse_ctx))) { | |||||
| /* Push buffer into decoder. */ | /* Push buffer into decoder. */ | ||||
| if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && | if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) && | ||||
| SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) | SCHRO_PARSE_CODE_NUM_REFS(enc_buf->data[4]) > 0) | ||||
| @@ -270,8 +266,8 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, | |||||
| frame = schro_decoder_pull(decoder); | frame = schro_decoder_pull(decoder); | ||||
| if (frame) | if (frame) | ||||
| ff_dirac_schro_queue_push_back(&p_schro_params->dec_frame_queue, | |||||
| frame); | |||||
| ff_schro_queue_push_back(&p_schro_params->dec_frame_queue, | |||||
| frame); | |||||
| break; | break; | ||||
| case SCHRO_DECODER_EOS: | case SCHRO_DECODER_EOS: | ||||
| go = 0; | go = 0; | ||||
| @@ -288,7 +284,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext, | |||||
| } while (outer); | } while (outer); | ||||
| /* Grab next frame to be returned from the top of the queue. */ | /* Grab next frame to be returned from the top of the queue. */ | ||||
| frame = ff_dirac_schro_queue_pop(&p_schro_params->dec_frame_queue); | |||||
| frame = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); | |||||
| if (frame) { | if (frame) { | ||||
| memcpy(p_schro_params->dec_pic.data[0], | memcpy(p_schro_params->dec_pic.data[0], | ||||
| @@ -327,8 +323,8 @@ static av_cold int libschroedinger_decode_close(AVCodecContext *avccontext) | |||||
| avpicture_free(&p_schro_params->dec_pic); | avpicture_free(&p_schro_params->dec_pic); | ||||
| /* Free data in the output frame queue. */ | /* Free data in the output frame queue. */ | ||||
| ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | |||||
| libschroedinger_decode_frame_free); | |||||
| ff_schro_queue_free(&p_schro_params->dec_frame_queue, | |||||
| libschroedinger_decode_frame_free); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -340,10 +336,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext) | |||||
| SchroDecoderParams *p_schro_params = avccontext->priv_data; | SchroDecoderParams *p_schro_params = avccontext->priv_data; | ||||
| /* Free data in the output frame queue. */ | /* Free data in the output frame queue. */ | ||||
| ff_dirac_schro_queue_free(&p_schro_params->dec_frame_queue, | |||||
| libschroedinger_decode_frame_free); | |||||
| ff_schro_queue_free(&p_schro_params->dec_frame_queue, | |||||
| libschroedinger_decode_frame_free); | |||||
| ff_dirac_schro_queue_init(&p_schro_params->dec_frame_queue); | |||||
| ff_schro_queue_init(&p_schro_params->dec_frame_queue); | |||||
| schro_decoder_reset(p_schro_params->decoder); | schro_decoder_reset(p_schro_params->decoder); | ||||
| p_schro_params->eos_pulled = 0; | p_schro_params->eos_pulled = 0; | ||||
| p_schro_params->eos_signalled = 0; | p_schro_params->eos_signalled = 0; | ||||
| @@ -36,7 +36,6 @@ | |||||
| #include "avcodec.h" | #include "avcodec.h" | ||||
| #include "internal.h" | #include "internal.h" | ||||
| #include "libdirac_libschro.h" | |||||
| #include "libschroedinger.h" | #include "libschroedinger.h" | ||||
| #include "bytestream.h" | #include "bytestream.h" | ||||
| @@ -65,7 +64,7 @@ typedef struct SchroEncoderParams { | |||||
| int enc_buf_size; | int enc_buf_size; | ||||
| /** queue storing encoded frames */ | /** queue storing encoded frames */ | ||||
| DiracSchroQueue enc_frame_queue; | |||||
| FFSchroQueue enc_frame_queue; | |||||
| /** end of sequence signalled */ | /** end of sequence signalled */ | ||||
| int eos_signalled; | int eos_signalled; | ||||
| @@ -80,7 +79,7 @@ typedef struct SchroEncoderParams { | |||||
| /** | /** | ||||
| * Works out Schro-compatible chroma format. | * Works out Schro-compatible chroma format. | ||||
| */ | */ | ||||
| static int SetSchroChromaFormat(AVCodecContext *avccontext) | |||||
| static int set_chroma_format(AVCodecContext *avccontext) | |||||
| { | { | ||||
| int num_formats = sizeof(schro_pixel_format_map) / | int num_formats = sizeof(schro_pixel_format_map) / | ||||
| sizeof(schro_pixel_format_map[0]); | sizeof(schro_pixel_format_map[0]); | ||||
| @@ -129,7 +128,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) | |||||
| p_schro_params->format->width = avccontext->width; | p_schro_params->format->width = avccontext->width; | ||||
| p_schro_params->format->height = avccontext->height; | p_schro_params->format->height = avccontext->height; | ||||
| if (SetSchroChromaFormat(avccontext) == -1) | |||||
| if (set_chroma_format(avccontext) == -1) | |||||
| return -1; | return -1; | ||||
| if (avccontext->color_primaries == AVCOL_PRI_BT709) { | if (avccontext->color_primaries == AVCOL_PRI_BT709) { | ||||
| @@ -236,7 +235,7 @@ static int libschroedinger_encode_init(AVCodecContext *avccontext) | |||||
| schro_encoder_start(p_schro_params->encoder); | schro_encoder_start(p_schro_params->encoder); | ||||
| /* Initialize the encoded frame queue. */ | /* Initialize the encoded frame queue. */ | ||||
| ff_dirac_schro_queue_init(&p_schro_params->enc_frame_queue); | |||||
| ff_schro_queue_init(&p_schro_params->enc_frame_queue); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -259,9 +258,9 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext, | |||||
| return in_frame; | return in_frame; | ||||
| } | } | ||||
| static void SchroedingerFreeFrame(void *data) | |||||
| static void libschroedinger_free_frame(void *data) | |||||
| { | { | ||||
| DiracSchroEncodedFrame *enc_frame = data; | |||||
| FFSchroEncodedFrame *enc_frame = data; | |||||
| av_freep(&enc_frame->p_encbuf); | av_freep(&enc_frame->p_encbuf); | ||||
| av_free(enc_frame); | av_free(enc_frame); | ||||
| @@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk | |||||
| int enc_size = 0; | int enc_size = 0; | ||||
| SchroEncoderParams *p_schro_params = avccontext->priv_data; | SchroEncoderParams *p_schro_params = avccontext->priv_data; | ||||
| SchroEncoder *encoder = p_schro_params->encoder; | SchroEncoder *encoder = p_schro_params->encoder; | ||||
| struct DiracSchroEncodedFrame *p_frame_output = NULL; | |||||
| struct FFSchroEncodedFrame *p_frame_output = NULL; | |||||
| int go = 1; | int go = 1; | ||||
| SchroBuffer *enc_buf; | SchroBuffer *enc_buf; | ||||
| int presentation_frame; | int presentation_frame; | ||||
| @@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk | |||||
| } | } | ||||
| /* Create output frame. */ | /* Create output frame. */ | ||||
| p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame)); | |||||
| p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame)); | |||||
| /* Set output data. */ | /* Set output data. */ | ||||
| p_frame_output->size = p_schro_params->enc_buf_size; | p_frame_output->size = p_schro_params->enc_buf_size; | ||||
| p_frame_output->p_encbuf = p_schro_params->enc_buf; | p_frame_output->p_encbuf = p_schro_params->enc_buf; | ||||
| @@ -345,8 +344,8 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk | |||||
| * through 17 represesent the frame number. */ | * through 17 represesent the frame number. */ | ||||
| p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); | p_frame_output->frame_num = AV_RB32(enc_buf->data + 13); | ||||
| ff_dirac_schro_queue_push_back(&p_schro_params->enc_frame_queue, | |||||
| p_frame_output); | |||||
| ff_schro_queue_push_back(&p_schro_params->enc_frame_queue, | |||||
| p_frame_output); | |||||
| p_schro_params->enc_buf_size = 0; | p_schro_params->enc_buf_size = 0; | ||||
| p_schro_params->enc_buf = NULL; | p_schro_params->enc_buf = NULL; | ||||
| @@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk | |||||
| p_schro_params->eos_pulled) | p_schro_params->eos_pulled) | ||||
| last_frame_in_sequence = 1; | last_frame_in_sequence = 1; | ||||
| p_frame_output = ff_dirac_schro_queue_pop(&p_schro_params->enc_frame_queue); | |||||
| p_frame_output = ff_schro_queue_pop(&p_schro_params->enc_frame_queue); | |||||
| if (!p_frame_output) | if (!p_frame_output) | ||||
| return 0; | return 0; | ||||
| @@ -410,7 +409,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk | |||||
| error: | error: | ||||
| /* free frame */ | /* free frame */ | ||||
| SchroedingerFreeFrame(p_frame_output); | |||||
| libschroedinger_free_frame(p_frame_output); | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| @@ -423,8 +422,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext) | |||||
| schro_encoder_free(p_schro_params->encoder); | schro_encoder_free(p_schro_params->encoder); | ||||
| /* Free data in the output frame queue. */ | /* Free data in the output frame queue. */ | ||||
| ff_dirac_schro_queue_free(&p_schro_params->enc_frame_queue, | |||||
| SchroedingerFreeFrame); | |||||
| ff_schro_queue_free(&p_schro_params->enc_frame_queue, | |||||
| libschroedinger_free_frame); | |||||
| /* Free the encoder buffer. */ | /* Free the encoder buffer. */ | ||||
| @@ -85,8 +85,7 @@ static int mm_decode_pal(MmContext *s) | |||||
| */ | */ | ||||
| static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) | static int mm_decode_intra(MmContext * s, int half_horiz, int half_vert) | ||||
| { | { | ||||
| int x, y; | |||||
| x=0; y=0; | |||||
| int x = 0, y = 0; | |||||
| while (bytestream2_get_bytes_left(&s->gb) > 0) { | while (bytestream2_get_bytes_left(&s->gb) > 0) { | ||||
| int run_length, color; | int run_length, color; | ||||
| @@ -1051,6 +1051,11 @@ static void validate_thread_parameters(AVCodecContext *avctx) | |||||
| avctx->thread_count = 1; | avctx->thread_count = 1; | ||||
| avctx->active_thread_type = 0; | avctx->active_thread_type = 0; | ||||
| } | } | ||||
| if (avctx->thread_count > MAX_AUTO_THREADS) | |||||
| av_log(avctx, AV_LOG_WARNING, | |||||
| "Application has requested %d threads. Using a thread count greater than %d is not recommended.\n", | |||||
| avctx->thread_count, MAX_AUTO_THREADS); | |||||
| } | } | ||||
| int ff_thread_init(AVCodecContext *avctx) | int ff_thread_init(AVCodecContext *avctx) | ||||
| @@ -48,7 +48,6 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, | |||||
| AVFrame *picture = data; | AVFrame *picture = data; | ||||
| AVFrame * const p = &s->picture; | AVFrame * const p = &s->picture; | ||||
| unsigned int version, w, h, d3d_format, depth, stride, flags; | unsigned int version, w, h, d3d_format, depth, stride, flags; | ||||
| unsigned int av_unused mipmap_count; | |||||
| unsigned int y, v; | unsigned int y, v; | ||||
| uint8_t *ptr; | uint8_t *ptr; | ||||
| uint32_t *pal; | uint32_t *pal; | ||||
| @@ -60,8 +59,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size, | |||||
| w = bytestream2_get_le16(&gb); | w = bytestream2_get_le16(&gb); | ||||
| h = bytestream2_get_le16(&gb); | h = bytestream2_get_le16(&gb); | ||||
| depth = bytestream2_get_byte(&gb); | depth = bytestream2_get_byte(&gb); | ||||
| mipmap_count = bytestream2_get_byte(&gb); | |||||
| bytestream2_skip(&gb, 1); | |||||
| bytestream2_skip(&gb, 2); | |||||
| flags = bytestream2_get_byte(&gb); | flags = bytestream2_get_byte(&gb); | ||||
| if (version < 8 || version > 9) { | if (version < 8 || version > 9) { | ||||
| @@ -390,6 +390,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) | |||||
| frame->reordered_opaque = avctx->reordered_opaque; | frame->reordered_opaque = avctx->reordered_opaque; | ||||
| frame->sample_rate = avctx->sample_rate; | |||||
| frame->format = avctx->sample_fmt; | |||||
| frame->channel_layout = avctx->channel_layout; | |||||
| if (avctx->debug & FF_DEBUG_BUFFERS) | if (avctx->debug & FF_DEBUG_BUFFERS) | ||||
| av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " | av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " | ||||
| "internal audio buffer used\n", frame); | "internal audio buffer used\n", frame); | ||||
| @@ -27,7 +27,7 @@ | |||||
| */ | */ | ||||
| #define LIBAVCODEC_VERSION_MAJOR 54 | #define LIBAVCODEC_VERSION_MAJOR 54 | ||||
| #define LIBAVCODEC_VERSION_MINOR 19 | |||||
| #define LIBAVCODEC_VERSION_MINOR 20 | |||||
| #define LIBAVCODEC_VERSION_MICRO 100 | #define LIBAVCODEC_VERSION_MICRO 100 | ||||
| #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ | ||||
| @@ -65,8 +65,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, | |||||
| pic->key_frame = 1; | pic->key_frame = 1; | ||||
| pic->pict_type = AV_PICTURE_TYPE_I; | pic->pict_type = AV_PICTURE_TYPE_I; | ||||
| } else { | } else { | ||||
| if (prev == NULL) { | |||||
| av_log(avctx, AV_LOG_ERROR, "No previous frame!\n"); | |||||
| if (!prev) { | |||||
| av_log(avctx, AV_LOG_ERROR, "Missing reference frame!\n"); | |||||
| return AVERROR_INVALIDDATA; | return AVERROR_INVALIDDATA; | ||||
| } | } | ||||
| pic->key_frame = 0; | pic->key_frame = 0; | ||||
| @@ -6,7 +6,8 @@ FFLIBS-$(CONFIG_LAVFI_INDEV) += avfilter | |||||
| HEADERS = avdevice.h | HEADERS = avdevice.h | ||||
| OBJS = alldevices.o avdevice.o | |||||
| OBJS = alldevices.o \ | |||||
| avdevice.o \ | |||||
| # input/output devices | # input/output devices | ||||
| OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ | OBJS-$(CONFIG_ALSA_INDEV) += alsa-audio-common.o \ | ||||
| @@ -11,7 +11,14 @@ FFLIBS-$(CONFIG_PAN_FILTER) += swresample | |||||
| FFLIBS-$(CONFIG_REMOVELOGO_FILTER) += avformat avcodec | FFLIBS-$(CONFIG_REMOVELOGO_FILTER) += avformat avcodec | ||||
| FFLIBS-$(CONFIG_MP_FILTER) += avcodec postproc | FFLIBS-$(CONFIG_MP_FILTER) += avcodec postproc | ||||
| HEADERS = asrc_abuffer.h avcodec.h avfilter.h avfiltergraph.h buffersink.h buffersrc.h version.h vsrc_buffer.h | |||||
| HEADERS = asrc_abuffer.h \ | |||||
| avcodec.h \ | |||||
| avfilter.h \ | |||||
| avfiltergraph.h \ | |||||
| buffersink.h \ | |||||
| buffersrc.h \ | |||||
| version.h \ | |||||
| vsrc_buffer.h \ | |||||
| OBJS = allfilters.o \ | OBJS = allfilters.o \ | ||||
| avfilter.o \ | avfilter.o \ | ||||
| @@ -171,4 +178,5 @@ OBJS-$(CONFIG_MP_FILTER) += libmpcodecs/pullup.o | |||||
| TESTPROGS = drawutils formats | TESTPROGS = drawutils formats | ||||
| TOOLS = graph2dot lavfi-showfiltfmts | |||||
| TOOLS = graph2dot \ | |||||
| lavfi-showfiltfmts \ | |||||
| @@ -41,10 +41,11 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) | |||||
| dst->video->pict_type = src->pict_type; | dst->video->pict_type = src->pict_type; | ||||
| break; | break; | ||||
| case AVMEDIA_TYPE_AUDIO: | case AVMEDIA_TYPE_AUDIO: | ||||
| dst->audio->sample_rate = av_frame_get_sample_rate(src); | |||||
| dst->audio->sample_rate = src->sample_rate; | |||||
| dst->audio->channel_layout = src->channel_layout; | |||||
| break; | break; | ||||
| default: | default: | ||||
| return AVERROR(ENOSYS); | |||||
| return AVERROR(EINVAL); | |||||
| } | } | ||||
| return 0; | return 0; | ||||
| @@ -901,3 +901,15 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque | |||||
| return ret; | return ret; | ||||
| } | } | ||||
| void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | |||||
| { | |||||
| // copy common properties | |||||
| dst->pts = src->pts; | |||||
| dst->pos = src->pos; | |||||
| switch (src->type) { | |||||
| case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; | |||||
| case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; | |||||
| default: break; | |||||
| } | |||||
| } | |||||
| @@ -155,18 +155,7 @@ typedef struct AVFilterBufferRef { | |||||
| /** | /** | ||||
| * Copy properties of src to dst, without copying the actual data | * Copy properties of src to dst, without copying the actual data | ||||
| */ | */ | ||||
| static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | |||||
| { | |||||
| // copy common properties | |||||
| dst->pts = src->pts; | |||||
| dst->pos = src->pos; | |||||
| switch (src->type) { | |||||
| case AVMEDIA_TYPE_VIDEO: *dst->video = *src->video; break; | |||||
| case AVMEDIA_TYPE_AUDIO: *dst->audio = *src->audio; break; | |||||
| default: break; | |||||
| } | |||||
| } | |||||
| void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src); | |||||
| /** | /** | ||||
| * Add a new reference to a buffer. | * Add a new reference to a buffer. | ||||
| @@ -47,7 +47,8 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b) | |||||
| AVFilterFormats *ret; | AVFilterFormats *ret; | ||||
| unsigned i, j, k = 0; | unsigned i, j, k = 0; | ||||
| if (a == b) return a; | |||||
| if (a == b) | |||||
| return a; | |||||
| ret = av_mallocz(sizeof(*ret)); | ret = av_mallocz(sizeof(*ret)); | ||||
| @@ -30,7 +30,7 @@ | |||||
| #define LIBAVFILTER_VERSION_MAJOR 2 | #define LIBAVFILTER_VERSION_MAJOR 2 | ||||
| #define LIBAVFILTER_VERSION_MINOR 72 | #define LIBAVFILTER_VERSION_MINOR 72 | ||||
| #define LIBAVFILTER_VERSION_MICRO 104 | |||||
| #define LIBAVFILTER_VERSION_MICRO 105 | |||||
| #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | ||||
| LIBAVFILTER_VERSION_MINOR, \ | LIBAVFILTER_VERSION_MINOR, \ | ||||
| @@ -3,7 +3,9 @@ include $(SUBDIR)../config.mak | |||||
| NAME = avformat | NAME = avformat | ||||
| FFLIBS = avcodec avutil | FFLIBS = avcodec avutil | ||||
| HEADERS = avformat.h avio.h version.h | |||||
| HEADERS = avformat.h \ | |||||
| avio.h \ | |||||
| version.h \ | |||||
| OBJS = allformats.o \ | OBJS = allformats.o \ | ||||
| avio.o \ | avio.o \ | ||||
| @@ -378,4 +380,8 @@ OBJS-$(CONFIG_UDP_PROTOCOL) += udp.o | |||||
| SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h | SKIPHEADERS-$(CONFIG_NETWORK) += network.h rtsp.h | ||||
| TESTPROGS = seek | TESTPROGS = seek | ||||
| TOOLS = aviocat ismindex pktdumper probetest | |||||
| TOOLS = aviocat \ | |||||
| ismindex \ | |||||
| pktdumper \ | |||||
| probetest \ | |||||
| @@ -856,7 +856,7 @@ typedef struct AVFormatContext { | |||||
| */ | */ | ||||
| void *priv_data; | void *priv_data; | ||||
| /* | |||||
| /** | |||||
| * I/O context. | * I/O context. | ||||
| * | * | ||||
| * decoding: either set by the user before avformat_open_input() (then | * decoding: either set by the user before avformat_open_input() (then | ||||
| @@ -2,7 +2,7 @@ NAME = avresample | |||||
| FFLIBS = avutil | FFLIBS = avutil | ||||
| HEADERS = avresample.h \ | HEADERS = avresample.h \ | ||||
| version.h | |||||
| version.h \ | |||||
| OBJS = audio_convert.o \ | OBJS = audio_convert.o \ | ||||
| audio_data.o \ | audio_data.o \ | ||||
| @@ -10,6 +10,6 @@ OBJS = audio_convert.o \ | |||||
| audio_mix_matrix.o \ | audio_mix_matrix.o \ | ||||
| options.o \ | options.o \ | ||||
| resample.o \ | resample.o \ | ||||
| utils.o | |||||
| utils.o \ | |||||
| TESTPROGS = avresample | TESTPROGS = avresample | ||||
| @@ -1,5 +1,5 @@ | |||||
| OBJS += x86/audio_convert_init.o \ | OBJS += x86/audio_convert_init.o \ | ||||
| x86/audio_mix_init.o | |||||
| x86/audio_mix_init.o \ | |||||
| YASM-OBJS += x86/audio_convert.o \ | YASM-OBJS += x86/audio_convert.o \ | ||||
| x86/audio_mix.o | |||||
| x86/audio_mix.o \ | |||||
| @@ -42,6 +42,11 @@ HEADERS = adler32.h \ | |||||
| timecode.h \ | timecode.h \ | ||||
| timestamp.h \ | timestamp.h \ | ||||
| ARCH_HEADERS = bswap.h \ | |||||
| intmath.h \ | |||||
| intreadwrite.h \ | |||||
| timer.h \ | |||||
| BUILT_HEADERS = avconfig.h | BUILT_HEADERS = avconfig.h | ||||
| OBJS = adler32.o \ | OBJS = adler32.o \ | ||||
| @@ -81,12 +86,30 @@ OBJS = adler32.o \ | |||||
| tree.o \ | tree.o \ | ||||
| utils.o \ | utils.o \ | ||||
| TESTPROGS = adler32 aes avstring base64 bprint cpu crc des eval file fifo \ | |||||
| lfg lls md5 opt pca parseutils random_seed rational sha tree | |||||
| TESTPROGS = adler32 \ | |||||
| aes \ | |||||
| avstring \ | |||||
| base64 \ | |||||
| bprint \ | |||||
| cpu \ | |||||
| crc \ | |||||
| des \ | |||||
| eval \ | |||||
| file \ | |||||
| fifo \ | |||||
| lfg \ | |||||
| lls \ | |||||
| md5 \ | |||||
| opt \ | |||||
| pca \ | |||||
| parseutils \ | |||||
| random_seed \ | |||||
| rational \ | |||||
| sha \ | |||||
| tree \ | |||||
| TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo | TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo | ||||
| TOOLS = ffeval | TOOLS = ffeval | ||||
| ARCH_HEADERS = bswap.h intmath.h intreadwrite.h timer.h | |||||
| $(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2 | $(SUBDIR)lzo-test$(EXESUF): ELIBS = -llzo2 | ||||
| @@ -1 +1 @@ | |||||
| OBJS += arm/cpu.o | |||||
| OBJS += arm/cpu.o \ | |||||
| @@ -14,4 +14,5 @@ OBJS = input.o \ | |||||
| utils.o \ | utils.o \ | ||||
| yuv2rgb.o \ | yuv2rgb.o \ | ||||
| TESTPROGS = colorspace swscale | |||||
| TESTPROGS = colorspace \ | |||||
| swscale \ | |||||