summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-07 22:42:41 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-07 22:51:34 +0200
commit653d117c29123d353ce3bdd7de71e830a26733c1 (patch)
tree996ad2bd13c774dc3265cbf0d8ae406372d57307 /libavcodec
parentcb982739fa2b43afb7f1262c07804cad41f778de (diff)
parentfdc918632f5c16cf377a2170cd2f101933fb15ff (diff)
Merge remote-tracking branch 'qatar/master'
* 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>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/Makefile41
-rw-r--r--libavcodec/avcodec.h34
-rw-r--r--libavcodec/h264dsp.h1
-rw-r--r--libavcodec/libdirac_libschro.c113
-rw-r--r--libavcodec/libdirac_libschro.h105
-rw-r--r--libavcodec/libschroedinger.c95
-rw-r--r--libavcodec/libschroedinger.h70
-rw-r--r--libavcodec/libschroedingerdec.c42
-rw-r--r--libavcodec/libschroedingerenc.c29
-rw-r--r--libavcodec/mmvideo.c3
-rw-r--r--libavcodec/pthread.c5
-rw-r--r--libavcodec/txd.c4
-rw-r--r--libavcodec/utils.c4
-rw-r--r--libavcodec/version.h2
-rw-r--r--libavcodec/zerocodec.c4
15 files changed, 254 insertions, 298 deletions
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a39ec88e06..df4d908dd3 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -3,7 +3,14 @@ include $(SUBDIR)../config.mak
NAME = avcodec
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 \
audioconvert.o \
@@ -651,11 +658,9 @@ OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
- libschroedinger.o \
- libdirac_libschro.o
+ libschroedinger.o
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
- libschroedinger.o \
- libdirac_libschro.o
+ libschroedinger.o
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o
OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o
@@ -753,7 +758,8 @@ SKIPHEADERS += %_tablegen.h \
aac_tablegen_decl.h \
fft-internal.h \
tableprint.h \
- $(ARCH)/vp56_arith.h
+ $(ARCH)/vp56_arith.h \
+
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
@@ -762,13 +768,28 @@ SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.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
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)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index db17917b8a..21bd60881b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1243,6 +1243,22 @@ typedef struct AVFrame {
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
* Code outside libavcodec should access this field using:
* av_frame_get_best_effort_timestamp(frame)
@@ -1260,24 +1276,6 @@ typedef struct AVFrame {
*/
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;
/**
diff --git a/libavcodec/h264dsp.h b/libavcodec/h264dsp.h
index 490a936310..d7c192012a 100644
--- a/libavcodec/h264dsp.h
+++ b/libavcodec/h264dsp.h
@@ -30,7 +30,6 @@
#include <stdint.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,
int log2_denom, int weight, int offset);
typedef void (*h264_biweight_func)(uint8_t *dst, uint8_t *src, int stride, int height,
diff --git a/libavcodec/libdirac_libschro.c b/libavcodec/libdirac_libschro.c
deleted file mode 100644
index c8657e2fd2..0000000000
--- a/libavcodec/libdirac_libschro.c
+++ /dev/null
@@ -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;
-}
diff --git a/libavcodec/libdirac_libschro.h b/libavcodec/libdirac_libschro.h
deleted file mode 100644
index aecdb30e76..0000000000
--- a/libavcodec/libdirac_libschro.h
+++ /dev/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 */
diff --git a/libavcodec/libschroedinger.c b/libavcodec/libschroedinger.c
index a2ea5ddbdc..631035e240 100644
--- a/libavcodec/libschroedinger.c
+++ b/libavcodec/libschroedinger.c
@@ -23,12 +23,97 @@
* function definitions common to libschroedinger decoder and encoder
*/
-#include "libdirac_libschro.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
-* 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[]={
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) /
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] :
SCHRO_VIDEO_FORMAT_CUSTOM;
@@ -78,7 +163,7 @@ int ff_get_schro_frame_format (SchroChromaFormat schro_pix_fmt,
return -1;
}
-static void FreeSchroFrame(SchroFrame *frame, void *priv)
+static void free_schro_frame(SchroFrame *frame, void *priv)
{
AVPicture *p_pic = priv;
@@ -110,7 +195,7 @@ SchroFrame *ff_create_schro_frame(AVCodecContext *avccontext,
p_frame->format = schro_frame_fmt;
p_frame->width = y_width;
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) {
p_frame->components[i].width = i ? uv_width : y_width;
diff --git a/libavcodec/libschroedinger.h b/libavcodec/libschroedinger.h
index 262e0220bf..bacc0da050 100644
--- a/libavcodec/libschroedinger.h
+++ b/libavcodec/libschroedinger.h
@@ -28,8 +28,78 @@
#include <schroedinger/schrobitstream.h>
#include <schroedinger/schroframe.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 {
enum PixelFormat ff_pix_fmt;
SchroChromaFormat schro_pix_fmt;
diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c
index bd20c40d15..4929eecb28 100644
--- a/libavcodec/libschroedingerdec.c
+++ b/libavcodec/libschroedingerdec.c
@@ -29,7 +29,6 @@
#include "libavutil/imgutils.h"
#include "avcodec.h"
-#include "libdirac_libschro.h"
#include "libschroedinger.h"
#undef NDEBUG
@@ -52,7 +51,7 @@ typedef struct SchroDecoderParams {
SchroDecoder* decoder;
/** queue storing decoded frames */
- DiracSchroQueue dec_frame_queue;
+ FFSchroQueue dec_frame_queue;
/** end of sequence signalled */
int eos_signalled;
@@ -71,16 +70,19 @@ typedef struct SchroParseUnitContext {
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_size = buf_size;
}
-static SchroBuffer *FindNextSchroParseUnit(SchroParseUnitContext *parse_ctx)
+static SchroBuffer *find_next_parse_unit(SchroParseUnitContext *parse_ctx)
{
SchroBuffer *enc_buf = NULL;
int next_pu_offset = 0;
@@ -152,16 +154,10 @@ static av_cold int libschroedinger_decode_init(AVCodecContext *avccontext)
return -1;
/* 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;
}
-static void libschroedinger_decode_buffer_free(SchroBuffer *schro_buf,
- void *priv)
-{
- av_freep(&priv);
-}
-
static void libschroedinger_decode_frame_free(void *frame)
{
schro_frame_unref(frame);
@@ -223,7 +219,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
*data_size = 0;
- SchroParseContextInit(&parse_ctx, buf, buf_size);
+ parse_context_init(&parse_ctx, buf, buf_size);
if (!buf_size) {
if (!p_schro_params->eos_signalled) {
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 */
do {
- if ((enc_buf = FindNextSchroParseUnit(&parse_ctx))) {
+ if ((enc_buf = find_next_parse_unit(&parse_ctx))) {
/* Push buffer into decoder. */
if (SCHRO_PARSE_CODE_IS_PICTURE(enc_buf->data[4]) &&
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);
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;
case SCHRO_DECODER_EOS:
go = 0;
@@ -288,7 +284,7 @@ static int libschroedinger_decode_frame(AVCodecContext *avccontext,
} while (outer);
/* 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) {
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);
/* 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;
}
@@ -340,10 +336,10 @@ static void libschroedinger_flush(AVCodecContext *avccontext)
SchroDecoderParams *p_schro_params = avccontext->priv_data;
/* 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);
p_schro_params->eos_pulled = 0;
p_schro_params->eos_signalled = 0;
diff --git a/libavcodec/libschroedingerenc.c b/libavcodec/libschroedingerenc.c
index 71c4fd8955..0cea5a7194 100644
--- a/libavcodec/libschroedingerenc.c
+++ b/libavcodec/libschroedingerenc.c
@@ -36,7 +36,6 @@
#include "avcodec.h"
#include "internal.h"
-#include "libdirac_libschro.h"
#include "libschroedinger.h"
#include "bytestream.h"
@@ -65,7 +64,7 @@ typedef struct SchroEncoderParams {
int enc_buf_size;
/** queue storing encoded frames */
- DiracSchroQueue enc_frame_queue;
+ FFSchroQueue enc_frame_queue;
/** end of sequence signalled */
int eos_signalled;
@@ -80,7 +79,7 @@ typedef struct SchroEncoderParams {
/**
* 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) /
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->height = avccontext->height;
- if (SetSchroChromaFormat(avccontext) == -1)
+ if (set_chroma_format(avccontext) == -1)
return -1;
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);
/* 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;
}
@@ -259,9 +258,9 @@ static SchroFrame *libschroedinger_frame_from_data(AVCodecContext *avccontext,
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_free(enc_frame);
@@ -273,7 +272,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
int enc_size = 0;
SchroEncoderParams *p_schro_params = avccontext->priv_data;
SchroEncoder *encoder = p_schro_params->encoder;
- struct DiracSchroEncodedFrame *p_frame_output = NULL;
+ struct FFSchroEncodedFrame *p_frame_output = NULL;
int go = 1;
SchroBuffer *enc_buf;
int presentation_frame;
@@ -333,7 +332,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
}
/* Create output frame. */
- p_frame_output = av_mallocz(sizeof(DiracSchroEncodedFrame));
+ p_frame_output = av_mallocz(sizeof(FFSchroEncodedFrame));
/* Set output data. */
p_frame_output->size = p_schro_params->enc_buf_size;
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. */
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 = NULL;
@@ -373,7 +372,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
p_schro_params->eos_pulled)
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)
return 0;
@@ -410,7 +409,7 @@ static int libschroedinger_encode_frame(AVCodecContext *avccontext, AVPacket *pk
error:
/* free frame */
- SchroedingerFreeFrame(p_frame_output);
+ libschroedinger_free_frame(p_frame_output);
return ret;
}
@@ -423,8 +422,8 @@ static int libschroedinger_encode_close(AVCodecContext *avccontext)
schro_encoder_free(p_schro_params->encoder);
/* 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. */
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index a7a3874a94..abba29fb75 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -85,8 +85,7 @@ static int mm_decode_pal(MmContext *s)
*/
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) {
int run_length, color;
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index 686994d51f..482c8456af 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -1051,6 +1051,11 @@ static void validate_thread_parameters(AVCodecContext *avctx)
avctx->thread_count = 1;
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)
diff --git a/libavcodec/txd.c b/libavcodec/txd.c
index 344187d7da..f931c71390 100644
--- a/libavcodec/txd.c
+++ b/libavcodec/txd.c
@@ -48,7 +48,6 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVFrame *picture = data;
AVFrame * const p = &s->picture;
unsigned int version, w, h, d3d_format, depth, stride, flags;
- unsigned int av_unused mipmap_count;
unsigned int y, v;
uint8_t *ptr;
uint32_t *pal;
@@ -60,8 +59,7 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
w = bytestream2_get_le16(&gb);
h = bytestream2_get_le16(&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);
if (version < 8 || version > 9) {
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 71227e942a..ce60d4f684 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -390,6 +390,10 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
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)
av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, "
"internal audio buffer used\n", frame);
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 1c142d4cb4..016cfefca3 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -27,7 +27,7 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
-#define LIBAVCODEC_VERSION_MINOR 19
+#define LIBAVCODEC_VERSION_MINOR 20
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c
index 4944a3e486..8fd8da645f 100644
--- a/libavcodec/zerocodec.c
+++ b/libavcodec/zerocodec.c
@@ -65,8 +65,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data,
pic->key_frame = 1;
pic->pict_type = AV_PICTURE_TYPE_I;
} 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;
}
pic->key_frame = 0;