mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/mpegpicture: Remove always-true checks
Of all the buffers that are made writable, three are always allocated and the other four are allocated iff any one of them is allocated; so one can replace the seven checks for existence with one. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
68a90ac3e6
commit
3d5a74cc38
@ -49,21 +49,22 @@ static void av_noinline free_picture_tables(Picture *pic)
|
||||
|
||||
static int make_tables_writable(Picture *pic)
|
||||
{
|
||||
int ret, i;
|
||||
#define MAKE_WRITABLE(table) \
|
||||
do {\
|
||||
if (pic->table &&\
|
||||
(ret = av_buffer_make_writable(&pic->table)) < 0)\
|
||||
return ret;\
|
||||
int ret = av_buffer_make_writable(&pic->table); \
|
||||
if (ret < 0) \
|
||||
return ret; \
|
||||
} while (0)
|
||||
|
||||
MAKE_WRITABLE(mbskip_table_buf);
|
||||
MAKE_WRITABLE(qscale_table_buf);
|
||||
MAKE_WRITABLE(mb_type_buf);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
MAKE_WRITABLE(motion_val_buf[i]);
|
||||
MAKE_WRITABLE(ref_index_buf[i]);
|
||||
if (pic->motion_val_buf[0]) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
MAKE_WRITABLE(motion_val_buf[i]);
|
||||
MAKE_WRITABLE(ref_index_buf[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user