You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Merge remote-tracking branch 'qatar/master'
* qatar/master: cosmetics: Consistently use C-style comments with multiple inclusion guards anm: fix a few Doxygen comments misc typo and wording fixes attributes: add av_noreturn attributes: drop pointless define guards configure: do not disable av_always_inline with --enable-small flvdec: initial stream switch support avplay: fix write on freed memory for rawvideo snow: remove a VLA used for edge emulation x86: lavfi: fix gradfun/yadif build with mmx/sse disabled snow: remove the runs[] VLA. snow: Check mallocs at init flacdec: remove redundant setting of avctx->sample_fmt Conflicts: ffplay.c libavcodec/h264.c libavcodec/snow.c libavcodec/snow.h libavcodec/snowdec.c libavcodec/snowenc.c libavformat/flvdec.c libavutil/attributes.h tools/patcheck Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		| @@ -376,7 +376,7 @@ FILE *get_preset_file(char *filename, size_t filename_size, | ||||
|  * Do all the necessary cleanup and abort. | ||||
|  * This function is implemented in the avtools, not cmdutils. | ||||
|  */ | ||||
| void exit_program(int ret); | ||||
| av_noreturn void exit_program(int ret); | ||||
|  | ||||
| /** | ||||
|  * Realloc array to hold new_size elements of elem_size. | ||||
|   | ||||
							
								
								
									
										9
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								configure
									
									
									
									
										vendored
									
									
								
							| @@ -3856,15 +3856,6 @@ test -n "$assert_level" && | ||||
| test -n "$malloc_prefix" && | ||||
|     echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH | ||||
|  | ||||
| if enabled small || disabled optimizations; then | ||||
|     echo "#undef  av_always_inline"  >> $TMPH | ||||
|     if enabled small; then | ||||
|         echo "#define av_always_inline inline"  >> $TMPH | ||||
|     else | ||||
|         echo "#define av_always_inline av_unused"  >> $TMPH | ||||
|     fi | ||||
| fi | ||||
|  | ||||
| if enabled yasm; then | ||||
|     append config_files $TMPASM | ||||
|     printf '' >$TMPASM | ||||
|   | ||||
							
								
								
									
										9
									
								
								ffplay.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								ffplay.c
									
									
									
									
									
								
							| @@ -1632,6 +1632,7 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c | ||||
|  | ||||
| static int video_thread(void *arg) | ||||
| { | ||||
|     AVPacket pkt = { 0 }; | ||||
|     VideoState *is = arg; | ||||
|     AVFrame *frame = avcodec_alloc_frame(); | ||||
|     int64_t pts_int = AV_NOPTS_VALUE, pos = -1; | ||||
| @@ -1655,7 +1656,6 @@ static int video_thread(void *arg) | ||||
| #endif | ||||
|  | ||||
|     for (;;) { | ||||
|         AVPacket pkt; | ||||
| #if CONFIG_AVFILTER | ||||
|         AVFilterBufferRef *picref; | ||||
|         AVRational tb; | ||||
| @@ -1664,14 +1664,14 @@ static int video_thread(void *arg) | ||||
|             SDL_Delay(10); | ||||
|  | ||||
|         avcodec_get_frame_defaults(frame); | ||||
|         av_free_packet(&pkt); | ||||
|  | ||||
|         ret = get_video_frame(is, frame, &pts_int, &pkt); | ||||
|         if (ret < 0) | ||||
|             goto the_end; | ||||
|  | ||||
|         if (!ret) { | ||||
|             av_free_packet(&pkt); | ||||
|         if (!ret) | ||||
|             continue; | ||||
|         } | ||||
|  | ||||
| #if CONFIG_AVFILTER | ||||
|         if (   last_w != is->video_st->codec->width | ||||
| @@ -1766,6 +1766,7 @@ static int video_thread(void *arg) | ||||
|     av_freep(&vfilters); | ||||
|     avfilter_graph_free(&graph); | ||||
| #endif | ||||
|     av_free_packet(&pkt); | ||||
|     av_free(frame); | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -56,8 +56,9 @@ static av_cold int decode_init(AVCodecContext *avctx) | ||||
|  | ||||
| /** | ||||
|  * Perform decode operation | ||||
|  * @param dst, dst_end Destination image buffer | ||||
|  * @param gb, GetByteContext (optional, see below) | ||||
|  * @param dst     pointer to destination image buffer | ||||
|  * @param dst_end pointer to end of destination image buffer | ||||
|  * @param gb GetByteContext (optional, see below) | ||||
|  * @param pixel Fill color (optional, see below) | ||||
|  * @param count Pixel count | ||||
|  * @param x Pointer to x-axis counter | ||||
| @@ -66,8 +67,8 @@ static av_cold int decode_init(AVCodecContext *avctx) | ||||
|  * @return non-zero if destination buffer is exhausted | ||||
|  * | ||||
|  * a copy operation is achieved when 'gb' is set | ||||
|  * a fill operation is acheived when 'gb' is null and pixel is >= 0 | ||||
|  * a skip operation is acheived when 'gb' is null and pixel is < 0 | ||||
|  * a fill operation is achieved when 'gb' is null and pixel is >= 0 | ||||
|  * a skip operation is achieved when 'gb' is null and pixel is < 0 | ||||
|  */ | ||||
| static inline int op(uint8_t **dst, const uint8_t *dst_end, | ||||
|                      GetByteContext *gb, | ||||
|   | ||||
| @@ -552,9 +552,9 @@ typedef struct DSPContext { | ||||
|      * @param src  source array | ||||
|      *             constraints: 16-byte aligned | ||||
|      * @param min  minimum value | ||||
|      *             constraints: must in the the range [-(1<<24), 1<<24] | ||||
|      *             constraints: must be in the range [-(1 << 24), 1 << 24] | ||||
|      * @param max  maximum value | ||||
|      *             constraints: must in the the range [-(1<<24), 1<<24] | ||||
|      *             constraints: must be in the range [-(1 << 24), 1 << 24] | ||||
|      * @param len  number of elements in the array | ||||
|      *             constraints: multiple of 32 greater than zero | ||||
|      */ | ||||
|   | ||||
| @@ -108,8 +108,6 @@ static av_cold int flac_decode_init(AVCodecContext *avctx) | ||||
|     FLACContext *s = avctx->priv_data; | ||||
|     s->avctx = avctx; | ||||
|  | ||||
|     avctx->sample_fmt = AV_SAMPLE_FMT_S16; | ||||
|  | ||||
|     /* for now, the raw FLAC header is allowed to be passed to the decoder as | ||||
|        frame data instead of extradata. */ | ||||
|     if (!avctx->extradata) | ||||
|   | ||||
| @@ -1737,7 +1737,7 @@ static av_always_inline void backup_mb_border(H264Context *h, uint8_t *src_y, | ||||
|     } | ||||
|  | ||||
|     top_border = h->top_borders[top_idx][s->mb_x]; | ||||
|     /* There are two lines saved, the line above the the top macroblock | ||||
|     /* There are two lines saved, the line above the top macroblock | ||||
|      * of a pair, and the line above the bottom macroblock. */ | ||||
|     AV_COPY128(top_border, src_y + 16 * linesize); | ||||
|     if (pixel_shift) | ||||
| @@ -4443,7 +4443,7 @@ again: | ||||
|                 init_get_bits(&s->gb, ptr, bit_length); | ||||
|                 if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)) { | ||||
|                     av_log(h->s.avctx, AV_LOG_DEBUG, | ||||
|                            "SPS decoding failure, trying alternative mode\n"); | ||||
|                            "SPS decoding failure, trying again with the complete NAL\n"); | ||||
|                     if (h->is_avc) | ||||
|                         av_assert0(next_avc - buf_index + consumed == nalsize); | ||||
|                     init_get_bits(&s->gb, &buf[buf_index + 1 - consumed], | ||||
|   | ||||
| @@ -394,7 +394,8 @@ mca( 8, 8,8) | ||||
| av_cold int ff_snow_common_init(AVCodecContext *avctx){ | ||||
|     SnowContext *s = avctx->priv_data; | ||||
|     int width, height; | ||||
|     int i, j; | ||||
|     int i, j, ret; | ||||
|     int emu_buf_size; | ||||
|  | ||||
|     s->avctx= avctx; | ||||
|     s->max_ref_frames=1; //just make sure its not an invalid value in case of no initial keyframe | ||||
| @@ -447,19 +448,27 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ | ||||
|     width= s->avctx->width; | ||||
|     height= s->avctx->height; | ||||
|  | ||||
|     s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM)); | ||||
|     s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here | ||||
|     s->temp_dwt_buffer = av_mallocz(width * sizeof(DWTELEM)); | ||||
|     s->temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM)); | ||||
|     FF_ALLOCZ_OR_GOTO(avctx, s->spatial_idwt_buffer, width * height * sizeof(IDWTELEM), fail); | ||||
|     FF_ALLOCZ_OR_GOTO(avctx, s->spatial_dwt_buffer,  width * height * sizeof(DWTELEM),  fail); //FIXME this does not belong here | ||||
|     FF_ALLOCZ_OR_GOTO(avctx, s->temp_dwt_buffer,     width * sizeof(DWTELEM),  fail); | ||||
|     FF_ALLOCZ_OR_GOTO(avctx, s->temp_idwt_buffer,    width * sizeof(IDWTELEM), fail); | ||||
|     FF_ALLOC_OR_GOTO(avctx,  s->run_buffer,          ((width + 1) >> 1) * ((height + 1) >> 1) * sizeof(*s->run_buffer), fail); | ||||
|  | ||||
|     for(i=0; i<MAX_REF_FRAMES; i++) | ||||
|         for(j=0; j<MAX_REF_FRAMES; j++) | ||||
|             ff_scale_mv_ref[i][j] = 256*(i+1)/(j+1); | ||||
|  | ||||
|     s->avctx->get_buffer(s->avctx, &s->mconly_picture); | ||||
|     s->scratchbuf = av_mallocz(s->mconly_picture.linesize[0]*7*MB_SIZE); | ||||
|     if ((ret = s->avctx->get_buffer(s->avctx, &s->mconly_picture)) < 0) { | ||||
| //         av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | ||||
| //         return ret; | ||||
|     } | ||||
|     FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture.linesize[0], 2*width+256)*7*MB_SIZE, fail); | ||||
|     emu_buf_size = FFMAX(s->mconly_picture.linesize[0], 2*width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); | ||||
|     FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); | ||||
|  | ||||
|     return 0; | ||||
| fail: | ||||
|     return AVERROR(ENOMEM); | ||||
| } | ||||
|  | ||||
| int ff_snow_common_init_after_header(AVCodecContext *avctx) { | ||||
| @@ -632,6 +641,7 @@ av_cold void ff_snow_common_end(SnowContext *s) | ||||
|     av_freep(&s->temp_dwt_buffer); | ||||
|     av_freep(&s->spatial_idwt_buffer); | ||||
|     av_freep(&s->temp_idwt_buffer); | ||||
|     av_freep(&s->run_buffer); | ||||
|  | ||||
|     s->m.me.temp= NULL; | ||||
|     av_freep(&s->m.me.scratchpad); | ||||
| @@ -641,6 +651,7 @@ av_cold void ff_snow_common_end(SnowContext *s) | ||||
|  | ||||
|     av_freep(&s->block); | ||||
|     av_freep(&s->scratchbuf); | ||||
|     av_freep(&s->emu_edge_buffer); | ||||
|  | ||||
|     for(i=0; i<MAX_REF_FRAMES; i++){ | ||||
|         av_freep(&s->ref_mvs[i]); | ||||
|   | ||||
| @@ -135,6 +135,7 @@ typedef struct SnowContext{ | ||||
|     DWTELEM *temp_dwt_buffer; | ||||
|     IDWTELEM *spatial_idwt_buffer; | ||||
|     IDWTELEM *temp_idwt_buffer; | ||||
|     int *run_buffer; | ||||
|     int colorspace_type; | ||||
|     int chroma_h_shift; | ||||
|     int chroma_v_shift; | ||||
| @@ -165,7 +166,7 @@ typedef struct SnowContext{ | ||||
|     MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX) | ||||
|  | ||||
|     uint8_t *scratchbuf; | ||||
|     int *runs; | ||||
|     uint8_t *emu_edge_buffer; | ||||
| }SnowContext; | ||||
|  | ||||
| /* Tables */ | ||||
|   | ||||
| @@ -365,7 +365,12 @@ static int decode_header(SnowContext *s){ | ||||
|  | ||||
| static av_cold int decode_init(AVCodecContext *avctx) | ||||
| { | ||||
|     ff_snow_common_init(avctx); | ||||
|     int ret; | ||||
|  | ||||
|     if ((ret = ff_snow_common_init(avctx)) < 0) { | ||||
|         ff_snow_common_end(avctx->priv_data); | ||||
|         return ret; | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -156,7 +156,7 @@ static void dwt_quantize(SnowContext *s, Plane *p, DWTELEM *buffer, int width, i | ||||
| static av_cold int encode_init(AVCodecContext *avctx) | ||||
| { | ||||
|     SnowContext *s = avctx->priv_data; | ||||
|     int plane_index; | ||||
|     int plane_index, ret; | ||||
|  | ||||
|     if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){ | ||||
|         av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n" | ||||
| @@ -185,7 +185,10 @@ static av_cold int encode_init(AVCodecContext *avctx) | ||||
|         s->plane[plane_index].fast_mc= 1; | ||||
|     } | ||||
|  | ||||
|     ff_snow_common_init(avctx); | ||||
|     if ((ret = ff_snow_common_init(avctx)) < 0) { | ||||
|         ff_snow_common_end(avctx->priv_data); | ||||
|         return ret; | ||||
|     } | ||||
|     ff_snow_alloc_blocks(s); | ||||
|  | ||||
|     s->version=0; | ||||
| @@ -246,8 +249,6 @@ static av_cold int encode_init(AVCodecContext *avctx) | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     s->runs = av_malloc(avctx->width * avctx->height * sizeof(*s->runs)); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| @@ -677,7 +678,7 @@ static int get_block_rd(SnowContext *s, int mb_x, int mb_y, int plane_index, uin | ||||
|     uint8_t *src= s->  input_picture.data[plane_index]; | ||||
|     IDWTELEM *pred= (IDWTELEM*)s->m.obmc_scratchpad + plane_index*block_size*block_size*4; | ||||
|     uint8_t *cur = s->scratchbuf; | ||||
|     uint8_t tmp[ref_stride*(2*MB_SIZE+HTAPS_MAX-1)]; | ||||
|     uint8_t *tmp = s->emu_edge_buffer; | ||||
|     const int b_stride = s->b_width << s->block_max_depth; | ||||
|     const int b_height = s->b_height<< s->block_max_depth; | ||||
|     const int w= p->width; | ||||
| @@ -843,6 +844,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, | ||||
|  | ||||
|     if(1){ | ||||
|         int run=0; | ||||
|         int *runs = s->run_buffer; | ||||
|         int run_index=0; | ||||
|         int max_index; | ||||
|  | ||||
| @@ -876,7 +878,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, | ||||
|                 } | ||||
|                 if(!(/*ll|*/l|lt|t|rt|p)){ | ||||
|                     if(v){ | ||||
|                         s->runs[run_index++]= run; | ||||
|                         runs[run_index++]= run; | ||||
|                         run=0; | ||||
|                     }else{ | ||||
|                         run++; | ||||
| @@ -885,9 +887,9 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, | ||||
|             } | ||||
|         } | ||||
|         max_index= run_index; | ||||
|         s->runs[run_index++]= run; | ||||
|         runs[run_index++]= run; | ||||
|         run_index=0; | ||||
|         run= s->runs[run_index++]; | ||||
|         run= runs[run_index++]; | ||||
|  | ||||
|         put_symbol2(&s->c, b->state[30], max_index, 0); | ||||
|         if(run_index <= max_index) | ||||
| @@ -931,7 +933,7 @@ static int encode_subband_c0run(SnowContext *s, SubBand *b, const IDWTELEM *src, | ||||
|                     put_rac(&s->c, &b->state[0][context], !!v); | ||||
|                 }else{ | ||||
|                     if(!run){ | ||||
|                         run= s->runs[run_index++]; | ||||
|                         run= runs[run_index++]; | ||||
|  | ||||
|                         if(run_index <= max_index) | ||||
|                             put_symbol2(&s->c, b->state[1], run, 3); | ||||
| @@ -1909,7 +1911,6 @@ static av_cold int encode_end(AVCodecContext *avctx) | ||||
|     if (s->input_picture.data[0]) | ||||
|         avctx->release_buffer(avctx, &s->input_picture); | ||||
|     av_free(avctx->stats_out); | ||||
|     av_freep(&s->runs); | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|   | ||||
| @@ -41,7 +41,7 @@ | ||||
| #define LIBAVCODEC_IDENT        "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) | ||||
|  | ||||
| /** | ||||
|  * Those FF_API_* defines are not part of public API. | ||||
|  * These FF_API_* defines are not part of the public API. | ||||
|  * They may change, break or disappear at any time. | ||||
|  */ | ||||
| #ifndef FF_API_REQUEST_CHANNELS | ||||
|   | ||||
| @@ -147,7 +147,7 @@ struct xvmc_pix_fmt { | ||||
|     */ | ||||
|     int             filled_mv_blocks_num; | ||||
|  | ||||
|     /** Number of the the next free data block; one data block consists of | ||||
|     /** Number of the next free data block; one data block consists of | ||||
|         64 short values in the data_blocks array. | ||||
|         All blocks before this one have already been claimed by placing their | ||||
|         position into the corresponding block description structure field, | ||||
|   | ||||
| @@ -221,4 +221,4 @@ void ff_formats_unref(AVFilterFormats **ref); | ||||
|  */ | ||||
| void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref); | ||||
|  | ||||
| #endif // AVFILTER_FORMATS_H | ||||
| #endif /* AVFILTER_FORMATS_H */ | ||||
|   | ||||
| @@ -41,7 +41,7 @@ | ||||
| #define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT | ||||
|  | ||||
| /** | ||||
|  * Those FF_API_* defines are not part of public API. | ||||
|  * These FF_API_* defines are not part of the public API. | ||||
|  * They may change, break or disappear at any time. | ||||
|  */ | ||||
| #ifndef FF_API_OLD_ALL_FORMATS_API | ||||
| @@ -60,4 +60,4 @@ | ||||
| #define FF_API_BUFFERSRC_BUFFER             (LIBAVFILTER_VERSION_MAJOR < 4) | ||||
| #endif | ||||
|  | ||||
| #endif // AVFILTER_VERSION_H | ||||
| #endif /* AVFILTER_VERSION_H */ | ||||
|   | ||||
| @@ -26,9 +26,9 @@ | ||||
| DECLARE_ALIGNED(16, static const uint16_t, pw_7f)[8] = {0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F,0x7F}; | ||||
| DECLARE_ALIGNED(16, static const uint16_t, pw_ff)[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; | ||||
|  | ||||
| #if HAVE_MMX2 | ||||
| static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) | ||||
| { | ||||
| #if HAVE_MMX2 | ||||
|     intptr_t x; | ||||
|     if (width & 3) { | ||||
|         x = width & ~3; | ||||
| @@ -71,12 +71,12 @@ static void gradfun_filter_line_mmx2(uint8_t *dst, const uint8_t *src, const uin | ||||
|          "rm"(thresh), "m"(*dithers), "m"(*pw_7f) | ||||
|         :"memory" | ||||
|     ); | ||||
| #endif | ||||
| } | ||||
| #endif | ||||
|  | ||||
| #if HAVE_SSSE3 | ||||
| static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const uint16_t *dc, int width, int thresh, const uint16_t *dithers) | ||||
| { | ||||
| #if HAVE_SSSE3 | ||||
|     intptr_t x; | ||||
|     if (width & 7) { | ||||
|         // could be 10% faster if I somehow eliminated this | ||||
| @@ -118,12 +118,12 @@ static void gradfun_filter_line_ssse3(uint8_t *dst, const uint8_t *src, const ui | ||||
|          "rm"(thresh), "m"(*dithers), "m"(*pw_7f) | ||||
|         :"memory" | ||||
|     ); | ||||
| #endif // HAVE_SSSE3 | ||||
| } | ||||
| #endif // HAVE_SSSE3 | ||||
|  | ||||
| #if HAVE_SSE | ||||
| static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t *buf1, const uint8_t *src, int src_linesize, int width) | ||||
| { | ||||
| #if HAVE_SSE | ||||
| #define BLURV(load)\ | ||||
|     intptr_t x = -2*width;\ | ||||
|     __asm__ volatile(\ | ||||
| @@ -161,17 +161,23 @@ static void gradfun_blur_line_sse2(uint16_t *dc, uint16_t *buf, const uint16_t * | ||||
|     } else { | ||||
|         BLURV("movdqa"); | ||||
|     } | ||||
| #endif // HAVE_SSE | ||||
| } | ||||
| #endif // HAVE_SSE | ||||
|  | ||||
| av_cold void ff_gradfun_init_x86(GradFunContext *gf) | ||||
| { | ||||
|     int cpu_flags = av_get_cpu_flags(); | ||||
|  | ||||
|     if (HAVE_MMX2 && cpu_flags & AV_CPU_FLAG_MMX2) | ||||
| #if HAVE_MMX2 | ||||
|     if (cpu_flags & AV_CPU_FLAG_MMX2) | ||||
|         gf->filter_line = gradfun_filter_line_mmx2; | ||||
|     if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) | ||||
| #endif | ||||
| #if HAVE_SSSE3 | ||||
|     if (cpu_flags & AV_CPU_FLAG_SSSE3) | ||||
|         gf->filter_line = gradfun_filter_line_ssse3; | ||||
|     if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) | ||||
| #endif | ||||
| #if HAVE_SSE | ||||
|     if (cpu_flags & AV_CPU_FLAG_SSE2) | ||||
|         gf->blur_line = gradfun_blur_line_sse2; | ||||
| #endif | ||||
| } | ||||
|   | ||||
| @@ -24,10 +24,6 @@ | ||||
| #include "libavcodec/x86/dsputil_mmx.h" | ||||
| #include "libavfilter/yadif.h" | ||||
|  | ||||
| static void yadif_filter_line_ssse3(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); | ||||
| static void yadif_filter_line_sse2(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); | ||||
| static void yadif_filter_line_mmx(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode); | ||||
|  | ||||
| DECLARE_ASM_CONST(16, const xmm_reg, pb_1) = {0x0101010101010101ULL, 0x0101010101010101ULL}; | ||||
| DECLARE_ASM_CONST(16, const xmm_reg, pw_1) = {0x0001000100010001ULL, 0x0001000100010001ULL}; | ||||
|  | ||||
| @@ -57,10 +53,16 @@ av_cold void ff_yadif_init_x86(YADIFContext *yadif) | ||||
| { | ||||
|     int cpu_flags = av_get_cpu_flags(); | ||||
|  | ||||
|     if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) | ||||
| #if HAVE_MMX | ||||
|     if (cpu_flags & AV_CPU_FLAG_MMX) | ||||
|         yadif->filter_line = yadif_filter_line_mmx; | ||||
|     if (HAVE_SSE && cpu_flags & AV_CPU_FLAG_SSE2) | ||||
| #endif | ||||
| #if HAVE_SSE | ||||
|     if (cpu_flags & AV_CPU_FLAG_SSE2) | ||||
|         yadif->filter_line = yadif_filter_line_sse2; | ||||
|     if (HAVE_SSSE3 && cpu_flags & AV_CPU_FLAG_SSSE3) | ||||
| #endif | ||||
| #if HAVE_SSSE3 | ||||
|     if (cpu_flags & AV_CPU_FLAG_SSSE3) | ||||
|         yadif->filter_line = yadif_filter_line_ssse3; | ||||
| #endif | ||||
| } | ||||
|   | ||||
| @@ -76,6 +76,59 @@ static AVStream *create_stream(AVFormatContext *s, int tag, int codec_type){ | ||||
|     avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ | ||||
|     return st; | ||||
| } | ||||
| static int flv_same_audio_codec(AVCodecContext *acodec, int flags) | ||||
| { | ||||
|     int bits_per_coded_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; | ||||
|     int flv_codecid = flags & FLV_AUDIO_CODECID_MASK; | ||||
|     int codec_id; | ||||
|  | ||||
|     if (!acodec->codec_id && !acodec->codec_tag) | ||||
|         return 1; | ||||
|  | ||||
|     if (acodec->bits_per_coded_sample != bits_per_coded_sample) | ||||
|         return 0; | ||||
|  | ||||
|     switch(flv_codecid) { | ||||
|         //no distinction between S16 and S8 PCM codec flags | ||||
|     case FLV_CODECID_PCM: | ||||
|         codec_id = bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : | ||||
| #if HAVE_BIGENDIAN | ||||
|                             CODEC_ID_PCM_S16BE; | ||||
| #else | ||||
|                             CODEC_ID_PCM_S16LE; | ||||
| #endif | ||||
|         return codec_id == acodec->codec_id; | ||||
|     case FLV_CODECID_PCM_LE: | ||||
|         codec_id = bits_per_coded_sample == 8 ? CODEC_ID_PCM_U8 : CODEC_ID_PCM_S16LE; | ||||
|         return codec_id == acodec->codec_id; | ||||
|     case FLV_CODECID_AAC: | ||||
|         return acodec->codec_id == CODEC_ID_AAC; | ||||
|     case FLV_CODECID_ADPCM: | ||||
|         return acodec->codec_id == CODEC_ID_ADPCM_SWF; | ||||
|     case FLV_CODECID_SPEEX: | ||||
|         return acodec->codec_id == CODEC_ID_SPEEX; | ||||
|     case FLV_CODECID_MP3: | ||||
|         return acodec->codec_id == CODEC_ID_MP3; | ||||
|     case FLV_CODECID_NELLYMOSER_8KHZ_MONO: | ||||
|         return acodec->sample_rate == 8000 && | ||||
|                acodec->codec_id == CODEC_ID_NELLYMOSER; | ||||
|     case FLV_CODECID_NELLYMOSER_16KHZ_MONO: | ||||
|         return acodec->sample_rate == 16000 && | ||||
|                acodec->codec_id == CODEC_ID_NELLYMOSER; | ||||
|     case FLV_CODECID_NELLYMOSER: | ||||
|         return acodec->codec_id == CODEC_ID_NELLYMOSER; | ||||
|     case FLV_CODECID_PCM_MULAW: | ||||
|         return acodec->sample_rate == 8000 && | ||||
|                acodec->codec_id == CODEC_ID_PCM_MULAW; | ||||
|     case FLV_CODECID_PCM_ALAW: | ||||
|         return acodec->sample_rate = 8000 && | ||||
|                acodec->codec_id == CODEC_ID_PCM_ALAW; | ||||
|     default: | ||||
|         return acodec->codec_tag == (flv_codecid >> FLV_AUDIO_CODECID_OFFSET); | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecContext *acodec, int flv_codecid) { | ||||
|     switch(flv_codecid) { | ||||
| @@ -122,6 +175,33 @@ static void flv_set_audio_codec(AVFormatContext *s, AVStream *astream, AVCodecCo | ||||
|     } | ||||
| } | ||||
|  | ||||
| static int flv_same_video_codec(AVCodecContext *vcodec, int flags) | ||||
| { | ||||
|     int flv_codecid = flags & FLV_VIDEO_CODECID_MASK; | ||||
|  | ||||
|     if (!vcodec->codec_id && !vcodec->codec_tag) | ||||
|         return 1; | ||||
|  | ||||
|     switch (flv_codecid) { | ||||
|         case FLV_CODECID_H263: | ||||
|             return vcodec->codec_id == CODEC_ID_FLV1; | ||||
|         case FLV_CODECID_SCREEN: | ||||
|             return vcodec->codec_id == CODEC_ID_FLASHSV; | ||||
|         case FLV_CODECID_SCREEN2: | ||||
|             return vcodec->codec_id == CODEC_ID_FLASHSV2; | ||||
|         case FLV_CODECID_VP6: | ||||
|             return vcodec->codec_id == CODEC_ID_VP6F; | ||||
|         case FLV_CODECID_VP6A: | ||||
|             return vcodec->codec_id == CODEC_ID_VP6A; | ||||
|         case FLV_CODECID_H264: | ||||
|             return vcodec->codec_id == CODEC_ID_H264; | ||||
|         default: | ||||
|             return vcodec->codec_tag == flv_codecid; | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
| static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_codecid) { | ||||
|     AVCodecContext *vcodec = vstream->codec; | ||||
|     switch(flv_codecid) { | ||||
| @@ -516,7 +596,7 @@ static int flv_data_packet(AVFormatContext *s, AVPacket *pkt, | ||||
|  | ||||
|     for (i = 0; i < s->nb_streams; i++) { | ||||
|         st = s->streams[i]; | ||||
|         if (st->id == 2) | ||||
|         if (st->codec->codec_type == AVMEDIA_TYPE_DATA) | ||||
|             break; | ||||
|     } | ||||
|  | ||||
| @@ -616,8 +696,18 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) | ||||
|     /* now find stream */ | ||||
|     for(i=0;i<s->nb_streams;i++) { | ||||
|         st = s->streams[i]; | ||||
|         if (st->id == stream_type) | ||||
|         if (stream_type == FLV_STREAM_TYPE_AUDIO && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { | ||||
|             if (flv_same_audio_codec(st->codec, flags)) { | ||||
|                 break; | ||||
|             } | ||||
|         } else | ||||
|         if (stream_type == FLV_STREAM_TYPE_VIDEO && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { | ||||
|             if (flv_same_video_codec(st->codec, flags)) { | ||||
|                 break; | ||||
|             } | ||||
|         } else if (st->id == stream_type) { | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|     if(i == s->nb_streams){ | ||||
|         av_log(s, AV_LOG_WARNING, "Stream discovered after head already parsed\n"); | ||||
|   | ||||
| @@ -77,7 +77,7 @@ enum CodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type); | ||||
| #define RTCP_TX_RATIO_DEN 1000 | ||||
|  | ||||
| /* An arbitrary id value for RTP Xiph streams - only relevant to indicate | ||||
|  * the the configuration has changed within a stream (by changing the | ||||
|  * that the configuration has changed within a stream (by changing the | ||||
|  * ident value sent). | ||||
|  */ | ||||
| #define RTP_XIPH_IDENT 0xfecdba | ||||
|   | ||||
| @@ -44,7 +44,7 @@ | ||||
| #define LIBAVFORMAT_IDENT       "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) | ||||
|  | ||||
| /** | ||||
|  * Those FF_API_* defines are not part of public API. | ||||
|  * These FF_API_* defines are not part of the public API. | ||||
|  * They may change, break or disappear at any time. | ||||
|  */ | ||||
| #ifndef FF_API_OLD_AVIO | ||||
|   | ||||
| @@ -75,7 +75,6 @@ static av_always_inline av_const int16_t av_clip_int16_arm(int a) | ||||
|     return x; | ||||
| } | ||||
|  | ||||
| #if !CONFIG_SMALL //the code below cannot be compiled without always_inline | ||||
| #define av_clip_uintp2 av_clip_uintp2_arm | ||||
| static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) | ||||
| { | ||||
| @@ -83,7 +82,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) | ||||
|     __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); | ||||
|     return x; | ||||
| } | ||||
| #endif //!CONFIG_SMALL | ||||
|  | ||||
|  | ||||
| #else /* HAVE_ARMV6 */ | ||||
|  | ||||
|   | ||||
| @@ -50,65 +50,45 @@ | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_noreturn | ||||
| #if AV_GCC_VERSION_AT_LEAST(2,5) | ||||
| #    define av_noreturn __attribute__((noreturn)) | ||||
| #else | ||||
| #    define av_noreturn | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_noinline | ||||
| #if AV_GCC_VERSION_AT_LEAST(3,1) | ||||
| #    define av_noinline __attribute__((noinline)) | ||||
| #else | ||||
| #    define av_noinline | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_pure | ||||
| #if AV_GCC_VERSION_AT_LEAST(3,1) | ||||
| #    define av_pure __attribute__((pure)) | ||||
| #else | ||||
| #    define av_pure | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_restrict | ||||
| #define av_restrict restrict | ||||
| #endif | ||||
|  | ||||
| #ifndef av_const | ||||
| #if AV_GCC_VERSION_AT_LEAST(2,6) | ||||
| #    define av_const __attribute__((const)) | ||||
| #else | ||||
| #    define av_const | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_cold | ||||
| #if AV_GCC_VERSION_AT_LEAST(4,3) | ||||
| #    define av_cold __attribute__((cold)) | ||||
| #else | ||||
| #    define av_cold | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_flatten | ||||
| #if AV_GCC_VERSION_AT_LEAST(4,1) | ||||
| #    define av_flatten __attribute__((flatten)) | ||||
| #else | ||||
| #    define av_flatten | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef attribute_deprecated | ||||
| #if AV_GCC_VERSION_AT_LEAST(3,1) | ||||
| #    define attribute_deprecated __attribute__((deprecated)) | ||||
| #else | ||||
| #    define attribute_deprecated | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Disable warnings about deprecated features | ||||
| @@ -128,42 +108,34 @@ | ||||
| #endif | ||||
|  | ||||
|  | ||||
| #ifndef av_unused | ||||
| #if defined(__GNUC__) | ||||
| #    define av_unused __attribute__((unused)) | ||||
| #else | ||||
| #    define av_unused | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| /** | ||||
|  * Mark a variable as used and prevent the compiler from optimizing it | ||||
|  * away.  This is useful for variables accessed only from inline | ||||
|  * assembler without the compiler being aware. | ||||
|  */ | ||||
| #ifndef av_used | ||||
| #if AV_GCC_VERSION_AT_LEAST(3,1) | ||||
| #    define av_used __attribute__((used)) | ||||
| #else | ||||
| #    define av_used | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_alias | ||||
| #if AV_GCC_VERSION_AT_LEAST(3,3) | ||||
| #   define av_alias __attribute__((may_alias)) | ||||
| #else | ||||
| #   define av_alias | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifndef av_uninit | ||||
| #if defined(__GNUC__) && !defined(__INTEL_COMPILER) | ||||
| #    define av_uninit(x) x=x | ||||
| #else | ||||
| #    define av_uninit(x) x | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| #ifdef __GNUC__ | ||||
| #    define av_builtin_constant_p __builtin_constant_p | ||||
| @@ -173,4 +145,10 @@ | ||||
| #    define av_printf_format(fmtpos, attrpos) | ||||
| #endif | ||||
|  | ||||
| #if AV_GCC_VERSION_AT_LEAST(2,5) | ||||
| #    define av_noreturn __attribute__((noreturn)) | ||||
| #else | ||||
| #    define av_noreturn | ||||
| #endif | ||||
|  | ||||
| #endif /* AVUTIL_ATTRIBUTES_H */ | ||||
|   | ||||
| @@ -124,4 +124,4 @@ void av_dict_free(AVDictionary **m); | ||||
|  * @} | ||||
|  */ | ||||
|  | ||||
| #endif // AVUTIL_DICT_H | ||||
| #endif /* AVUTIL_DICT_H */ | ||||
|   | ||||
| @@ -67,7 +67,8 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^ | ||||
| cat $TMP | ||||
| hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $* | ||||
|  | ||||
| hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $* | ||||
| hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive|funtions|overriden|outputing|seperation|initalize|compatibilty)\b' 'common typos' $* | ||||
|  | ||||
| hiegrep 'av_log\( *NULL' 'Missing context in av_log' $* | ||||
| hiegrep '[^sn]printf' 'Please use av_log' $* | ||||
| hiegrep '\bmalloc' 'Please use av_malloc' $* | ||||
|   | ||||
		Reference in New Issue
	
	Block a user