Commit f9569249 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  Remove some unused scripts from tools/.
  Add x86 assembly for some 10-bit H.264 intra predict functions.
  v4l2: do not force NTSC as standard
  Skip tableprint.h during 'make checkheaders'.
  Remove unnecessary LIBAVFORMAT_BUILD #ifdef.
  Drop explicit filenames from @file Doxygen tags.
  Skip generated table headers during 'make checkheaders'.
  lavf,lavc: free avoptions in a generic way.
  AVOptions: add av_opt_free convenience function.
  tableprint: Restore mistakenly deleted common.h #include for FF_ARRAY_ELEMS.
  tiff: print log in case of unknown / unsupported tag.
  tiff: fix linesize for mono-white/black formats.
  Fix build of eval-test program
  configure: Document --enable-vaapi
  ac3enc: extract all exponents for the frame at once
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 6700aa88 eb7505e4
......@@ -106,7 +106,7 @@ Configuration options:
--disable-lpc disable LPC code
--disable-mdct disable MDCT code
--disable-rdft disable RDFT code
--disable-vaapi disable VAAPI code
--enable-vaapi enable VAAPI code
--disable-vdpau disable VDPAU code
--disable-dxva2 disable DXVA2 code
--enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
......
......@@ -37,6 +37,9 @@ API changes, most recent first:
2011-05-XX - XXXXXX - lavfi 2.6.0 - avcodec.h
Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h.
2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h
Add av_opt_free convenience function.
2011-05-28 - 0420bd7 - lavu 51.2.0 - pixdesc.h
Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
......
......@@ -666,8 +666,12 @@ OBJS-$(!CONFIG_SMALL) += inverse.o
-include $(SUBDIR)$(ARCH)/Makefile
SKIPHEADERS += %_tablegen.h aac_tablegen_decl.h \
fft-internal.h $(ARCH)/vp56_arith.h
SKIPHEADERS += %_tablegen.h \
%_tables.h \
aac_tablegen_decl.h \
fft-internal.h \
tableprint.h \
$(ARCH)/vp56_arith.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
......@@ -675,7 +679,7 @@ SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snow
TESTPROGS-$(HAVE_MMX) += motion
TESTOBJS = dctref.o
......
......@@ -870,15 +870,11 @@ static av_cold void exponent_init(AC3EncodeContext *s)
*/
static void extract_exponents(AC3EncodeContext *s)
{
int blk, ch;
int ch = !s->cpl_on;
int chan_size = AC3_MAX_COEFS * AC3_MAX_BLOCKS * (s->channels - ch + 1);
AC3Block *block = &s->blocks[0];
for (ch = !s->cpl_on; ch <= s->channels; ch++) {
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
AC3Block *block = &s->blocks[blk];
s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch],
AC3_MAX_COEFS);
}
}
s->ac3dsp.extract_exponents(block->exp[ch], block->fixed_coef[ch], chan_size);
}
......
......@@ -20,7 +20,7 @@
*/
/**
* @file libavcodec/lagarith.c
* @file
* Lagarith lossless decoder
* @author Nathan Caldwell
*/
......
......@@ -21,7 +21,7 @@
*/
/**
* @file libavcodec/lagarithrac.c
* @file
* Lagarith range decoder
* @author Nathan Caldwell
* @author David Conrad
......
......@@ -21,7 +21,7 @@
*/
/**
* @file libavcodec/lagarithrac.h
* @file
* Lagarith range decoder
* @author Nathan Caldwell
* @author David Conrad
......
......@@ -26,6 +26,8 @@
#include <inttypes.h>
#include <stdio.h>
#include "libavutil/common.h"
#define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\
void write_##type##_array(const type *data, int len)\
{\
......
......@@ -477,7 +477,6 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, const uint8_t *
if(s->compr == TIFF_G4)
s->fax_opts = value;
break;
default:
av_log(s->avctx, AV_LOG_DEBUG, "Unknown or unsupported tag %d/0X%0X\n", tag, tag);
}
......
......@@ -858,6 +858,9 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->codec->close(avctx);
avcodec_default_free_buffers(avctx);
avctx->coded_frame = NULL;
if (avctx->codec && avctx->codec->priv_class)
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
av_freep(&avctx->priv_data);
if(avctx->codec && avctx->codec->encode)
av_freep(&avctx->extradata);
......
......@@ -16,7 +16,8 @@ YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
x86/h264_idct_10bit.o \
x86/h264_weight.o \
YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o
YASM-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred.o \
x86/h264_intrapred_10bit.o
MMX-OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
YASM-OBJS-$(CONFIG_VC1_DECODER) += x86/vc1dsp_yasm.o
......
;*****************************************************************************
;* MMX/SSE2/AVX-optimized 10-bit H.264 intra prediction code
;*****************************************************************************
;* Copyright (C) 2005-2011 x264 project
;*
;* Authors: Daniel Kang <daniel.d.kang@gmail.com>
;*
;* This file is part of Libav.
;*
;* Libav 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.
;*
;* Libav 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 Libav; if not, write to the Free Software
;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
;******************************************************************************
%include "x86inc.asm"
%include "x86util.asm"
SECTION_RODATA
SECTION .text
cextern pw_4
cextern pw_1
%macro PRED4x4_LOWPASS 4
paddw %2, %3
psrlw %2, 1
pavgw %1, %4, %2
%endmacro
;-----------------------------------------------------------------------------
; void pred4x4_down_right(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_DR 1
cglobal pred4x4_down_right_10_%1, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movhps m1, [r1-8]
movhps m2, [r0+r2*1-8]
movhps m4, [r0-8]
punpckhwd m2, m4
movq m3, [r0]
punpckhdq m1, m2
PALIGNR m3, m1, 10, m1
mova m1, m3
movhps m4, [r1+r2*1-8]
PALIGNR m3, m4, 14, m4
mova m2, m3
movhps m4, [r1+r2*2-8]
PALIGNR m3, m4, 14, m4
PRED4x4_LOWPASS m0, m3, m1, m2
movq [r1+r2*2], m0
psrldq m0, 2
movq [r1+r2*1], m0
psrldq m0, 2
movq [r0+r2*2], m0
psrldq m0, 2
movq [r0+r2*1], m0
RET
%endmacro
INIT_XMM
%define PALIGNR PALIGNR_MMX
PRED4x4_DR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_DR ssse3
%ifdef HAVE_AVX
INIT_AVX
PRED4x4_DR avx
%endif
;-----------------------------------------------------------------------------
; void pred4x4_vertical_right(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_VR 1
cglobal pred4x4_vertical_right_10_%1, 3,3,6
sub r0, r2
lea r1, [r0+r2*2]
movq m5, [r0] ; ........t3t2t1t0
movhps m1, [r0-8]
PALIGNR m0, m5, m1, 14, m1 ; ......t3t2t1t0lt
pavgw m5, m0
movhps m1, [r0+r2*1-8]
PALIGNR m0, m1, 14, m1 ; ....t3t2t1t0ltl0
mova m1, m0
movhps m2, [r0+r2*2-8]
PALIGNR m0, m2, 14, m2 ; ..t3t2t1t0ltl0l1
mova m2, m0
movhps m3, [r1+r2*1-8]
PALIGNR m0, m3, 14, m3 ; t3t2t1t0ltl0l1l2
PRED4x4_LOWPASS m3, m1, m0, m2
pslldq m1, m3, 12
psrldq m3, 4
movq [r0+r2*1], m5
movq [r0+r2*2], m3
PALIGNR m5, m1, 14, m2
pslldq m1, 2
movq [r1+r2*1], m5
PALIGNR m3, m1, 14, m1
movq [r1+r2*2], m3
RET
%endmacro
INIT_XMM
%define PALIGNR PALIGNR_MMX
PRED4x4_VR sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_VR ssse3
%ifdef HAVE_AVX
INIT_AVX
PRED4x4_VR avx
%endif
;-----------------------------------------------------------------------------
; void pred4x4_horizontal_down(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_HD 1
cglobal pred4x4_horizontal_down_10_%1, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movq m0, [r0-8] ; lt ..
movhps m0, [r0]
pslldq m0, 2 ; t2 t1 t0 lt .. .. .. ..
movq m1, [r1+r2*2-8] ; l3
movq m3, [r1+r2*1-8]
punpcklwd m1, m3 ; l2 l3
movq m2, [r0+r2*2-8] ; l1
movq m3, [r0+r2*1-8]
punpcklwd m2, m3 ; l0 l1
punpckhdq m1, m2 ; l0 l1 l2 l3
punpckhqdq m1, m0 ; t2 t1 t0 lt l0 l1 l2 l3
psrldq m0, m1, 4 ; .. .. t2 t1 t0 lt l0 l1
psrldq m2, m1, 2 ; .. t2 t1 t0 lt l0 l1 l2
pavgw m5, m1, m2
PRED4x4_LOWPASS m3, m1, m0, m2
punpcklwd m5, m3
psrldq m3, 8
PALIGNR m3, m5, 12, m4
movq [r1+r2*2], m5
movhps [r0+r2*2], m5
psrldq m5, 4
movq [r1+r2*1], m5
movq [r0+r2*1], m3
RET
%endmacro
INIT_XMM
%define PALIGNR PALIGNR_MMX
PRED4x4_HD sse2
%define PALIGNR PALIGNR_SSSE3
PRED4x4_HD ssse3
%ifdef HAVE_AVX
INIT_AVX
PRED4x4_HD avx
%endif
;-----------------------------------------------------------------------------
; void pred4x4_dc(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
%macro HADDD 2 ; sum junk
%if mmsize == 16
movhlps %2, %1
paddd %1, %2
pshuflw %2, %1, 0xE
paddd %1, %2
%else
pshufw %2, %1, 0xE
paddd %1, %2
%endif
%endmacro
%macro HADDW 2
pmaddwd %1, [pw_1]
HADDD %1, %2
%endmacro
INIT_MMX
cglobal pred4x4_dc_10_mmxext, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movq m2, [r0+r2*1-8]
paddw m2, [r0+r2*2-8]
paddw m2, [r1+r2*1-8]
paddw m2, [r1+r2*2-8]
psrlq m2, 48
movq m0, [r0]
HADDW m0, m1
paddw m0, [pw_4]
paddw m0, m2
psrlw m0, 3
SPLATW m0, m0, 0
movq [r0+r2*1], m0
movq [r0+r2*2], m0
movq [r1+r2*1], m0
movq [r1+r2*2], m0
RET
;-----------------------------------------------------------------------------
; void pred4x4_down_left(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
;TODO: more AVX here
%macro PRED4x4_DL 1
cglobal pred4x4_down_left_10_%1, 3,3
sub r0, r2
movq m1, [r0]
movhps m1, [r1]
pslldq m5, m1, 2
pxor m2, m5, m1
psrldq m2, 2
pxor m3, m1, m2
PRED4x4_LOWPASS m0, m5, m3, m1
lea r1, [r0+r2*2]
movhps [r1+r2*2], m0
psrldq m0, 2
movq [r0+r2*1], m0
psrldq m0, 2
movq [r0+r2*2], m0
psrldq m0, 2
movq [r1+r2*1], m0
RET
%endmacro
INIT_XMM
PRED4x4_DL sse2
%ifdef HAVE_AVX
INIT_AVX
PRED4x4_DL avx
%endif
;-----------------------------------------------------------------------------
; void pred4x4_vertical_left(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_VL 1
cglobal pred4x4_vertical_left_10_%1, 3,3
sub r0, r2
movu m1, [r0]
movhps m1, [r1]
psrldq m3, m1, 2
psrldq m2, m1, 4
pavgw m4, m3, m1
PRED4x4_LOWPASS m0, m1, m2, m3
lea r1, [r0+r2*2]
movq [r0+r2*1], m4
movq [r0+r2*2], m0
psrldq m4, 2
psrldq m0, 2
movq [r1+r2*1], m4
movq [r1+r2*2], m0
RET
%endmacro
INIT_XMM
PRED4x4_VL sse2
%ifdef HAVE_AVX
INIT_AVX
PRED4x4_VL avx
%endif
;-----------------------------------------------------------------------------
; void pred4x4_horizontal_up(pixel *src, const pixel *topright, int stride)
;-----------------------------------------------------------------------------
INIT_MMX
cglobal pred4x4_horizontal_up_10_mmxext, 3,3
sub r0, r2
lea r1, [r0+r2*2]
movq m0, [r0+r2*1-8]
punpckhwd m0, [r0+r2*2-8]
movq m1, [r1+r2*1-8]
punpckhwd m1, [r1+r2*2-8]
punpckhdq m0, m1
pshufw m1, m1, 0xFF
movq [r1+r2*2], m1
movd [r1+r2*1+4], m1
pshufw m2, m0, 11111001b
movq m1, m2
pavgw m2, m0
pshufw m5, m0, 11111110b
PRED4x4_LOWPASS m3, m0, m5, m1
movq m6, m2
punpcklwd m6, m3
movq [r0+r2*1], m6
psrlq m2, 16
psrlq m3, 16
punpcklwd m2, m3
movq [r0+r2*2], m2
psrlq m2, 32
movd [r1+r2*1], m2
RET
;-----------------------------------------------------------------------------
; void pred8x8_vertical(pixel *src, int stride)
;-----------------------------------------------------------------------------
INIT_XMM
cglobal pred8x8_vertical_10_sse2, 2,2
sub r0, r1
mova m0, [r0]
%rep 3
mova [r0+r1*1], m0
mova [r0+r1*2], m0
lea r0, [r0+r1*2]
%endrep
mova [r0+r1*1], m0
mova [r0+r1*2], m0
RET
;-----------------------------------------------------------------------------
; void pred8x8_horizontal(pixel *src, int stride)
;-----------------------------------------------------------------------------
INIT_XMM
cglobal pred8x8_horizontal_10_sse2, 2,3
mov r2, 4
.loop:
movq m0, [r0+r1*0-8]
movq m1, [r0+r1*1-8]
pshuflw m0, m0, 0xff
pshuflw m1, m1, 0xff
punpcklqdq m0, m0
punpcklqdq m1, m1
mova [r0+r1*0], m0
mova [r0+r1*1], m1
lea r0, [r0+r1*2]
dec r2
jg .loop
REP_RET
......@@ -21,6 +21,31 @@
#include "libavutil/cpu.h"
#include "libavcodec/h264pred.h"
#define PRED4x4(TYPE, DEPTH, OPT) \
void ff_pred4x4_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, const uint8_t *topright, int stride);
PRED4x4(dc, 10, mmxext)
PRED4x4(down_left, 10, sse2)
PRED4x4(down_left, 10, avx)
PRED4x4(down_right, 10, sse2)
PRED4x4(down_right, 10, ssse3)
PRED4x4(down_right, 10, avx)
PRED4x4(vertical_left, 10, sse2)
PRED4x4(vertical_left, 10, avx)
PRED4x4(vertical_right, 10, sse2)
PRED4x4(vertical_right, 10, ssse3)
PRED4x4(vertical_right, 10, avx)
PRED4x4(horizontal_up, 10, mmxext)
PRED4x4(horizontal_down, 10, sse2)
PRED4x4(horizontal_down, 10, ssse3)
PRED4x4(horizontal_down, 10, avx)
#define PRED8x8(TYPE, DEPTH, OPT) \
void ff_pred8x8_ ## TYPE ## _ ## DEPTH ## _ ## OPT (uint8_t *src, int stride);
PRED8x8(vertical, 10, sse2)
PRED8x8(horizontal, 10, sse2)
void ff_pred16x16_vertical_mmx (uint8_t *src, int stride);
void ff_pred16x16_vertical_sse (uint8_t *src, int stride);
void ff_pred16x16_horizontal_mmx (uint8_t *src, int stride);
......@@ -98,11 +123,8 @@ void ff_pred4x4_vertical_vp8_mmxext(uint8_t *src, const uint8_t *topright, int s
void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth)
{
int mm_flags = av_get_cpu_flags();
const int high_depth = bit_depth > 8;
if (high_depth)
return;
if (bit_depth == 8) {
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX) {
h->pred16x16[VERT_PRED8x8] = ff_pred16x16_vertical_mmx;
......@@ -226,4 +248,35 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
}
}
#endif
} else if (bit_depth == 10) {
#if HAVE_YASM
if (mm_flags & AV_CPU_FLAG_MMX2) {
h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
h->pred4x4[HOR_UP_PRED ] = ff_pred4x4_horizontal_up_10_mmxext;
}
if (mm_flags & AV_CPU_FLAG_SSE2) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_sse2;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_sse2;
h->pred4x4[VERT_LEFT_PRED ] = ff_pred4x4_vertical_left_10_sse2;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_sse2;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_sse2;
h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vertical_10_sse2;
h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_horizontal_10_sse2;
}
if (mm_flags & AV_CPU_FLAG_SSSE3) {
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_ssse3;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_ssse3;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_ssse3;
}
#if HAVE_AVX
if (mm_flags&AV_CPU_FLAG_AVX) {
h->pred4x4[DIAG_DOWN_LEFT_PRED ] = ff_pred4x4_down_left_10_avx;
h->pred4x4[DIAG_DOWN_RIGHT_PRED] = ff_pred4x4_down_right_10_avx;
h->pred4x4[VERT_RIGHT_PRED ] = ff_pred4x4_vertical_right_10_avx;
h->pred4x4[HOR_DOWN_PRED ] = ff_pred4x4_horizontal_down_10_avx;
}
#endif /* HAVE_AVX */
#endif /* HAVE_YASM */
}
}
......@@ -320,8 +320,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
last_frame_time = 0;
out:
av_freep(&s->video_size);
av_freep(&s->framerate);
return ret;
}
......
......@@ -103,7 +103,6 @@ av_cold static int fbdev_read_header(AVFormatContext *avctx,
int ret, flags = O_RDONLY;
ret = av_parse_video_rate(&fbdev->fps, fbdev->framerate);
av_freep(&fbdev->framerate);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n");
return ret;
......
......@@ -316,8 +316,6 @@ out_camera:
dc1394_video_set_transmission(dc1394->camera, DC1394_OFF);
dc1394_camera_free (dc1394->camera);
out:
av_freep(&dc1394->video_size);
av_freep(&dc1394->pixel_format);
dc1394_free(dc1394->d);
return ret;
}
......
......@@ -663,10 +663,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;
out:
av_freep(&s->video_size);
av_freep(&s->pixel_format);
av_freep(&s->standard);
av_freep(&s->framerate);
return res;
}
......@@ -714,7 +710,7 @@ static int v4l2_read_close(AVFormatContext *s1)
#define DEC AV_OPT_FLAG_DECODING_PARAM
static const AVOption options[] = {
{ "standard", "", OFFSET(standard), FF_OPT_TYPE_STRING, {.str = NULL }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
{ "standard", "", OFFSET(standard), FF_OPT_TYPE_STRING, {.str = "NTSC" }, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
{ "channel", "", OFFSET(channel), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
{ "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
......
......@@ -232,9 +232,6 @@ static int vfw_read_close(AVFormatContext *s)
pktl = next;
}
av_freep(&ctx->video_size);
av_freep(&ctx->framerate);
return 0;
}
......
......@@ -259,8 +259,6 @@ x11grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->bit_rate = x11grab->frame_size * 1/av_q2d(x11grab->time_base) * 8;
out:
av_freep(&x11grab->video_size);
av_freep(&x11grab->framerate);
return ret;
}
......
......@@ -102,9 +102,6 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = height;
st->codec->pix_fmt = pix_fmt;
fail:
av_freep(&s1->video_size);
av_freep(&s1->pixel_format);
av_freep(&s1->framerate);
return ret;
}
default:
......@@ -183,7 +180,6 @@ int ff_raw_video_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, 1200000);
fail:
av_freep(&s1->framerate);
return ret;
}
......
......@@ -121,7 +121,6 @@ static int read_header(AVFormatContext *avctx,
}
fail:
av_freep(&s->video_size);
return ret;
}
......
......@@ -2592,6 +2592,10 @@ void avformat_free_context(AVFormatContext *s)
int i;
AVStream *st;
av_opt_free(s);
if (s->iformat && s->iformat->priv_class)
av_opt_free(s->priv_data);
for(i=0;i<s->nb_streams;i++) {
/* free all data in a stream component */
st = s->streams[i];
......@@ -2621,7 +2625,6 @@ void avformat_free_context(AVFormatContext *s)
}
av_freep(&s->chapters);
av_metadata_free(&s->metadata);
av_freep(&s->key);
av_freep(&s->streams);
av_free(s);
}
......@@ -3201,6 +3204,8 @@ fail:
av_freep(&s->streams[i]->priv_data);
av_freep(&s->streams[i]->index_entries);
}
if (s->iformat && s->iformat->priv_class)
av_opt_free(s->priv_data);
av_freep(&s->priv_data);
return ret;
}
......
......@@ -75,7 +75,7 @@ OBJS-$(ARCH_ARM) += arm/cpu.o
OBJS-$(ARCH_PPC) += ppc/cpu.o
OBJS-$(ARCH_X86) += x86/cpu.o
TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha tree
TESTPROGS = adler32 aes base64 cpu crc des eval lls md5 pca sha tree
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
DIRS = arm bfin sh4 x86
......
......@@ -142,7 +142,6 @@
#define strncpy strncpy_is_forbidden_due_to_security_issues_use_av_strlcpy
#undef exit
#define exit exit_is_forbidden
#ifndef LIBAVFORMAT_BUILD
#undef printf
#define printf please_use_av_log_instead_of_printf
#undef fprintf
......@@ -151,7 +150,6 @@
#define puts please_use_av_log_instead_of_puts
#undef perror
#define perror please_use_av_log_instead_of_perror
#endif
#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\
{\
......
......@@ -520,6 +520,14 @@ int av_set_options_string(void *ctx, const char *opts,
return count;
}
void av_opt_free(void *obj)
{
const AVOption *o = NULL;
while ((o = av_next_option(obj, o)))
if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY)
av_freep((uint8_t *)obj + o->offset);
}
#ifdef TEST
#undef printf
......
......@@ -176,4 +176,9 @@ void av_opt_set_defaults2(void *s, int mask, int flags);
int av_set_options_string(void *ctx, const char *opts,
const char *key_val_sep, const char *pairs_sep);
/**
* Free all string and binary options in obj.
*/
void av_opt_free(void *obj);
#endif /* AVUTIL_OPT_H */
#!/bin/sh
sed 's/unsigned//g' |\
sed 's/enum//g' |\
egrep '^ *(int|float|double|AVRational|char *\*) *[a-zA-Z_0-9]* *;' |\
sed 's/^ *\([^ ]*\)[ *]*\([^;]*\);.*$/{"\2", NULL, OFFSET(\2), FF_OPT_TYPE_\U\1, DEFAULT, \1_MIN, \1_MAX},/' |\
sed 's/AVRATIONAL_M/INT_M/g'|\
sed 's/TYPE_AVRATIONAL/TYPE_RATIONAL/g'|\
sed 's/FLOAT_M/FLT_M/g'|\
sed 's/FF_OPT_TYPE_CHAR/FF_OPT_TYPE_STRING/g'
#!/bin/sh
#GPL
#TODO
#add pixelformat/sampleformat into the path of the codecs
FFP=../ffprobe
TMP=$(mktemp) || exit 1
TARGET=$1
shift
for v do
BASE=$(basename $v)
echo $v | egrep -i '(public|private)' >/dev/null && echo Warning $v may be private
$FFP $v 2> $TMP
FORM=$((grep 'Input #0, ' -m1 $TMP || echo 'Input #0, unknown') | sed 's/Input #0, \([a-zA-Z0-9_]*\).*/\1/' )
mkdir -p $TARGET/container/$FORM
ln -s $v $TARGET/container/$FORM/$BASE
eval $(grep 'Stream #0\.[^:]*: [a-zA-Z0-9][^:]*: [a-zA-Z0-9]' $TMP | sed 's#[^:]*: \([a-zA-Z0-9]*\)[^:]*: \([a-zA-Z0-9]*\).*#mkdir -p '$TARGET'/\1/\2 ; ln -s '$v' '$TARGET'/\1/\2/'$BASE' ; #')
done
rm $TMP
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment