avcodec/mpegpicture: Use union for b_scratchpad and rd_scratchpad
These pointers point to the same buffers, so one can just use a union for them and avoid synchronising one of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
		
							parent
							
								
									12fcbff446
								
							
						
					
					
						commit
						d0f76e6a11
					
				@ -175,7 +175,6 @@ int ff_mpeg_framesize_alloc(AVCodecContext *avctx, MotionEstContext *me,
 | 
				
			|||||||
    sc->linesize = linesizeabs;
 | 
					    sc->linesize = linesizeabs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    me->temp            = me->scratchpad;
 | 
					    me->temp            = me->scratchpad;
 | 
				
			||||||
    sc->rd_scratchpad   = me->scratchpad;
 | 
					 | 
				
			||||||
    sc->b_scratchpad    = me->scratchpad;
 | 
					    sc->b_scratchpad    = me->scratchpad;
 | 
				
			||||||
    sc->obmc_scratchpad = me->scratchpad + 16;
 | 
					    sc->obmc_scratchpad = me->scratchpad + 16;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -33,9 +33,11 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
typedef struct ScratchpadContext {
 | 
					typedef struct ScratchpadContext {
 | 
				
			||||||
    uint8_t *edge_emu_buffer;     ///< temporary buffer for if MVs point to out-of-frame data
 | 
					    uint8_t *edge_emu_buffer;     ///< temporary buffer for if MVs point to out-of-frame data
 | 
				
			||||||
    uint8_t *rd_scratchpad;       ///< scratchpad for rate distortion mb decision
 | 
					 | 
				
			||||||
    uint8_t *obmc_scratchpad;
 | 
					    uint8_t *obmc_scratchpad;
 | 
				
			||||||
    uint8_t *b_scratchpad;        ///< scratchpad used for writing into write only buffers
 | 
					    union {
 | 
				
			||||||
 | 
					        uint8_t *b_scratchpad;    ///< scratchpad used for writing into write only buffers
 | 
				
			||||||
 | 
					        uint8_t *rd_scratchpad;   ///< scratchpad for rate distortion mb decision
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
    int      linesize;            ///< linesize that the buffers in this context have been allocated for
 | 
					    int      linesize;            ///< linesize that the buffers in this context have been allocated for
 | 
				
			||||||
} ScratchpadContext;
 | 
					} ScratchpadContext;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -440,7 +440,6 @@ static void free_duplicate_context(MpegEncContext *s)
 | 
				
			|||||||
    av_freep(&s->sc.edge_emu_buffer);
 | 
					    av_freep(&s->sc.edge_emu_buffer);
 | 
				
			||||||
    av_freep(&s->me.scratchpad);
 | 
					    av_freep(&s->me.scratchpad);
 | 
				
			||||||
    s->me.temp =
 | 
					    s->me.temp =
 | 
				
			||||||
    s->sc.rd_scratchpad =
 | 
					 | 
				
			||||||
    s->sc.b_scratchpad =
 | 
					    s->sc.b_scratchpad =
 | 
				
			||||||
    s->sc.obmc_scratchpad = NULL;
 | 
					    s->sc.obmc_scratchpad = NULL;
 | 
				
			||||||
    s->sc.linesize = 0;
 | 
					    s->sc.linesize = 0;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user