id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
25,763
void bdrv_init(void) { module_call_init(MODULE_INIT_BLOCK); }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
void bdrv_init(void) { module_call_init(MODULE_INIT_BLOCK); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { module_call_init(MODULE_INIT_BLOCK); }
[ "void FUNC_0(void)\n{", "module_call_init(MODULE_INIT_BLOCK);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
25,764
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); Error *err = NULL; if (strcmp(device, "vnc") == 0 && (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0)) { if (!arg) { monitor_read_password(mon, hmp_change_read_arg, NULL); return; } } qmp_change(device, target, !!arg, arg, &err); if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) { monitor_printf(mon, "%s (%s) is encrypted.\n", error_get_field(err, "device"), error_get_field(err, "filename")); if (!monitor_get_rs(mon)) { monitor_printf(mon, "terminal does not support password prompting\n"); error_free(err); return; } readline_start(monitor_get_rs(mon), "Password: ", 1, cb_hmp_change_bdrv_pwd, err); return; } hmp_handle_error(mon, &err); }
false
qemu
eef5ad1086403d8ac8d91208a0e8dc34734b671c
void hmp_change(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); const char *target = qdict_get_str(qdict, "target"); const char *arg = qdict_get_try_str(qdict, "arg"); Error *err = NULL; if (strcmp(device, "vnc") == 0 && (strcmp(target, "passwd") == 0 || strcmp(target, "password") == 0)) { if (!arg) { monitor_read_password(mon, hmp_change_read_arg, NULL); return; } } qmp_change(device, target, !!arg, arg, &err); if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) { monitor_printf(mon, "%s (%s) is encrypted.\n", error_get_field(err, "device"), error_get_field(err, "filename")); if (!monitor_get_rs(mon)) { monitor_printf(mon, "terminal does not support password prompting\n"); error_free(err); return; } readline_start(monitor_get_rs(mon), "Password: ", 1, cb_hmp_change_bdrv_pwd, err); return; } hmp_handle_error(mon, &err); }
{ "code": [], "line_no": [] }
void FUNC_0(Monitor *VAR_0, const QDict *VAR_1) { const char *VAR_2 = qdict_get_str(VAR_1, "VAR_2"); const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); const char *VAR_4 = qdict_get_try_str(VAR_1, "VAR_4"); Error *err = NULL; if (strcmp(VAR_2, "vnc") == 0 && (strcmp(VAR_3, "passwd") == 0 || strcmp(VAR_3, "password") == 0)) { if (!VAR_4) { monitor_read_password(VAR_0, hmp_change_read_arg, NULL); return; } } qmp_change(VAR_2, VAR_3, !!VAR_4, VAR_4, &err); if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) { monitor_printf(VAR_0, "%s (%s) is encrypted.\n", error_get_field(err, "VAR_2"), error_get_field(err, "filename")); if (!monitor_get_rs(VAR_0)) { monitor_printf(VAR_0, "terminal does not support password prompting\n"); error_free(err); return; } readline_start(monitor_get_rs(VAR_0), "Password: ", 1, cb_hmp_change_bdrv_pwd, err); return; } hmp_handle_error(VAR_0, &err); }
[ "void FUNC_0(Monitor *VAR_0, const QDict *VAR_1)\n{", "const char *VAR_2 = qdict_get_str(VAR_1, \"VAR_2\");", "const char *VAR_3 = qdict_get_str(VAR_1, \"VAR_3\");", "const char *VAR_4 = qdict_get_try_str(VAR_1, \"VAR_4\");", "Error *err = NULL;", "if (strcmp(VAR_2, \"vnc\") == 0 &&\n(strcmp(VAR_3, \"passwd\") == 0 ||\nstrcmp(VAR_3, \"password\") == 0)) {", "if (!VAR_4) {", "monitor_read_password(VAR_0, hmp_change_read_arg, NULL);", "return;", "}", "}", "qmp_change(VAR_2, VAR_3, !!VAR_4, VAR_4, &err);", "if (error_is_type(err, QERR_DEVICE_ENCRYPTED)) {", "monitor_printf(VAR_0, \"%s (%s) is encrypted.\\n\",\nerror_get_field(err, \"VAR_2\"),\nerror_get_field(err, \"filename\"));", "if (!monitor_get_rs(VAR_0)) {", "monitor_printf(VAR_0,\n\"terminal does not support password prompting\\n\");", "error_free(err);", "return;", "}", "readline_start(monitor_get_rs(VAR_0), \"Password: \", 1,\ncb_hmp_change_bdrv_pwd, err);", "return;", "}", "hmp_handle_error(VAR_0, &err);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
25,765
static void gen_loop(DisasContext *ctx, int r1, int32_t offset) { int l1; l1 = gen_new_label(); tcg_gen_subi_tl(cpu_gpr_a[r1], cpu_gpr_a[r1], 1); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr_a[r1], -1, l1); gen_goto_tb(ctx, 1, ctx->pc + offset); gen_set_label(l1); gen_goto_tb(ctx, 0, ctx->next_pc); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_loop(DisasContext *ctx, int r1, int32_t offset) { int l1; l1 = gen_new_label(); tcg_gen_subi_tl(cpu_gpr_a[r1], cpu_gpr_a[r1], 1); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr_a[r1], -1, l1); gen_goto_tb(ctx, 1, ctx->pc + offset); gen_set_label(l1); gen_goto_tb(ctx, 0, ctx->next_pc); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, int VAR_1, int32_t VAR_2) { int VAR_3; VAR_3 = gen_new_label(); tcg_gen_subi_tl(cpu_gpr_a[VAR_1], cpu_gpr_a[VAR_1], 1); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr_a[VAR_1], -1, VAR_3); gen_goto_tb(VAR_0, 1, VAR_0->pc + VAR_2); gen_set_label(VAR_3); gen_goto_tb(VAR_0, 0, VAR_0->next_pc); }
[ "static void FUNC_0(DisasContext *VAR_0, int VAR_1, int32_t VAR_2)\n{", "int VAR_3;", "VAR_3 = gen_new_label();", "tcg_gen_subi_tl(cpu_gpr_a[VAR_1], cpu_gpr_a[VAR_1], 1);", "tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr_a[VAR_1], -1, VAR_3);", "gen_goto_tb(VAR_0, 1, VAR_0->pc + VAR_2);", "gen_set_label(VAR_3);", "gen_goto_tb(VAR_0, 0, VAR_0->next_pc);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
25,766
static void tight_send_compact_size(VncState *vs, size_t len) { int lpc = 0; int bytes = 0; char buf[3] = {0, 0, 0}; buf[bytes++] = len & 0x7F; if (len > 0x7F) { buf[bytes-1] |= 0x80; buf[bytes++] = (len >> 7) & 0x7F; if (len > 0x3FFF) { buf[bytes-1] |= 0x80; buf[bytes++] = (len >> 14) & 0xFF; } } for (lpc = 0; lpc < bytes; lpc++) { vnc_write_u8(vs, buf[lpc]); } }
false
qemu
245f7b51c0ea04fb2224b1127430a096c91aee70
static void tight_send_compact_size(VncState *vs, size_t len) { int lpc = 0; int bytes = 0; char buf[3] = {0, 0, 0}; buf[bytes++] = len & 0x7F; if (len > 0x7F) { buf[bytes-1] |= 0x80; buf[bytes++] = (len >> 7) & 0x7F; if (len > 0x3FFF) { buf[bytes-1] |= 0x80; buf[bytes++] = (len >> 14) & 0xFF; } } for (lpc = 0; lpc < bytes; lpc++) { vnc_write_u8(vs, buf[lpc]); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VncState *VAR_0, size_t VAR_1) { int VAR_2 = 0; int VAR_3 = 0; char VAR_4[3] = {0, 0, 0}; VAR_4[VAR_3++] = VAR_1 & 0x7F; if (VAR_1 > 0x7F) { VAR_4[VAR_3-1] |= 0x80; VAR_4[VAR_3++] = (VAR_1 >> 7) & 0x7F; if (VAR_1 > 0x3FFF) { VAR_4[VAR_3-1] |= 0x80; VAR_4[VAR_3++] = (VAR_1 >> 14) & 0xFF; } } for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { vnc_write_u8(VAR_0, VAR_4[VAR_2]); } }
[ "static void FUNC_0(VncState *VAR_0, size_t VAR_1)\n{", "int VAR_2 = 0;", "int VAR_3 = 0;", "char VAR_4[3] = {0, 0, 0};", "VAR_4[VAR_3++] = VAR_1 & 0x7F;", "if (VAR_1 > 0x7F) {", "VAR_4[VAR_3-1] |= 0x80;", "VAR_4[VAR_3++] = (VAR_1 >> 7) & 0x7F;", "if (VAR_1 > 0x3FFF) {", "VAR_4[VAR_3-1] |= 0x80;", "VAR_4[VAR_3++] = (VAR_1 >> 14) & 0xFF;", "}", "}", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "vnc_write_u8(VAR_0, VAR_4[VAR_2]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
25,767
static inline void gen_evmwsmi(DisasContext *ctx) { TCGv_i64 t0, t1; if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64(); /* t0 := rA; t1 := rB */ #if defined(TARGET_PPC64) tcg_gen_ext32s_tl(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_ext32s_tl(t1, cpu_gpr[rB(ctx->opcode)]); #else tcg_gen_ext_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_ext_tl_i64(t1, cpu_gpr[rB(ctx->opcode)]); #endif tcg_gen_mul_i64(t0, t0, t1); /* t0 := rA * rB */ gen_store_gpr64(rD(ctx->opcode), t0); /* rD := t0 */ tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); }
false
qemu
27a69bb088bee6d4efea254659422fb9c751b3c7
static inline void gen_evmwsmi(DisasContext *ctx) { TCGv_i64 t0, t1; if (unlikely(!ctx->spe_enabled)) { gen_exception(ctx, POWERPC_EXCP_APU); return; } t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64(); #if defined(TARGET_PPC64) tcg_gen_ext32s_tl(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_ext32s_tl(t1, cpu_gpr[rB(ctx->opcode)]); #else tcg_gen_ext_tl_i64(t0, cpu_gpr[rA(ctx->opcode)]); tcg_gen_ext_tl_i64(t1, cpu_gpr[rB(ctx->opcode)]); #endif tcg_gen_mul_i64(t0, t0, t1); gen_store_gpr64(rD(ctx->opcode), t0); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(DisasContext *VAR_0) { TCGv_i64 t0, t1; if (unlikely(!VAR_0->spe_enabled)) { gen_exception(VAR_0, POWERPC_EXCP_APU); return; } t0 = tcg_temp_new_i64(); t1 = tcg_temp_new_i64(); #if defined(TARGET_PPC64) tcg_gen_ext32s_tl(t0, cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_ext32s_tl(t1, cpu_gpr[rB(VAR_0->opcode)]); #else tcg_gen_ext_tl_i64(t0, cpu_gpr[rA(VAR_0->opcode)]); tcg_gen_ext_tl_i64(t1, cpu_gpr[rB(VAR_0->opcode)]); #endif tcg_gen_mul_i64(t0, t0, t1); gen_store_gpr64(rD(VAR_0->opcode), t0); tcg_temp_free_i64(t0); tcg_temp_free_i64(t1); }
[ "static inline void FUNC_0(DisasContext *VAR_0)\n{", "TCGv_i64 t0, t1;", "if (unlikely(!VAR_0->spe_enabled)) {", "gen_exception(VAR_0, POWERPC_EXCP_APU);", "return;", "}", "t0 = tcg_temp_new_i64();", "t1 = tcg_temp_new_i64();", "#if defined(TARGET_PPC64)\ntcg_gen_ext32s_tl(t0, cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_ext32s_tl(t1, cpu_gpr[rB(VAR_0->opcode)]);", "#else\ntcg_gen_ext_tl_i64(t0, cpu_gpr[rA(VAR_0->opcode)]);", "tcg_gen_ext_tl_i64(t1, cpu_gpr[rB(VAR_0->opcode)]);", "#endif\ntcg_gen_mul_i64(t0, t0, t1);", "gen_store_gpr64(rD(VAR_0->opcode), t0);", "tcg_temp_free_i64(t0);", "tcg_temp_free_i64(t1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 43 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ] ]
25,768
static uint64_t subpage_ram_read(void *opaque, target_phys_addr_t addr, unsigned size) { ram_addr_t raddr = addr; void *ptr = qemu_get_ram_ptr(raddr); switch (size) { case 1: return ldub_p(ptr); case 2: return lduw_p(ptr); case 4: return ldl_p(ptr); default: abort(); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t subpage_ram_read(void *opaque, target_phys_addr_t addr, unsigned size) { ram_addr_t raddr = addr; void *ptr = qemu_get_ram_ptr(raddr); switch (size) { case 1: return ldub_p(ptr); case 2: return lduw_p(ptr); case 4: return ldl_p(ptr); default: abort(); } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { ram_addr_t raddr = addr; void *VAR_0 = qemu_get_ram_ptr(raddr); switch (size) { case 1: return ldub_p(VAR_0); case 2: return lduw_p(VAR_0); case 4: return ldl_p(VAR_0); default: abort(); } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "ram_addr_t raddr = addr;", "void *VAR_0 = qemu_get_ram_ptr(raddr);", "switch (size) {", "case 1: return ldub_p(VAR_0);", "case 2: return lduw_p(VAR_0);", "case 4: return ldl_p(VAR_0);", "default: abort();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
25,770
static int xan_decode_init(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; int i; s->avctx = avctx; if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); return -1; } avctx->pix_fmt = PIX_FMT_PAL8; avctx->has_b_frames = 0; dsputil_init(&s->dsp, avctx); /* initialize the RGB -> YUV tables */ for (i = 0; i < 256; i++) { y_r_table[i] = Y_R * i; y_g_table[i] = Y_G * i; y_b_table[i] = Y_B * i; u_r_table[i] = U_R * i; u_g_table[i] = U_G * i; u_b_table[i] = U_B * i; v_r_table[i] = V_R * i; v_g_table[i] = V_G * i; v_b_table[i] = V_B * i; } if(avcodec_check_dimensions(avctx, avctx->width, avctx->height)) return -1; s->buffer1 = av_malloc(avctx->width * avctx->height); s->buffer2 = av_malloc(avctx->width * avctx->height); if (!s->buffer1 || !s->buffer2) return -1; return 0; }
false
FFmpeg
ca16618b01abfde44b4eaf92dc89b01aa1b4a91e
static int xan_decode_init(AVCodecContext *avctx) { XanContext *s = avctx->priv_data; int i; s->avctx = avctx; if ((avctx->codec->id == CODEC_ID_XAN_WC3) && (s->avctx->palctrl == NULL)) { av_log(avctx, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); return -1; } avctx->pix_fmt = PIX_FMT_PAL8; avctx->has_b_frames = 0; dsputil_init(&s->dsp, avctx); for (i = 0; i < 256; i++) { y_r_table[i] = Y_R * i; y_g_table[i] = Y_G * i; y_b_table[i] = Y_B * i; u_r_table[i] = U_R * i; u_g_table[i] = U_G * i; u_b_table[i] = U_B * i; v_r_table[i] = V_R * i; v_g_table[i] = V_G * i; v_b_table[i] = V_B * i; } if(avcodec_check_dimensions(avctx, avctx->width, avctx->height)) return -1; s->buffer1 = av_malloc(avctx->width * avctx->height); s->buffer2 = av_malloc(avctx->width * avctx->height); if (!s->buffer1 || !s->buffer2) return -1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { XanContext *s = VAR_0->priv_data; int VAR_1; s->VAR_0 = VAR_0; if ((VAR_0->codec->id == CODEC_ID_XAN_WC3) && (s->VAR_0->palctrl == NULL)) { av_log(VAR_0, AV_LOG_ERROR, " WC3 Xan video: palette expected.\n"); return -1; } VAR_0->pix_fmt = PIX_FMT_PAL8; VAR_0->has_b_frames = 0; dsputil_init(&s->dsp, VAR_0); for (VAR_1 = 0; VAR_1 < 256; VAR_1++) { y_r_table[VAR_1] = Y_R * VAR_1; y_g_table[VAR_1] = Y_G * VAR_1; y_b_table[VAR_1] = Y_B * VAR_1; u_r_table[VAR_1] = U_R * VAR_1; u_g_table[VAR_1] = U_G * VAR_1; u_b_table[VAR_1] = U_B * VAR_1; v_r_table[VAR_1] = V_R * VAR_1; v_g_table[VAR_1] = V_G * VAR_1; v_b_table[VAR_1] = V_B * VAR_1; } if(avcodec_check_dimensions(VAR_0, VAR_0->width, VAR_0->height)) return -1; s->buffer1 = av_malloc(VAR_0->width * VAR_0->height); s->buffer2 = av_malloc(VAR_0->width * VAR_0->height); if (!s->buffer1 || !s->buffer2) return -1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "XanContext *s = VAR_0->priv_data;", "int VAR_1;", "s->VAR_0 = VAR_0;", "if ((VAR_0->codec->id == CODEC_ID_XAN_WC3) &&\n(s->VAR_0->palctrl == NULL)) {", "av_log(VAR_0, AV_LOG_ERROR, \" WC3 Xan video: palette expected.\\n\");", "return -1;", "}", "VAR_0->pix_fmt = PIX_FMT_PAL8;", "VAR_0->has_b_frames = 0;", "dsputil_init(&s->dsp, VAR_0);", "for (VAR_1 = 0; VAR_1 < 256; VAR_1++) {", "y_r_table[VAR_1] = Y_R * VAR_1;", "y_g_table[VAR_1] = Y_G * VAR_1;", "y_b_table[VAR_1] = Y_B * VAR_1;", "u_r_table[VAR_1] = U_R * VAR_1;", "u_g_table[VAR_1] = U_G * VAR_1;", "u_b_table[VAR_1] = U_B * VAR_1;", "v_r_table[VAR_1] = V_R * VAR_1;", "v_g_table[VAR_1] = V_G * VAR_1;", "v_b_table[VAR_1] = V_B * VAR_1;", "}", "if(avcodec_check_dimensions(VAR_0, VAR_0->width, VAR_0->height))\nreturn -1;", "s->buffer1 = av_malloc(VAR_0->width * VAR_0->height);", "s->buffer2 = av_malloc(VAR_0->width * VAR_0->height);", "if (!s->buffer1 || !s->buffer2)\nreturn -1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 81 ], [ 83 ] ]
25,771
void gen_intermediate_code_internal(XtensaCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUXtensaState *env = &cpu->env; DisasContext dc; int insn_count = 0; int j, lj = -1; int max_insns = tb->cflags & CF_COUNT_MASK; uint32_t pc_start = tb->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.tb = tb; dc.pc = pc_start; dc.ring = tb->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (tb->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = tb->flags & XTENSA_TBFLAG_DEBUG; dc.icount = tb->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (tb->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; dc.window = ((tb->flags & XTENSA_TBFLAG_WINDOW_MASK) >> XTENSA_TBFLAG_WINDOW_SHIFT); init_litbase(&dc); init_sar_tracker(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(tb); if (tb->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (search_pc) { j = tcg_op_buf_count(); if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc.pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = insn_count; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (insn_count + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int label = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, label); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(label); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++insn_count; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && !tcg_op_buf_full()); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(tb, insn_count); #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (search_pc) { j = tcg_op_buf_count(); memset(tcg_ctx.gen_opc_instr_start + lj + 1, 0, (j - lj) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { tb->size = dc.pc - pc_start; tb->icount = insn_count; } }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
void gen_intermediate_code_internal(XtensaCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUXtensaState *env = &cpu->env; DisasContext dc; int insn_count = 0; int j, lj = -1; int max_insns = tb->cflags & CF_COUNT_MASK; uint32_t pc_start = tb->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.tb = tb; dc.pc = pc_start; dc.ring = tb->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (tb->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = tb->flags & XTENSA_TBFLAG_DEBUG; dc.icount = tb->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (tb->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; dc.window = ((tb->flags & XTENSA_TBFLAG_WINDOW_MASK) >> XTENSA_TBFLAG_WINDOW_SHIFT); init_litbase(&dc); init_sar_tracker(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(tb); if (tb->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (search_pc) { j = tcg_op_buf_count(); if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc.pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = insn_count; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (insn_count + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int label = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, label); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(label); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++insn_count; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && !tcg_op_buf_full()); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(tb, insn_count); #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (search_pc) { j = tcg_op_buf_count(); memset(tcg_ctx.gen_opc_instr_start + lj + 1, 0, (j - lj) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { tb->size = dc.pc - pc_start; tb->icount = insn_count; } }
{ "code": [], "line_no": [] }
void FUNC_0(XtensaCPU *VAR_0, TranslationBlock *VAR_1, bool VAR_2) { CPUState *cs = CPU(VAR_0); CPUXtensaState *env = &VAR_0->env; DisasContext dc; int VAR_3 = 0; int VAR_4, VAR_5 = -1; int VAR_6 = VAR_1->cflags & CF_COUNT_MASK; uint32_t pc_start = VAR_1->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (VAR_6 == 0) { VAR_6 = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.VAR_1 = VAR_1; dc.pc = pc_start; dc.ring = VAR_1->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (VAR_1->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = VAR_1->flags & XTENSA_TBFLAG_DEBUG; dc.icount = VAR_1->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (VAR_1->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; dc.window = ((VAR_1->flags & XTENSA_TBFLAG_WINDOW_MASK) >> XTENSA_TBFLAG_WINDOW_SHIFT); init_litbase(&dc); init_sar_tracker(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(VAR_1); if (VAR_1->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (VAR_2) { VAR_4 = tcg_op_buf_count(); if (VAR_5 < VAR_4) { VAR_5++; while (VAR_5 < VAR_4) { tcg_ctx.gen_opc_instr_start[VAR_5++] = 0; } } tcg_ctx.gen_opc_pc[VAR_5] = dc.pc; tcg_ctx.gen_opc_instr_start[VAR_5] = 1; tcg_ctx.gen_opc_icount[VAR_5] = VAR_3; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (VAR_3 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int VAR_7 = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, VAR_7); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(VAR_7); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++VAR_3; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && VAR_3 < VAR_6 && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && !tcg_op_buf_full()); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (VAR_1->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(VAR_1, VAR_3); #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (VAR_2) { VAR_4 = tcg_op_buf_count(); memset(tcg_ctx.gen_opc_instr_start + VAR_5 + 1, 0, (VAR_4 - VAR_5) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { VAR_1->size = dc.pc - pc_start; VAR_1->icount = VAR_3; } }
[ "void FUNC_0(XtensaCPU *VAR_0,\nTranslationBlock *VAR_1, bool VAR_2)\n{", "CPUState *cs = CPU(VAR_0);", "CPUXtensaState *env = &VAR_0->env;", "DisasContext dc;", "int VAR_3 = 0;", "int VAR_4, VAR_5 = -1;", "int VAR_6 = VAR_1->cflags & CF_COUNT_MASK;", "uint32_t pc_start = VAR_1->pc;", "uint32_t next_page_start =\n(pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;", "if (VAR_6 == 0) {", "VAR_6 = CF_COUNT_MASK;", "}", "dc.config = env->config;", "dc.singlestep_enabled = cs->singlestep_enabled;", "dc.VAR_1 = VAR_1;", "dc.pc = pc_start;", "dc.ring = VAR_1->flags & XTENSA_TBFLAG_RING_MASK;", "dc.cring = (VAR_1->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring;", "dc.lbeg = env->sregs[LBEG];", "dc.lend = env->sregs[LEND];", "dc.is_jmp = DISAS_NEXT;", "dc.ccount_delta = 0;", "dc.debug = VAR_1->flags & XTENSA_TBFLAG_DEBUG;", "dc.icount = VAR_1->flags & XTENSA_TBFLAG_ICOUNT;", "dc.cpenable = (VAR_1->flags & XTENSA_TBFLAG_CPENABLE_MASK) >>\nXTENSA_TBFLAG_CPENABLE_SHIFT;", "dc.window = ((VAR_1->flags & XTENSA_TBFLAG_WINDOW_MASK) >>\nXTENSA_TBFLAG_WINDOW_SHIFT);", "init_litbase(&dc);", "init_sar_tracker(&dc);", "if (dc.icount) {", "dc.next_icount = tcg_temp_local_new_i32();", "}", "gen_tb_start(VAR_1);", "if (VAR_1->flags & XTENSA_TBFLAG_EXCEPTION) {", "tcg_gen_movi_i32(cpu_pc, dc.pc);", "gen_exception(&dc, EXCP_DEBUG);", "}", "do {", "check_breakpoint(env, &dc);", "if (VAR_2) {", "VAR_4 = tcg_op_buf_count();", "if (VAR_5 < VAR_4) {", "VAR_5++;", "while (VAR_5 < VAR_4) {", "tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;", "}", "}", "tcg_ctx.gen_opc_pc[VAR_5] = dc.pc;", "tcg_ctx.gen_opc_instr_start[VAR_5] = 1;", "tcg_ctx.gen_opc_icount[VAR_5] = VAR_3;", "}", "if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {", "tcg_gen_debug_insn_start(dc.pc);", "}", "++dc.ccount_delta;", "if (VAR_3 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) {", "gen_io_start();", "}", "if (dc.icount) {", "int VAR_7 = gen_new_label();", "tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1);", "tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, VAR_7);", "tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]);", "if (dc.debug) {", "gen_debug_exception(&dc, DEBUGCAUSE_IC);", "}", "gen_set_label(VAR_7);", "}", "if (dc.debug) {", "gen_ibreak_check(env, &dc);", "}", "disas_xtensa_insn(env, &dc);", "++VAR_3;", "if (dc.icount) {", "tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount);", "}", "if (cs->singlestep_enabled) {", "tcg_gen_movi_i32(cpu_pc, dc.pc);", "gen_exception(&dc, EXCP_DEBUG);", "break;", "}", "} while (dc.is_jmp == DISAS_NEXT &&", "VAR_3 < VAR_6 &&\ndc.pc < next_page_start &&\ndc.pc + xtensa_insn_len(env, &dc) <= next_page_start &&\n!tcg_op_buf_full());", "reset_litbase(&dc);", "reset_sar_tracker(&dc);", "if (dc.icount) {", "tcg_temp_free(dc.next_icount);", "}", "if (VAR_1->cflags & CF_LAST_IO) {", "gen_io_end();", "}", "if (dc.is_jmp == DISAS_NEXT) {", "gen_jumpi(&dc, dc.pc, 0);", "}", "gen_tb_end(VAR_1, VAR_3);", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"----------------\\n\");", "qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));", "log_target_disas(env, pc_start, dc.pc - pc_start, 0);", "qemu_log(\"\\n\");", "}", "#endif\nif (VAR_2) {", "VAR_4 = tcg_op_buf_count();", "memset(tcg_ctx.gen_opc_instr_start + VAR_5 + 1, 0,\n(VAR_4 - VAR_5) * sizeof(tcg_ctx.gen_opc_instr_start[0]));", "} else {", "VAR_1->size = dc.pc - pc_start;", "VAR_1->icount = VAR_3;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63, 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203, 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255, 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ] ]
25,772
static void restore_median_il(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode) { int i, j, slice; int A, B, C; uint8_t *bsrc; int slice_start, slice_height; const int cmask = ~(rmode ? 3 : 1); const int stride2 = stride << 1; for (slice = 0; slice < slices; slice++) { slice_start = ((slice * height) / slices) & cmask; slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start; slice_height >>= 1; bsrc = src + slice_start * stride; // first line - left neighbour prediction bsrc[0] += 0x80; A = bsrc[0]; for (i = step; i < width * step; i += step) { bsrc[i] += A; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { bsrc[stride + i] += A; A = bsrc[stride + i]; } bsrc += stride2; if (slice_height == 1) // second line - first element has top prediction, the rest uses median C = bsrc[-stride2]; bsrc[0] += C; A = bsrc[0]; for (i = step; i < width * step; i += step) { B = bsrc[i - stride2]; bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { B = bsrc[i - stride]; bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[stride + i]; } bsrc += stride2; // the rest of lines use continuous median prediction for (j = 2; j < slice_height; j++) { for (i = 0; i < width * step; i += step) { B = bsrc[i - stride2]; bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { B = bsrc[i - stride]; bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i + stride]; } bsrc += stride2; } } }
true
FFmpeg
0ce3a0f9d9523a9bcad4c6d451ca5bbd7a4f420d
static void restore_median_il(uint8_t *src, int step, int stride, int width, int height, int slices, int rmode) { int i, j, slice; int A, B, C; uint8_t *bsrc; int slice_start, slice_height; const int cmask = ~(rmode ? 3 : 1); const int stride2 = stride << 1; for (slice = 0; slice < slices; slice++) { slice_start = ((slice * height) / slices) & cmask; slice_height = ((((slice + 1) * height) / slices) & cmask) - slice_start; slice_height >>= 1; bsrc = src + slice_start * stride; bsrc[0] += 0x80; A = bsrc[0]; for (i = step; i < width * step; i += step) { bsrc[i] += A; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { bsrc[stride + i] += A; A = bsrc[stride + i]; } bsrc += stride2; if (slice_height == 1) C = bsrc[-stride2]; bsrc[0] += C; A = bsrc[0]; for (i = step; i < width * step; i += step) { B = bsrc[i - stride2]; bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { B = bsrc[i - stride]; bsrc[stride + i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[stride + i]; } bsrc += stride2; for (j = 2; j < slice_height; j++) { for (i = 0; i < width * step; i += step) { B = bsrc[i - stride2]; bsrc[i] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i]; } for (i = 0; i < width * step; i += step) { B = bsrc[i - stride]; bsrc[i + stride] += mid_pred(A, B, (uint8_t)(A + B - C)); C = B; A = bsrc[i + stride]; } bsrc += stride2; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6) { int VAR_7, VAR_8, VAR_9; int VAR_10, VAR_11, VAR_12; uint8_t *bsrc; int VAR_13, VAR_14; const int VAR_15 = ~(VAR_6 ? 3 : 1); const int VAR_16 = VAR_2 << 1; for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++) { VAR_13 = ((VAR_9 * VAR_4) / VAR_5) & VAR_15; VAR_14 = ((((VAR_9 + 1) * VAR_4) / VAR_5) & VAR_15) - VAR_13; VAR_14 >>= 1; bsrc = VAR_0 + VAR_13 * VAR_2; bsrc[0] += 0x80; VAR_10 = bsrc[0]; for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { bsrc[VAR_7] += VAR_10; VAR_10 = bsrc[VAR_7]; } for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { bsrc[VAR_2 + VAR_7] += VAR_10; VAR_10 = bsrc[VAR_2 + VAR_7]; } bsrc += VAR_16; if (VAR_14 == 1) VAR_12 = bsrc[-VAR_16]; bsrc[0] += VAR_12; VAR_10 = bsrc[0]; for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { VAR_11 = bsrc[VAR_7 - VAR_16]; bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12)); VAR_12 = VAR_11; VAR_10 = bsrc[VAR_7]; } for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { VAR_11 = bsrc[VAR_7 - VAR_2]; bsrc[VAR_2 + VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12)); VAR_12 = VAR_11; VAR_10 = bsrc[VAR_2 + VAR_7]; } bsrc += VAR_16; for (VAR_8 = 2; VAR_8 < VAR_14; VAR_8++) { for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { VAR_11 = bsrc[VAR_7 - VAR_16]; bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12)); VAR_12 = VAR_11; VAR_10 = bsrc[VAR_7]; } for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) { VAR_11 = bsrc[VAR_7 - VAR_2]; bsrc[VAR_7 + VAR_2] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12)); VAR_12 = VAR_11; VAR_10 = bsrc[VAR_7 + VAR_2]; } bsrc += VAR_16; } } }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5, int VAR_6)\n{", "int VAR_7, VAR_8, VAR_9;", "int VAR_10, VAR_11, VAR_12;", "uint8_t *bsrc;", "int VAR_13, VAR_14;", "const int VAR_15 = ~(VAR_6 ? 3 : 1);", "const int VAR_16 = VAR_2 << 1;", "for (VAR_9 = 0; VAR_9 < VAR_5; VAR_9++) {", "VAR_13 = ((VAR_9 * VAR_4) / VAR_5) & VAR_15;", "VAR_14 = ((((VAR_9 + 1) * VAR_4) / VAR_5) & VAR_15) -\nVAR_13;", "VAR_14 >>= 1;", "bsrc = VAR_0 + VAR_13 * VAR_2;", "bsrc[0] += 0x80;", "VAR_10 = bsrc[0];", "for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "bsrc[VAR_7] += VAR_10;", "VAR_10 = bsrc[VAR_7];", "}", "for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "bsrc[VAR_2 + VAR_7] += VAR_10;", "VAR_10 = bsrc[VAR_2 + VAR_7];", "}", "bsrc += VAR_16;", "if (VAR_14 == 1)\nVAR_12 = bsrc[-VAR_16];", "bsrc[0] += VAR_12;", "VAR_10 = bsrc[0];", "for (VAR_7 = VAR_1; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "VAR_11 = bsrc[VAR_7 - VAR_16];", "bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));", "VAR_12 = VAR_11;", "VAR_10 = bsrc[VAR_7];", "}", "for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "VAR_11 = bsrc[VAR_7 - VAR_2];", "bsrc[VAR_2 + VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));", "VAR_12 = VAR_11;", "VAR_10 = bsrc[VAR_2 + VAR_7];", "}", "bsrc += VAR_16;", "for (VAR_8 = 2; VAR_8 < VAR_14; VAR_8++) {", "for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "VAR_11 = bsrc[VAR_7 - VAR_16];", "bsrc[VAR_7] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));", "VAR_12 = VAR_11;", "VAR_10 = bsrc[VAR_7];", "}", "for (VAR_7 = 0; VAR_7 < VAR_3 * VAR_1; VAR_7 += VAR_1) {", "VAR_11 = bsrc[VAR_7 - VAR_2];", "bsrc[VAR_7 + VAR_2] += mid_pred(VAR_10, VAR_11, (uint8_t)(VAR_10 + VAR_11 - VAR_12));", "VAR_12 = VAR_11;", "VAR_10 = bsrc[VAR_7 + VAR_2];", "}", "bsrc += VAR_16;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 68 ], [ 70 ], [ 72 ], [ 74 ], [ 76 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ], [ 110 ], [ 112 ], [ 114 ], [ 116 ], [ 118 ], [ 120 ], [ 122 ], [ 124 ], [ 126 ], [ 128 ], [ 130 ], [ 132 ], [ 134 ] ]
25,773
static target_ulong h_put_tce_indirect(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { int i; target_ulong liobn = args[0]; target_ulong ioba = args[1]; target_ulong ioba1 = ioba; target_ulong tce_list = args[2]; target_ulong npages = args[3]; target_ulong ret = H_PARAMETER, tce = 0; sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn); CPUState *cs = CPU(cpu); hwaddr page_mask, page_size; if (!tcet) { return H_PARAMETER; } if ((npages > 512) || (tce_list & SPAPR_TCE_PAGE_MASK)) { return H_PARAMETER; } page_mask = IOMMU_PAGE_MASK(tcet->page_shift); page_size = IOMMU_PAGE_SIZE(tcet->page_shift); ioba &= page_mask; for (i = 0; i < npages; ++i, ioba += page_size) { target_ulong off = (tce_list & ~SPAPR_TCE_RW) + i * sizeof(target_ulong); tce = ldq_be_phys(cs->as, off); ret = put_tce_emu(tcet, ioba, tce); if (ret) { break; } } /* Trace last successful or the first problematic entry */ i = i ? (i - 1) : 0; if (SPAPR_IS_PCI_LIOBN(liobn)) { trace_spapr_iommu_pci_indirect(liobn, ioba1, tce_list, i, tce, ret); } else { trace_spapr_iommu_indirect(liobn, ioba1, tce_list, i, tce, ret); } return ret; }
true
qemu
4d9ab7d4ed46c63d047862d11946996005742a09
static target_ulong h_put_tce_indirect(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { int i; target_ulong liobn = args[0]; target_ulong ioba = args[1]; target_ulong ioba1 = ioba; target_ulong tce_list = args[2]; target_ulong npages = args[3]; target_ulong ret = H_PARAMETER, tce = 0; sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn); CPUState *cs = CPU(cpu); hwaddr page_mask, page_size; if (!tcet) { return H_PARAMETER; } if ((npages > 512) || (tce_list & SPAPR_TCE_PAGE_MASK)) { return H_PARAMETER; } page_mask = IOMMU_PAGE_MASK(tcet->page_shift); page_size = IOMMU_PAGE_SIZE(tcet->page_shift); ioba &= page_mask; for (i = 0; i < npages; ++i, ioba += page_size) { target_ulong off = (tce_list & ~SPAPR_TCE_RW) + i * sizeof(target_ulong); tce = ldq_be_phys(cs->as, off); ret = put_tce_emu(tcet, ioba, tce); if (ret) { break; } } i = i ? (i - 1) : 0; if (SPAPR_IS_PCI_LIOBN(liobn)) { trace_spapr_iommu_pci_indirect(liobn, ioba1, tce_list, i, tce, ret); } else { trace_spapr_iommu_indirect(liobn, ioba1, tce_list, i, tce, ret); } return ret; }
{ "code": [ " target_ulong off = (tce_list & ~SPAPR_TCE_RW) +", " i * sizeof(target_ulong);", " tce = ldq_be_phys(cs->as, off);" ], "line_no": [ 57, 59, 61 ] }
static target_ulong FUNC_0(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode, target_ulong *args) { int VAR_0; target_ulong liobn = args[0]; target_ulong ioba = args[1]; target_ulong ioba1 = ioba; target_ulong tce_list = args[2]; target_ulong npages = args[3]; target_ulong ret = H_PARAMETER, tce = 0; sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn); CPUState *cs = CPU(cpu); hwaddr page_mask, page_size; if (!tcet) { return H_PARAMETER; } if ((npages > 512) || (tce_list & SPAPR_TCE_PAGE_MASK)) { return H_PARAMETER; } page_mask = IOMMU_PAGE_MASK(tcet->page_shift); page_size = IOMMU_PAGE_SIZE(tcet->page_shift); ioba &= page_mask; for (VAR_0 = 0; VAR_0 < npages; ++VAR_0, ioba += page_size) { target_ulong off = (tce_list & ~SPAPR_TCE_RW) + VAR_0 * sizeof(target_ulong); tce = ldq_be_phys(cs->as, off); ret = put_tce_emu(tcet, ioba, tce); if (ret) { break; } } VAR_0 = VAR_0 ? (VAR_0 - 1) : 0; if (SPAPR_IS_PCI_LIOBN(liobn)) { trace_spapr_iommu_pci_indirect(liobn, ioba1, tce_list, VAR_0, tce, ret); } else { trace_spapr_iommu_indirect(liobn, ioba1, tce_list, VAR_0, tce, ret); } return ret; }
[ "static target_ulong FUNC_0(PowerPCCPU *cpu,\nsPAPRMachineState *spapr,\ntarget_ulong opcode, target_ulong *args)\n{", "int VAR_0;", "target_ulong liobn = args[0];", "target_ulong ioba = args[1];", "target_ulong ioba1 = ioba;", "target_ulong tce_list = args[2];", "target_ulong npages = args[3];", "target_ulong ret = H_PARAMETER, tce = 0;", "sPAPRTCETable *tcet = spapr_tce_find_by_liobn(liobn);", "CPUState *cs = CPU(cpu);", "hwaddr page_mask, page_size;", "if (!tcet) {", "return H_PARAMETER;", "}", "if ((npages > 512) || (tce_list & SPAPR_TCE_PAGE_MASK)) {", "return H_PARAMETER;", "}", "page_mask = IOMMU_PAGE_MASK(tcet->page_shift);", "page_size = IOMMU_PAGE_SIZE(tcet->page_shift);", "ioba &= page_mask;", "for (VAR_0 = 0; VAR_0 < npages; ++VAR_0, ioba += page_size) {", "target_ulong off = (tce_list & ~SPAPR_TCE_RW) +\nVAR_0 * sizeof(target_ulong);", "tce = ldq_be_phys(cs->as, off);", "ret = put_tce_emu(tcet, ioba, tce);", "if (ret) {", "break;", "}", "}", "VAR_0 = VAR_0 ? (VAR_0 - 1) : 0;", "if (SPAPR_IS_PCI_LIOBN(liobn)) {", "trace_spapr_iommu_pci_indirect(liobn, ioba1, tce_list, VAR_0, tce, ret);", "} else {", "trace_spapr_iommu_indirect(liobn, ioba1, tce_list, VAR_0, tce, ret);", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ] ]
25,774
ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[]) { int c; unsigned long long v; Error *errp = NULL; while ((c = getopt(argc, argv, "h" /* help */ "v" /* verbose */ "F" /* foreground */ "p:" /* pid_file */ "S:" /* unix_socket_path */ "m:" /* shm_path */ "l:" /* shm_size */ "n:" /* n_vectors */ )) != -1) { switch (c) { case 'h': /* help */ ivshmem_server_usage(argv[0], 0); break; case 'v': /* verbose */ args->verbose = 1; break; case 'F': /* foreground */ args->foreground = 1; break; case 'p': /* pid_file */ args->pid_file = strdup(optarg); break; case 'S': /* unix_socket_path */ args->unix_socket_path = strdup(optarg); break; case 'm': /* shm_path */ args->shm_path = strdup(optarg); break; case 'l': /* shm_size */ parse_option_size("shm_size", optarg, &args->shm_size, &errp); if (errp) { fprintf(stderr, "cannot parse shm size: %s\n", error_get_pretty(errp)); error_free(errp); ivshmem_server_usage(argv[0], 1); } break; case 'n': /* n_vectors */ if (parse_uint_full(optarg, &v, 0) < 0) { fprintf(stderr, "cannot parse n_vectors\n"); ivshmem_server_usage(argv[0], 1); } args->n_vectors = v; break; default: ivshmem_server_usage(argv[0], 1); break; } } if (args->n_vectors > IVSHMEM_SERVER_MAX_VECTORS) { fprintf(stderr, "too many requested vectors (max is %d)\n", IVSHMEM_SERVER_MAX_VECTORS); ivshmem_server_usage(argv[0], 1); } if (args->verbose == 1 && args->foreground == 0) { fprintf(stderr, "cannot use verbose in daemon mode\n"); ivshmem_server_usage(argv[0], 1); } }
true
qemu
45b00c44ceffeac8143fb8857a12677234114f2b
ivshmem_server_parse_args(IvshmemServerArgs *args, int argc, char *argv[]) { int c; unsigned long long v; Error *errp = NULL; while ((c = getopt(argc, argv, "h" "v" "F" "p:" "S:" "m:" "l:" "n:" )) != -1) { switch (c) { case 'h': ivshmem_server_usage(argv[0], 0); break; case 'v': args->verbose = 1; break; case 'F': args->foreground = 1; break; case 'p': args->pid_file = strdup(optarg); break; case 'S': args->unix_socket_path = strdup(optarg); break; case 'm': args->shm_path = strdup(optarg); break; case 'l': parse_option_size("shm_size", optarg, &args->shm_size, &errp); if (errp) { fprintf(stderr, "cannot parse shm size: %s\n", error_get_pretty(errp)); error_free(errp); ivshmem_server_usage(argv[0], 1); } break; case 'n': if (parse_uint_full(optarg, &v, 0) < 0) { fprintf(stderr, "cannot parse n_vectors\n"); ivshmem_server_usage(argv[0], 1); } args->n_vectors = v; break; default: ivshmem_server_usage(argv[0], 1); break; } } if (args->n_vectors > IVSHMEM_SERVER_MAX_VECTORS) { fprintf(stderr, "too many requested vectors (max is %d)\n", IVSHMEM_SERVER_MAX_VECTORS); ivshmem_server_usage(argv[0], 1); } if (args->verbose == 1 && args->foreground == 0) { fprintf(stderr, "cannot use verbose in daemon mode\n"); ivshmem_server_usage(argv[0], 1); } }
{ "code": [ " args->pid_file = strdup(optarg);", " args->unix_socket_path = strdup(optarg);", " args->shm_path = strdup(optarg);" ], "line_no": [ 63, 71, 79 ] }
FUNC_0(IvshmemServerArgs *VAR_0, int VAR_1, char *VAR_2[]) { int VAR_3; unsigned long long VAR_4; Error *errp = NULL; while ((VAR_3 = getopt(VAR_1, VAR_2, "h" "VAR_4" "F" "p:" "S:" "m:" "l:" "n:" )) != -1) { switch (VAR_3) { case 'h': ivshmem_server_usage(VAR_2[0], 0); break; case 'VAR_4': VAR_0->verbose = 1; break; case 'F': VAR_0->foreground = 1; break; case 'p': VAR_0->pid_file = strdup(optarg); break; case 'S': VAR_0->unix_socket_path = strdup(optarg); break; case 'm': VAR_0->shm_path = strdup(optarg); break; case 'l': parse_option_size("shm_size", optarg, &VAR_0->shm_size, &errp); if (errp) { fprintf(stderr, "cannot parse shm size: %s\n", error_get_pretty(errp)); error_free(errp); ivshmem_server_usage(VAR_2[0], 1); } break; case 'n': if (parse_uint_full(optarg, &VAR_4, 0) < 0) { fprintf(stderr, "cannot parse n_vectors\n"); ivshmem_server_usage(VAR_2[0], 1); } VAR_0->n_vectors = VAR_4; break; default: ivshmem_server_usage(VAR_2[0], 1); break; } } if (VAR_0->n_vectors > IVSHMEM_SERVER_MAX_VECTORS) { fprintf(stderr, "too many requested vectors (max is %d)\n", IVSHMEM_SERVER_MAX_VECTORS); ivshmem_server_usage(VAR_2[0], 1); } if (VAR_0->verbose == 1 && VAR_0->foreground == 0) { fprintf(stderr, "cannot use verbose in daemon mode\n"); ivshmem_server_usage(VAR_2[0], 1); } }
[ "FUNC_0(IvshmemServerArgs *VAR_0, int VAR_1, char *VAR_2[])\n{", "int VAR_3;", "unsigned long long VAR_4;", "Error *errp = NULL;", "while ((VAR_3 = getopt(VAR_1, VAR_2,\n\"h\"\n\"VAR_4\"\n\"F\"\n\"p:\"\n\"S:\"\n\"m:\"\n\"l:\"\n\"n:\"\n)) != -1) {", "switch (VAR_3) {", "case 'h':\nivshmem_server_usage(VAR_2[0], 0);", "break;", "case 'VAR_4':\nVAR_0->verbose = 1;", "break;", "case 'F':\nVAR_0->foreground = 1;", "break;", "case 'p':\nVAR_0->pid_file = strdup(optarg);", "break;", "case 'S':\nVAR_0->unix_socket_path = strdup(optarg);", "break;", "case 'm':\nVAR_0->shm_path = strdup(optarg);", "break;", "case 'l':\nparse_option_size(\"shm_size\", optarg, &VAR_0->shm_size, &errp);", "if (errp) {", "fprintf(stderr, \"cannot parse shm size: %s\\n\",\nerror_get_pretty(errp));", "error_free(errp);", "ivshmem_server_usage(VAR_2[0], 1);", "}", "break;", "case 'n':\nif (parse_uint_full(optarg, &VAR_4, 0) < 0) {", "fprintf(stderr, \"cannot parse n_vectors\\n\");", "ivshmem_server_usage(VAR_2[0], 1);", "}", "VAR_0->n_vectors = VAR_4;", "break;", "default:\nivshmem_server_usage(VAR_2[0], 1);", "break;", "}", "}", "if (VAR_0->n_vectors > IVSHMEM_SERVER_MAX_VECTORS) {", "fprintf(stderr, \"too many requested vectors (max is %d)\\n\",\nIVSHMEM_SERVER_MAX_VECTORS);", "ivshmem_server_usage(VAR_2[0], 1);", "}", "if (VAR_0->verbose == 1 && VAR_0->foreground == 0) {", "fprintf(stderr, \"cannot use verbose in daemon mode\\n\");", "ivshmem_server_usage(VAR_2[0], 1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13, 15, 17, 19, 21, 23, 25, 27, 29, 31 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105, 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ] ]
25,776
static int nbd_negotiate_options(NBDClient *client, uint16_t myflags, Error **errp) { uint32_t flags; bool fixedNewstyle = false; bool no_zeroes = false; /* Client sends: [ 0 .. 3] client flags Then we loop until NBD_OPT_EXPORT_NAME or NBD_OPT_GO: [ 0 .. 7] NBD_OPTS_MAGIC [ 8 .. 11] NBD option [12 .. 15] Data length ... Rest of request [ 0 .. 7] NBD_OPTS_MAGIC [ 8 .. 11] Second NBD option [12 .. 15] Data length ... Rest of request */ if (nbd_read(client->ioc, &flags, sizeof(flags), errp) < 0) { error_prepend(errp, "read failed: "); return -EIO; } be32_to_cpus(&flags); trace_nbd_negotiate_options_flags(flags); if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) { fixedNewstyle = true; flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE; } if (flags & NBD_FLAG_C_NO_ZEROES) { no_zeroes = true; flags &= ~NBD_FLAG_C_NO_ZEROES; } if (flags != 0) { error_setg(errp, "Unknown client flags 0x%" PRIx32 " received", flags); return -EINVAL; } while (1) { int ret; uint32_t option, length; uint64_t magic; if (nbd_read(client->ioc, &magic, sizeof(magic), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } magic = be64_to_cpu(magic); trace_nbd_negotiate_options_check_magic(magic); if (magic != NBD_OPTS_MAGIC) { error_setg(errp, "Bad magic received"); return -EINVAL; } if (nbd_read(client->ioc, &option, sizeof(option), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } option = be32_to_cpu(option); client->opt = option; if (nbd_read(client->ioc, &length, sizeof(length), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } length = be32_to_cpu(length); client->optlen = length; if (length > NBD_MAX_BUFFER_SIZE) { error_setg(errp, "len (%" PRIu32" ) is larger than max len (%u)", length, NBD_MAX_BUFFER_SIZE); return -EINVAL; } trace_nbd_negotiate_options_check_option(option, nbd_opt_lookup(option)); if (client->tlscreds && client->ioc == (QIOChannel *)client->sioc) { QIOChannel *tioc; if (!fixedNewstyle) { error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } switch (option) { case NBD_OPT_STARTTLS: if (length) { /* Unconditionally drop the connection if the client * can't start a TLS negotiation correctly */ return nbd_reject_length(client, true, errp); } tioc = nbd_negotiate_handle_starttls(client, errp); if (!tioc) { return -EIO; } ret = 0; object_unref(OBJECT(client->ioc)); client->ioc = QIO_CHANNEL(tioc); break; case NBD_OPT_EXPORT_NAME: /* No way to return an error to client, so drop connection */ error_setg(errp, "Option 0x%x not permitted before TLS", option); return -EINVAL; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_TLS_REQD, errp, "Option 0x%" PRIx32 "not permitted before TLS", option); /* Let the client keep trying, unless they asked to * quit. In this mode, we've already sent an error, so * we can't ack the abort. */ if (option == NBD_OPT_ABORT) { return 1; } break; } } else if (fixedNewstyle) { switch (option) { case NBD_OPT_LIST: if (length) { ret = nbd_reject_length(client, false, errp); } else { ret = nbd_negotiate_handle_list(client, errp); } break; case NBD_OPT_ABORT: /* NBD spec says we must try to reply before * disconnecting, but that we must also tolerate * guests that don't wait for our reply. */ nbd_negotiate_send_rep(client, NBD_REP_ACK, NULL); return 1; case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, myflags, no_zeroes, errp); case NBD_OPT_INFO: case NBD_OPT_GO: ret = nbd_negotiate_handle_info(client, myflags, errp); if (ret == 1) { assert(option == NBD_OPT_GO); return 0; } break; case NBD_OPT_STARTTLS: if (length) { ret = nbd_reject_length(client, false, errp); } else if (client->tlscreds) { ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_INVALID, errp, "TLS already enabled"); } else { ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_POLICY, errp, "TLS not configured"); } break; case NBD_OPT_STRUCTURED_REPLY: if (length) { ret = nbd_reject_length(client, false, errp); } else if (client->structured_reply) { ret = nbd_negotiate_send_rep_err( client, NBD_REP_ERR_INVALID, errp, "structured reply already negotiated"); } else { ret = nbd_negotiate_send_rep(client, NBD_REP_ACK, errp); client->structured_reply = true; myflags |= NBD_FLAG_SEND_DF; } break; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_UNSUP, errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); break; } } else { /* * If broken new-style we should drop the connection * for anything except NBD_OPT_EXPORT_NAME */ switch (option) { case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, myflags, no_zeroes, errp); default: error_setg(errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); return -EINVAL; } } if (ret < 0) { return ret; } } }
true
qemu
894e02804c862c6940b43a0a488164655d3fb3f0
static int nbd_negotiate_options(NBDClient *client, uint16_t myflags, Error **errp) { uint32_t flags; bool fixedNewstyle = false; bool no_zeroes = false; if (nbd_read(client->ioc, &flags, sizeof(flags), errp) < 0) { error_prepend(errp, "read failed: "); return -EIO; } be32_to_cpus(&flags); trace_nbd_negotiate_options_flags(flags); if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) { fixedNewstyle = true; flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE; } if (flags & NBD_FLAG_C_NO_ZEROES) { no_zeroes = true; flags &= ~NBD_FLAG_C_NO_ZEROES; } if (flags != 0) { error_setg(errp, "Unknown client flags 0x%" PRIx32 " received", flags); return -EINVAL; } while (1) { int ret; uint32_t option, length; uint64_t magic; if (nbd_read(client->ioc, &magic, sizeof(magic), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } magic = be64_to_cpu(magic); trace_nbd_negotiate_options_check_magic(magic); if (magic != NBD_OPTS_MAGIC) { error_setg(errp, "Bad magic received"); return -EINVAL; } if (nbd_read(client->ioc, &option, sizeof(option), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } option = be32_to_cpu(option); client->opt = option; if (nbd_read(client->ioc, &length, sizeof(length), errp) < 0) { error_prepend(errp, "read failed: "); return -EINVAL; } length = be32_to_cpu(length); client->optlen = length; if (length > NBD_MAX_BUFFER_SIZE) { error_setg(errp, "len (%" PRIu32" ) is larger than max len (%u)", length, NBD_MAX_BUFFER_SIZE); return -EINVAL; } trace_nbd_negotiate_options_check_option(option, nbd_opt_lookup(option)); if (client->tlscreds && client->ioc == (QIOChannel *)client->sioc) { QIOChannel *tioc; if (!fixedNewstyle) { error_setg(errp, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } switch (option) { case NBD_OPT_STARTTLS: if (length) { return nbd_reject_length(client, true, errp); } tioc = nbd_negotiate_handle_starttls(client, errp); if (!tioc) { return -EIO; } ret = 0; object_unref(OBJECT(client->ioc)); client->ioc = QIO_CHANNEL(tioc); break; case NBD_OPT_EXPORT_NAME: error_setg(errp, "Option 0x%x not permitted before TLS", option); return -EINVAL; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_TLS_REQD, errp, "Option 0x%" PRIx32 "not permitted before TLS", option); if (option == NBD_OPT_ABORT) { return 1; } break; } } else if (fixedNewstyle) { switch (option) { case NBD_OPT_LIST: if (length) { ret = nbd_reject_length(client, false, errp); } else { ret = nbd_negotiate_handle_list(client, errp); } break; case NBD_OPT_ABORT: nbd_negotiate_send_rep(client, NBD_REP_ACK, NULL); return 1; case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, myflags, no_zeroes, errp); case NBD_OPT_INFO: case NBD_OPT_GO: ret = nbd_negotiate_handle_info(client, myflags, errp); if (ret == 1) { assert(option == NBD_OPT_GO); return 0; } break; case NBD_OPT_STARTTLS: if (length) { ret = nbd_reject_length(client, false, errp); } else if (client->tlscreds) { ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_INVALID, errp, "TLS already enabled"); } else { ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_POLICY, errp, "TLS not configured"); } break; case NBD_OPT_STRUCTURED_REPLY: if (length) { ret = nbd_reject_length(client, false, errp); } else if (client->structured_reply) { ret = nbd_negotiate_send_rep_err( client, NBD_REP_ERR_INVALID, errp, "structured reply already negotiated"); } else { ret = nbd_negotiate_send_rep(client, NBD_REP_ACK, errp); client->structured_reply = true; myflags |= NBD_FLAG_SEND_DF; } break; default: if (nbd_drop(client->ioc, length, errp) < 0) { return -EIO; } ret = nbd_negotiate_send_rep_err(client, NBD_REP_ERR_UNSUP, errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); break; } } else { switch (option) { case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(client, myflags, no_zeroes, errp); default: error_setg(errp, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); return -EINVAL; } } if (ret < 0) { return ret; } } }
{ "code": [ " return -EIO;", " return -EIO;", " return -EIO;", " return -EIO;", " return -EIO;", " if (nbd_drop(client->ioc, length, errp) < 0) {", " return -EIO;", " ret = nbd_negotiate_send_rep_err(client,", " NBD_REP_ERR_TLS_REQD, errp,", " \"Option 0x%\" PRIx32", " \"not permitted before TLS\",", " option);", " if (nbd_drop(client->ioc, length, errp) < 0) {", " return -EIO;", " ret = nbd_negotiate_send_rep_err(client,", " NBD_REP_ERR_UNSUP, errp,", " \"Unsupported option 0x%\"", " PRIx32 \" (%s)\", option,", " nbd_opt_lookup(option));" ], "line_no": [ 49, 49, 49, 49, 49, 221, 193, 227, 229, 231, 233, 235, 221, 193, 227, 381, 383, 385, 159 ] }
static int FUNC_0(NBDClient *VAR_0, uint16_t VAR_1, Error **VAR_2) { uint32_t flags; bool fixedNewstyle = false; bool no_zeroes = false; if (nbd_read(VAR_0->ioc, &flags, sizeof(flags), VAR_2) < 0) { error_prepend(VAR_2, "read failed: "); return -EIO; } be32_to_cpus(&flags); trace_nbd_negotiate_options_flags(flags); if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) { fixedNewstyle = true; flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE; } if (flags & NBD_FLAG_C_NO_ZEROES) { no_zeroes = true; flags &= ~NBD_FLAG_C_NO_ZEROES; } if (flags != 0) { error_setg(VAR_2, "Unknown VAR_0 flags 0x%" PRIx32 " received", flags); return -EINVAL; } while (1) { int VAR_3; uint32_t option, length; uint64_t magic; if (nbd_read(VAR_0->ioc, &magic, sizeof(magic), VAR_2) < 0) { error_prepend(VAR_2, "read failed: "); return -EINVAL; } magic = be64_to_cpu(magic); trace_nbd_negotiate_options_check_magic(magic); if (magic != NBD_OPTS_MAGIC) { error_setg(VAR_2, "Bad magic received"); return -EINVAL; } if (nbd_read(VAR_0->ioc, &option, sizeof(option), VAR_2) < 0) { error_prepend(VAR_2, "read failed: "); return -EINVAL; } option = be32_to_cpu(option); VAR_0->opt = option; if (nbd_read(VAR_0->ioc, &length, sizeof(length), VAR_2) < 0) { error_prepend(VAR_2, "read failed: "); return -EINVAL; } length = be32_to_cpu(length); VAR_0->optlen = length; if (length > NBD_MAX_BUFFER_SIZE) { error_setg(VAR_2, "len (%" PRIu32" ) is larger than max len (%u)", length, NBD_MAX_BUFFER_SIZE); return -EINVAL; } trace_nbd_negotiate_options_check_option(option, nbd_opt_lookup(option)); if (VAR_0->tlscreds && VAR_0->ioc == (QIOChannel *)VAR_0->sioc) { QIOChannel *tioc; if (!fixedNewstyle) { error_setg(VAR_2, "Unsupported option 0x%" PRIx32, option); return -EINVAL; } switch (option) { case NBD_OPT_STARTTLS: if (length) { return nbd_reject_length(VAR_0, true, VAR_2); } tioc = nbd_negotiate_handle_starttls(VAR_0, VAR_2); if (!tioc) { return -EIO; } VAR_3 = 0; object_unref(OBJECT(VAR_0->ioc)); VAR_0->ioc = QIO_CHANNEL(tioc); break; case NBD_OPT_EXPORT_NAME: error_setg(VAR_2, "Option 0x%x not permitted before TLS", option); return -EINVAL; default: if (nbd_drop(VAR_0->ioc, length, VAR_2) < 0) { return -EIO; } VAR_3 = nbd_negotiate_send_rep_err(VAR_0, NBD_REP_ERR_TLS_REQD, VAR_2, "Option 0x%" PRIx32 "not permitted before TLS", option); if (option == NBD_OPT_ABORT) { return 1; } break; } } else if (fixedNewstyle) { switch (option) { case NBD_OPT_LIST: if (length) { VAR_3 = nbd_reject_length(VAR_0, false, VAR_2); } else { VAR_3 = nbd_negotiate_handle_list(VAR_0, VAR_2); } break; case NBD_OPT_ABORT: nbd_negotiate_send_rep(VAR_0, NBD_REP_ACK, NULL); return 1; case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(VAR_0, VAR_1, no_zeroes, VAR_2); case NBD_OPT_INFO: case NBD_OPT_GO: VAR_3 = nbd_negotiate_handle_info(VAR_0, VAR_1, VAR_2); if (VAR_3 == 1) { assert(option == NBD_OPT_GO); return 0; } break; case NBD_OPT_STARTTLS: if (length) { VAR_3 = nbd_reject_length(VAR_0, false, VAR_2); } else if (VAR_0->tlscreds) { VAR_3 = nbd_negotiate_send_rep_err(VAR_0, NBD_REP_ERR_INVALID, VAR_2, "TLS already enabled"); } else { VAR_3 = nbd_negotiate_send_rep_err(VAR_0, NBD_REP_ERR_POLICY, VAR_2, "TLS not configured"); } break; case NBD_OPT_STRUCTURED_REPLY: if (length) { VAR_3 = nbd_reject_length(VAR_0, false, VAR_2); } else if (VAR_0->structured_reply) { VAR_3 = nbd_negotiate_send_rep_err( VAR_0, NBD_REP_ERR_INVALID, VAR_2, "structured reply already negotiated"); } else { VAR_3 = nbd_negotiate_send_rep(VAR_0, NBD_REP_ACK, VAR_2); VAR_0->structured_reply = true; VAR_1 |= NBD_FLAG_SEND_DF; } break; default: if (nbd_drop(VAR_0->ioc, length, VAR_2) < 0) { return -EIO; } VAR_3 = nbd_negotiate_send_rep_err(VAR_0, NBD_REP_ERR_UNSUP, VAR_2, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); break; } } else { switch (option) { case NBD_OPT_EXPORT_NAME: return nbd_negotiate_handle_export_name(VAR_0, VAR_1, no_zeroes, VAR_2); default: error_setg(VAR_2, "Unsupported option 0x%" PRIx32 " (%s)", option, nbd_opt_lookup(option)); return -EINVAL; } } if (VAR_3 < 0) { return VAR_3; } } }
[ "static int FUNC_0(NBDClient *VAR_0, uint16_t VAR_1,\nError **VAR_2)\n{", "uint32_t flags;", "bool fixedNewstyle = false;", "bool no_zeroes = false;", "if (nbd_read(VAR_0->ioc, &flags, sizeof(flags), VAR_2) < 0) {", "error_prepend(VAR_2, \"read failed: \");", "return -EIO;", "}", "be32_to_cpus(&flags);", "trace_nbd_negotiate_options_flags(flags);", "if (flags & NBD_FLAG_C_FIXED_NEWSTYLE) {", "fixedNewstyle = true;", "flags &= ~NBD_FLAG_C_FIXED_NEWSTYLE;", "}", "if (flags & NBD_FLAG_C_NO_ZEROES) {", "no_zeroes = true;", "flags &= ~NBD_FLAG_C_NO_ZEROES;", "}", "if (flags != 0) {", "error_setg(VAR_2, \"Unknown VAR_0 flags 0x%\" PRIx32 \" received\", flags);", "return -EINVAL;", "}", "while (1) {", "int VAR_3;", "uint32_t option, length;", "uint64_t magic;", "if (nbd_read(VAR_0->ioc, &magic, sizeof(magic), VAR_2) < 0) {", "error_prepend(VAR_2, \"read failed: \");", "return -EINVAL;", "}", "magic = be64_to_cpu(magic);", "trace_nbd_negotiate_options_check_magic(magic);", "if (magic != NBD_OPTS_MAGIC) {", "error_setg(VAR_2, \"Bad magic received\");", "return -EINVAL;", "}", "if (nbd_read(VAR_0->ioc, &option,\nsizeof(option), VAR_2) < 0) {", "error_prepend(VAR_2, \"read failed: \");", "return -EINVAL;", "}", "option = be32_to_cpu(option);", "VAR_0->opt = option;", "if (nbd_read(VAR_0->ioc, &length, sizeof(length), VAR_2) < 0) {", "error_prepend(VAR_2, \"read failed: \");", "return -EINVAL;", "}", "length = be32_to_cpu(length);", "VAR_0->optlen = length;", "if (length > NBD_MAX_BUFFER_SIZE) {", "error_setg(VAR_2, \"len (%\" PRIu32\" ) is larger than max len (%u)\",\nlength, NBD_MAX_BUFFER_SIZE);", "return -EINVAL;", "}", "trace_nbd_negotiate_options_check_option(option,\nnbd_opt_lookup(option));", "if (VAR_0->tlscreds &&\nVAR_0->ioc == (QIOChannel *)VAR_0->sioc) {", "QIOChannel *tioc;", "if (!fixedNewstyle) {", "error_setg(VAR_2, \"Unsupported option 0x%\" PRIx32, option);", "return -EINVAL;", "}", "switch (option) {", "case NBD_OPT_STARTTLS:\nif (length) {", "return nbd_reject_length(VAR_0, true, VAR_2);", "}", "tioc = nbd_negotiate_handle_starttls(VAR_0, VAR_2);", "if (!tioc) {", "return -EIO;", "}", "VAR_3 = 0;", "object_unref(OBJECT(VAR_0->ioc));", "VAR_0->ioc = QIO_CHANNEL(tioc);", "break;", "case NBD_OPT_EXPORT_NAME:\nerror_setg(VAR_2, \"Option 0x%x not permitted before TLS\",\noption);", "return -EINVAL;", "default:\nif (nbd_drop(VAR_0->ioc, length, VAR_2) < 0) {", "return -EIO;", "}", "VAR_3 = nbd_negotiate_send_rep_err(VAR_0,\nNBD_REP_ERR_TLS_REQD, VAR_2,\n\"Option 0x%\" PRIx32\n\"not permitted before TLS\",\noption);", "if (option == NBD_OPT_ABORT) {", "return 1;", "}", "break;", "}", "} else if (fixedNewstyle) {", "switch (option) {", "case NBD_OPT_LIST:\nif (length) {", "VAR_3 = nbd_reject_length(VAR_0, false, VAR_2);", "} else {", "VAR_3 = nbd_negotiate_handle_list(VAR_0, VAR_2);", "}", "break;", "case NBD_OPT_ABORT:\nnbd_negotiate_send_rep(VAR_0, NBD_REP_ACK, NULL);", "return 1;", "case NBD_OPT_EXPORT_NAME:\nreturn nbd_negotiate_handle_export_name(VAR_0,\nVAR_1, no_zeroes,\nVAR_2);", "case NBD_OPT_INFO:\ncase NBD_OPT_GO:\nVAR_3 = nbd_negotiate_handle_info(VAR_0, VAR_1, VAR_2);", "if (VAR_3 == 1) {", "assert(option == NBD_OPT_GO);", "return 0;", "}", "break;", "case NBD_OPT_STARTTLS:\nif (length) {", "VAR_3 = nbd_reject_length(VAR_0, false, VAR_2);", "} else if (VAR_0->tlscreds) {", "VAR_3 = nbd_negotiate_send_rep_err(VAR_0,\nNBD_REP_ERR_INVALID, VAR_2,\n\"TLS already enabled\");", "} else {", "VAR_3 = nbd_negotiate_send_rep_err(VAR_0,\nNBD_REP_ERR_POLICY, VAR_2,\n\"TLS not configured\");", "}", "break;", "case NBD_OPT_STRUCTURED_REPLY:\nif (length) {", "VAR_3 = nbd_reject_length(VAR_0, false, VAR_2);", "} else if (VAR_0->structured_reply) {", "VAR_3 = nbd_negotiate_send_rep_err(\nVAR_0, NBD_REP_ERR_INVALID, VAR_2,\n\"structured reply already negotiated\");", "} else {", "VAR_3 = nbd_negotiate_send_rep(VAR_0, NBD_REP_ACK, VAR_2);", "VAR_0->structured_reply = true;", "VAR_1 |= NBD_FLAG_SEND_DF;", "}", "break;", "default:\nif (nbd_drop(VAR_0->ioc, length, VAR_2) < 0) {", "return -EIO;", "}", "VAR_3 = nbd_negotiate_send_rep_err(VAR_0,\nNBD_REP_ERR_UNSUP, VAR_2,\n\"Unsupported option 0x%\"\nPRIx32 \" (%s)\", option,\nnbd_opt_lookup(option));", "break;", "}", "} else {", "switch (option) {", "case NBD_OPT_EXPORT_NAME:\nreturn nbd_negotiate_handle_export_name(VAR_0,\nVAR_1, no_zeroes,\nVAR_2);", "default:\nerror_setg(VAR_2, \"Unsupported option 0x%\" PRIx32 \" (%s)\",\noption, nbd_opt_lookup(option));", "return -EINVAL;", "}", "}", "if (VAR_3 < 0) {", "return VAR_3;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 207, 211, 213 ], [ 215 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227, 229, 231, 233, 235 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 273, 281 ], [ 283 ], [ 287, 289, 291, 293 ], [ 297, 299, 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315, 317 ], [ 319 ], [ 321 ], [ 323, 325, 327 ], [ 329 ], [ 331, 333, 335 ], [ 337 ], [ 339 ], [ 343, 345 ], [ 347 ], [ 349 ], [ 351, 353, 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379, 381, 383, 385, 387 ], [ 389 ], [ 391 ], [ 393 ], [ 403 ], [ 405, 407, 409, 411 ], [ 415, 417, 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ] ]
25,778
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; uint8_t *current, *previous; int result, i, x, y, width, height; AVFrame *pict = data; svq1_pmv *pmv; /* initialize bit buffer */ init_get_bits(&s->gb, buf, buf_size * 8); /* decode frame header */ s->f_code = get_bits(&s->gb, 22); if ((s->f_code & ~0x70) || !(s->f_code & 0x60)) return AVERROR_INVALIDDATA; /* swap some header bytes (why?) */ if (s->f_code != 0x20) { uint32_t *src = (uint32_t *)(buf + 4); if (buf_size < 36) return AVERROR_INVALIDDATA; for (i = 0; i < 4; i++) src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i]; } result = svq1_decode_frame_header(&s->gb, s); if (result != 0) { av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n", result); return result; } avcodec_set_dimensions(avctx, s->width, s->height); /* FIXME: This avoids some confusion for "B frames" without 2 references. * This should be removed after libavcodec can handle more flexible * picture types & ordering */ if (s->pict_type == AV_PICTURE_TYPE_B && s->last_picture_ptr == NULL) return buf_size; if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return buf_size; if ((result = ff_MPV_frame_start(s, avctx)) < 0) return result; pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv)); if (!pmv) return AVERROR(ENOMEM); /* decode y, u and v components */ for (i = 0; i < 3; i++) { int linesize; if (i == 0) { width = FFALIGN(s->width, 16); height = FFALIGN(s->height, 16); linesize = s->linesize; } else { if (s->flags & CODEC_FLAG_GRAY) break; width = FFALIGN(s->width / 4, 16); height = FFALIGN(s->height / 4, 16); linesize = s->uvlinesize; } current = s->current_picture.f.data[i]; if (s->pict_type == AV_PICTURE_TYPE_B) previous = s->next_picture.f.data[i]; else previous = s->last_picture.f.data[i]; if (s->pict_type == AV_PICTURE_TYPE_I) { /* keyframe */ for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_block_intra(&s->gb, &current[x], linesize); if (result != 0) { av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n", result); goto err; } } current += 16 * linesize; } } else { /* delta frame */ memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv)); for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_delta_block(s, &s->gb, &current[x], previous, linesize, pmv, x, y); if (result != 0) { av_dlog(s->avctx, "Error in svq1_decode_delta_block %i\n", result); goto err; } } pmv[0].x = pmv[0].y = 0; current += 16 * linesize; } } } *pict = s->current_picture.f; ff_MPV_frame_end(s); *data_size = sizeof(AVFrame); result = buf_size; err: av_free(pmv); return result; }
false
FFmpeg
7b9fc769e40a7709fa59a54e2a810f76364eee4b
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MpegEncContext *s = avctx->priv_data; uint8_t *current, *previous; int result, i, x, y, width, height; AVFrame *pict = data; svq1_pmv *pmv; init_get_bits(&s->gb, buf, buf_size * 8); s->f_code = get_bits(&s->gb, 22); if ((s->f_code & ~0x70) || !(s->f_code & 0x60)) return AVERROR_INVALIDDATA; if (s->f_code != 0x20) { uint32_t *src = (uint32_t *)(buf + 4); if (buf_size < 36) return AVERROR_INVALIDDATA; for (i = 0; i < 4; i++) src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i]; } result = svq1_decode_frame_header(&s->gb, s); if (result != 0) { av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n", result); return result; } avcodec_set_dimensions(avctx, s->width, s->height); if (s->pict_type == AV_PICTURE_TYPE_B && s->last_picture_ptr == NULL) return buf_size; if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return buf_size; if ((result = ff_MPV_frame_start(s, avctx)) < 0) return result; pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv)); if (!pmv) return AVERROR(ENOMEM); for (i = 0; i < 3; i++) { int linesize; if (i == 0) { width = FFALIGN(s->width, 16); height = FFALIGN(s->height, 16); linesize = s->linesize; } else { if (s->flags & CODEC_FLAG_GRAY) break; width = FFALIGN(s->width / 4, 16); height = FFALIGN(s->height / 4, 16); linesize = s->uvlinesize; } current = s->current_picture.f.data[i]; if (s->pict_type == AV_PICTURE_TYPE_B) previous = s->next_picture.f.data[i]; else previous = s->last_picture.f.data[i]; if (s->pict_type == AV_PICTURE_TYPE_I) { for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_block_intra(&s->gb, &current[x], linesize); if (result != 0) { av_log(s->avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n", result); goto err; } } current += 16 * linesize; } } else { memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv)); for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_delta_block(s, &s->gb, &current[x], previous, linesize, pmv, x, y); if (result != 0) { av_dlog(s->avctx, "Error in svq1_decode_delta_block %i\n", result); goto err; } } pmv[0].x = pmv[0].y = 0; current += 16 * linesize; } } } *pict = s->current_picture.f; ff_MPV_frame_end(s); *data_size = sizeof(AVFrame); result = buf_size; err: av_free(pmv); return result; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; MpegEncContext *s = VAR_0->priv_data; uint8_t *current, *previous; int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; AVFrame *pict = VAR_1; svq1_pmv *pmv; init_get_bits(&s->gb, VAR_4, VAR_5 * 8); s->f_code = get_bits(&s->gb, 22); if ((s->f_code & ~0x70) || !(s->f_code & 0x60)) return AVERROR_INVALIDDATA; if (s->f_code != 0x20) { uint32_t *src = (uint32_t *)(VAR_4 + 4); if (VAR_5 < 36) return AVERROR_INVALIDDATA; for (VAR_7 = 0; VAR_7 < 4; VAR_7++) src[VAR_7] = ((src[VAR_7] << 16) | (src[VAR_7] >> 16)) ^ src[7 - VAR_7]; } VAR_6 = svq1_decode_frame_header(&s->gb, s); if (VAR_6 != 0) { av_dlog(s->VAR_0, "Error in svq1_decode_frame_header %VAR_7\n", VAR_6); return VAR_6; } avcodec_set_dimensions(VAR_0, s->VAR_10, s->VAR_11); if (s->pict_type == AV_PICTURE_TYPE_B && s->last_picture_ptr == NULL) return VAR_5; if ((VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || VAR_0->skip_frame >= AVDISCARD_ALL) return VAR_5; if ((VAR_6 = ff_MPV_frame_start(s, VAR_0)) < 0) return VAR_6; pmv = av_malloc((FFALIGN(s->VAR_10, 16) / 8 + 3) * sizeof(*pmv)); if (!pmv) return AVERROR(ENOMEM); for (VAR_7 = 0; VAR_7 < 3; VAR_7++) { int VAR_12; if (VAR_7 == 0) { VAR_10 = FFALIGN(s->VAR_10, 16); VAR_11 = FFALIGN(s->VAR_11, 16); VAR_12 = s->VAR_12; } else { if (s->flags & CODEC_FLAG_GRAY) break; VAR_10 = FFALIGN(s->VAR_10 / 4, 16); VAR_11 = FFALIGN(s->VAR_11 / 4, 16); VAR_12 = s->uvlinesize; } current = s->current_picture.f.VAR_1[VAR_7]; if (s->pict_type == AV_PICTURE_TYPE_B) previous = s->next_picture.f.VAR_1[VAR_7]; else previous = s->last_picture.f.VAR_1[VAR_7]; if (s->pict_type == AV_PICTURE_TYPE_I) { for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) { for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) { VAR_6 = svq1_decode_block_intra(&s->gb, &current[VAR_8], VAR_12); if (VAR_6 != 0) { av_log(s->VAR_0, AV_LOG_INFO, "Error in svq1_decode_block %VAR_7 (keyframe)\n", VAR_6); goto err; } } current += 16 * VAR_12; } } else { memset(pmv, 0, ((VAR_10 / 8) + 3) * sizeof(svq1_pmv)); for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) { for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) { VAR_6 = svq1_decode_delta_block(s, &s->gb, &current[VAR_8], previous, VAR_12, pmv, VAR_8, VAR_9); if (VAR_6 != 0) { av_dlog(s->VAR_0, "Error in svq1_decode_delta_block %VAR_7\n", VAR_6); goto err; } } pmv[0].VAR_8 = pmv[0].VAR_9 = 0; current += 16 * VAR_12; } } } *pict = s->current_picture.f; ff_MPV_frame_end(s); *VAR_2 = sizeof(AVFrame); VAR_6 = VAR_5; err: av_free(pmv); return VAR_6; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "MpegEncContext *s = VAR_0->priv_data;", "uint8_t *current, *previous;", "int VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "AVFrame *pict = VAR_1;", "svq1_pmv *pmv;", "init_get_bits(&s->gb, VAR_4, VAR_5 * 8);", "s->f_code = get_bits(&s->gb, 22);", "if ((s->f_code & ~0x70) || !(s->f_code & 0x60))\nreturn AVERROR_INVALIDDATA;", "if (s->f_code != 0x20) {", "uint32_t *src = (uint32_t *)(VAR_4 + 4);", "if (VAR_5 < 36)\nreturn AVERROR_INVALIDDATA;", "for (VAR_7 = 0; VAR_7 < 4; VAR_7++)", "src[VAR_7] = ((src[VAR_7] << 16) | (src[VAR_7] >> 16)) ^ src[7 - VAR_7];", "}", "VAR_6 = svq1_decode_frame_header(&s->gb, s);", "if (VAR_6 != 0) {", "av_dlog(s->VAR_0, \"Error in svq1_decode_frame_header %VAR_7\\n\", VAR_6);", "return VAR_6;", "}", "avcodec_set_dimensions(VAR_0, s->VAR_10, s->VAR_11);", "if (s->pict_type == AV_PICTURE_TYPE_B && s->last_picture_ptr == NULL)\nreturn VAR_5;", "if ((VAR_0->skip_frame >= AVDISCARD_NONREF &&\ns->pict_type == AV_PICTURE_TYPE_B) ||\n(VAR_0->skip_frame >= AVDISCARD_NONKEY &&\ns->pict_type != AV_PICTURE_TYPE_I) ||\nVAR_0->skip_frame >= AVDISCARD_ALL)\nreturn VAR_5;", "if ((VAR_6 = ff_MPV_frame_start(s, VAR_0)) < 0)\nreturn VAR_6;", "pmv = av_malloc((FFALIGN(s->VAR_10, 16) / 8 + 3) * sizeof(*pmv));", "if (!pmv)\nreturn AVERROR(ENOMEM);", "for (VAR_7 = 0; VAR_7 < 3; VAR_7++) {", "int VAR_12;", "if (VAR_7 == 0) {", "VAR_10 = FFALIGN(s->VAR_10, 16);", "VAR_11 = FFALIGN(s->VAR_11, 16);", "VAR_12 = s->VAR_12;", "} else {", "if (s->flags & CODEC_FLAG_GRAY)\nbreak;", "VAR_10 = FFALIGN(s->VAR_10 / 4, 16);", "VAR_11 = FFALIGN(s->VAR_11 / 4, 16);", "VAR_12 = s->uvlinesize;", "}", "current = s->current_picture.f.VAR_1[VAR_7];", "if (s->pict_type == AV_PICTURE_TYPE_B)\nprevious = s->next_picture.f.VAR_1[VAR_7];", "else\nprevious = s->last_picture.f.VAR_1[VAR_7];", "if (s->pict_type == AV_PICTURE_TYPE_I) {", "for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {", "VAR_6 = svq1_decode_block_intra(&s->gb, &current[VAR_8],\nVAR_12);", "if (VAR_6 != 0) {", "av_log(s->VAR_0, AV_LOG_INFO,\n\"Error in svq1_decode_block %VAR_7 (keyframe)\\n\",\nVAR_6);", "goto err;", "}", "}", "current += 16 * VAR_12;", "}", "} else {", "memset(pmv, 0, ((VAR_10 / 8) + 3) * sizeof(svq1_pmv));", "for (VAR_9 = 0; VAR_9 < VAR_11; VAR_9 += 16) {", "for (VAR_8 = 0; VAR_8 < VAR_10; VAR_8 += 16) {", "VAR_6 = svq1_decode_delta_block(s, &s->gb, &current[VAR_8],\nprevious, VAR_12,\npmv, VAR_8, VAR_9);", "if (VAR_6 != 0) {", "av_dlog(s->VAR_0,\n\"Error in svq1_decode_delta_block %VAR_7\\n\",\nVAR_6);", "goto err;", "}", "}", "pmv[0].VAR_8 =\npmv[0].VAR_9 = 0;", "current += 16 * VAR_12;", "}", "}", "}", "*pict = s->current_picture.f;", "ff_MPV_frame_end(s);", "*VAR_2 = sizeof(AVFrame);", "VAR_6 = VAR_5;", "err:\nav_free(pmv);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25 ], [ 31 ], [ 35, 37 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 85, 87 ], [ 91, 93, 95, 97, 99, 101 ], [ 105, 107 ], [ 111 ], [ 113, 115 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 153, 155 ], [ 157, 159 ], [ 163 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177, 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 201 ], [ 203 ], [ 205, 207, 209 ], [ 211 ], [ 213, 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 247 ], [ 251 ], [ 253 ], [ 257, 259 ], [ 261 ], [ 263 ] ]
25,779
static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) { BDRVSheepdogState *s = bs->opaque; BDRVSheepdogState *old_s; char tag[SD_MAX_VDI_TAG_LEN]; uint32_t snapid = 0; int ret = 0; old_s = g_malloc(sizeof(BDRVSheepdogState)); memcpy(old_s, s, sizeof(BDRVSheepdogState)); snapid = strtoul(snapshot_id, NULL, 10); if (snapid) { tag[0] = 0; } else { pstrcpy(tag, sizeof(tag), snapshot_id); } ret = reload_inode(s, snapid, tag); if (ret) { goto out; } ret = sd_create_branch(s); if (ret) { goto out; } g_free(old_s); return 0; out: /* recover bdrv_sd_state */ memcpy(s, old_s, sizeof(BDRVSheepdogState)); g_free(old_s); error_report("failed to open. recover old bdrv_sd_state."); return ret; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) { BDRVSheepdogState *s = bs->opaque; BDRVSheepdogState *old_s; char tag[SD_MAX_VDI_TAG_LEN]; uint32_t snapid = 0; int ret = 0; old_s = g_malloc(sizeof(BDRVSheepdogState)); memcpy(old_s, s, sizeof(BDRVSheepdogState)); snapid = strtoul(snapshot_id, NULL, 10); if (snapid) { tag[0] = 0; } else { pstrcpy(tag, sizeof(tag), snapshot_id); } ret = reload_inode(s, snapid, tag); if (ret) { goto out; } ret = sd_create_branch(s); if (ret) { goto out; } g_free(old_s); return 0; out: memcpy(s, old_s, sizeof(BDRVSheepdogState)); g_free(old_s); error_report("failed to open. recover old bdrv_sd_state."); return ret; }
{ "code": [ " old_s = g_malloc(sizeof(BDRVSheepdogState));" ], "line_no": [ 17 ] }
static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1) { BDRVSheepdogState *s = VAR_0->opaque; BDRVSheepdogState *old_s; char VAR_2[SD_MAX_VDI_TAG_LEN]; uint32_t snapid = 0; int VAR_3 = 0; old_s = g_malloc(sizeof(BDRVSheepdogState)); memcpy(old_s, s, sizeof(BDRVSheepdogState)); snapid = strtoul(VAR_1, NULL, 10); if (snapid) { VAR_2[0] = 0; } else { pstrcpy(VAR_2, sizeof(VAR_2), VAR_1); } VAR_3 = reload_inode(s, snapid, VAR_2); if (VAR_3) { goto out; } VAR_3 = sd_create_branch(s); if (VAR_3) { goto out; } g_free(old_s); return 0; out: memcpy(s, old_s, sizeof(BDRVSheepdogState)); g_free(old_s); error_report("failed to open. recover old bdrv_sd_state."); return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0, const char *VAR_1)\n{", "BDRVSheepdogState *s = VAR_0->opaque;", "BDRVSheepdogState *old_s;", "char VAR_2[SD_MAX_VDI_TAG_LEN];", "uint32_t snapid = 0;", "int VAR_3 = 0;", "old_s = g_malloc(sizeof(BDRVSheepdogState));", "memcpy(old_s, s, sizeof(BDRVSheepdogState));", "snapid = strtoul(VAR_1, NULL, 10);", "if (snapid) {", "VAR_2[0] = 0;", "} else {", "pstrcpy(VAR_2, sizeof(VAR_2), VAR_1);", "}", "VAR_3 = reload_inode(s, snapid, VAR_2);", "if (VAR_3) {", "goto out;", "}", "VAR_3 = sd_create_branch(s);", "if (VAR_3) {", "goto out;", "}", "g_free(old_s);", "return 0;", "out:\nmemcpy(s, old_s, sizeof(BDRVSheepdogState));", "g_free(old_s);", "error_report(\"failed to open. recover old bdrv_sd_state.\");", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65, 69 ], [ 71 ], [ 75 ], [ 79 ], [ 81 ] ]
25,780
static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) { RMContext *rm = s->priv_data; AVStream *st; ByteIOContext *pb = &s->pb; unsigned int tag, v; int tag_size, size, codec_data_size, i; int64_t codec_pos; unsigned int h263_hack_version, start_time, duration; char buf[128]; int flags = 0; tag = get_le32(pb); if (tag == MKTAG('.', 'r', 'a', 0xfd)) { /* very old .ra format */ return rm_read_header_old(s, ap); } else if (tag != MKTAG('.', 'R', 'M', 'F')) { return AVERROR_IO; get_be32(pb); /* header size */ get_be16(pb); get_be32(pb); get_be32(pb); /* number of headers */ for(;;) { if (url_feof(pb)) goto fail; tag = get_le32(pb); tag_size = get_be32(pb); get_be16(pb); #if 0 printf("tag=%c%c%c%c (%08x) size=%d\n", (tag) & 0xff, (tag >> 8) & 0xff, (tag >> 16) & 0xff, (tag >> 24) & 0xff, tag, tag_size); #endif if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) goto fail; switch(tag) { case MKTAG('P', 'R', 'O', 'P'): /* file header */ get_be32(pb); /* max bit rate */ get_be32(pb); /* avg bit rate */ get_be32(pb); /* max packet size */ get_be32(pb); /* avg packet size */ get_be32(pb); /* nb packets */ get_be32(pb); /* duration */ get_be32(pb); /* preroll */ get_be32(pb); /* index offset */ get_be32(pb); /* data offset */ get_be16(pb); /* nb streams */ flags = get_be16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): get_str(pb, s->title, sizeof(s->title)); get_str(pb, s->author, sizeof(s->author)); get_str(pb, s->copyright, sizeof(s->copyright)); get_str(pb, s->comment, sizeof(s->comment)); break; case MKTAG('M', 'D', 'P', 'R'): st = av_new_stream(s, 0); if (!st) goto fail; st->id = get_be16(pb); get_be32(pb); /* max bit rate */ st->codec->bit_rate = get_be32(pb); /* bit rate */ get_be32(pb); /* max packet size */ get_be32(pb); /* avg packet size */ start_time = get_be32(pb); /* start time */ get_be32(pb); /* preroll */ duration = get_be32(pb); /* duration */ st->start_time = start_time; st->duration = duration; get_str8(pb, buf, sizeof(buf)); /* desc */ get_str8(pb, buf, sizeof(buf)); /* mimetype */ codec_data_size = get_be32(pb); codec_pos = url_ftell(pb); st->codec->codec_type = CODEC_TYPE_DATA; av_set_pts_info(st, 64, 1, 1000); v = get_be32(pb); if (v == MKTAG(0xfd, 'a', 'r', '.')) { /* ra type header */ rm_read_audio_stream_info(s, st, 0); } else { int fps, fps2; if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; st->codec->codec_tag = get_le32(pb); // av_log(NULL, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0') && st->codec->codec_tag != MKTAG('R', 'V', '2', '0') && st->codec->codec_tag != MKTAG('R', 'V', '3', '0') && st->codec->codec_tag != MKTAG('R', 'V', '4', '0')) goto fail1; st->codec->width = get_be16(pb); st->codec->height = get_be16(pb); st->codec->time_base.num= 1; fps= get_be16(pb); st->codec->codec_type = CODEC_TYPE_VIDEO; get_be32(pb); fps2= get_be16(pb); get_be16(pb); st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos); st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); // av_log(NULL, AV_LOG_DEBUG, "fps= %d fps2= %d\n", fps, fps2); st->codec->time_base.den = fps * st->codec->time_base.num; /* modification of h263 codec version (!) */ #ifdef WORDS_BIGENDIAN h263_hack_version = ((uint32_t*)st->codec->extradata)[1]; #else h263_hack_version = bswap_32(((uint32_t*)st->codec->extradata)[1]); #endif st->codec->sub_id = h263_hack_version; switch((h263_hack_version>>28)){ case 1: st->codec->codec_id = CODEC_ID_RV10; break; case 2: st->codec->codec_id = CODEC_ID_RV20; break; case 3: st->codec->codec_id = CODEC_ID_RV30; break; case 4: st->codec->codec_id = CODEC_ID_RV40; break; default: goto fail1; skip: /* skip codec info */ size = url_ftell(pb) - codec_pos; url_fskip(pb, codec_data_size - size); break; case MKTAG('D', 'A', 'T', 'A'): goto header_end; default: /* unknown tag: skip it */ url_fskip(pb, tag_size - 10); break; header_end: rm->nb_packets = get_be32(pb); /* number of packets */ if (!rm->nb_packets && (flags & 4)) rm->nb_packets = 3600 * 25; get_be32(pb); /* next data header */ return 0; fail: for(i=0;i<s->nb_streams;i++) { av_free(s->streams[i]); return AVERROR_IO;
true
FFmpeg
a443a2530d00b7019269202ac0f5ca8ba0a021c7
static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) { RMContext *rm = s->priv_data; AVStream *st; ByteIOContext *pb = &s->pb; unsigned int tag, v; int tag_size, size, codec_data_size, i; int64_t codec_pos; unsigned int h263_hack_version, start_time, duration; char buf[128]; int flags = 0; tag = get_le32(pb); if (tag == MKTAG('.', 'r', 'a', 0xfd)) { return rm_read_header_old(s, ap); } else if (tag != MKTAG('.', 'R', 'M', 'F')) { return AVERROR_IO; get_be32(pb); get_be16(pb); get_be32(pb); get_be32(pb); for(;;) { if (url_feof(pb)) goto fail; tag = get_le32(pb); tag_size = get_be32(pb); get_be16(pb); #if 0 printf("tag=%c%c%c%c (%08x) size=%d\n", (tag) & 0xff, (tag >> 8) & 0xff, (tag >> 16) & 0xff, (tag >> 24) & 0xff, tag, tag_size); #endif if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) goto fail; switch(tag) { case MKTAG('P', 'R', 'O', 'P'): get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be16(pb); flags = get_be16(pb); break; case MKTAG('C', 'O', 'N', 'T'): get_str(pb, s->title, sizeof(s->title)); get_str(pb, s->author, sizeof(s->author)); get_str(pb, s->copyright, sizeof(s->copyright)); get_str(pb, s->comment, sizeof(s->comment)); break; case MKTAG('M', 'D', 'P', 'R'): st = av_new_stream(s, 0); if (!st) goto fail; st->id = get_be16(pb); get_be32(pb); st->codec->bit_rate = get_be32(pb); get_be32(pb); get_be32(pb); start_time = get_be32(pb); get_be32(pb); duration = get_be32(pb); st->start_time = start_time; st->duration = duration; get_str8(pb, buf, sizeof(buf)); get_str8(pb, buf, sizeof(buf)); codec_data_size = get_be32(pb); codec_pos = url_ftell(pb); st->codec->codec_type = CODEC_TYPE_DATA; av_set_pts_info(st, 64, 1, 1000); v = get_be32(pb); if (v == MKTAG(0xfd, 'a', 'r', '.')) { rm_read_audio_stream_info(s, st, 0); } else { int fps, fps2; if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; st->codec->codec_tag = get_le32(pb); if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0') && st->codec->codec_tag != MKTAG('R', 'V', '2', '0') && st->codec->codec_tag != MKTAG('R', 'V', '3', '0') && st->codec->codec_tag != MKTAG('R', 'V', '4', '0')) goto fail1; st->codec->width = get_be16(pb); st->codec->height = get_be16(pb); st->codec->time_base.num= 1; fps= get_be16(pb); st->codec->codec_type = CODEC_TYPE_VIDEO; get_be32(pb); fps2= get_be16(pb); get_be16(pb); st->codec->extradata_size= codec_data_size - (url_ftell(pb) - codec_pos); st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); st->codec->time_base.den = fps * st->codec->time_base.num; #ifdef WORDS_BIGENDIAN h263_hack_version = ((uint32_t*)st->codec->extradata)[1]; #else h263_hack_version = bswap_32(((uint32_t*)st->codec->extradata)[1]); #endif st->codec->sub_id = h263_hack_version; switch((h263_hack_version>>28)){ case 1: st->codec->codec_id = CODEC_ID_RV10; break; case 2: st->codec->codec_id = CODEC_ID_RV20; break; case 3: st->codec->codec_id = CODEC_ID_RV30; break; case 4: st->codec->codec_id = CODEC_ID_RV40; break; default: goto fail1; skip: size = url_ftell(pb) - codec_pos; url_fskip(pb, codec_data_size - size); break; case MKTAG('D', 'A', 'T', 'A'): goto header_end; default: url_fskip(pb, tag_size - 10); break; header_end: rm->nb_packets = get_be32(pb); if (!rm->nb_packets && (flags & 4)) rm->nb_packets = 3600 * 25; get_be32(pb); return 0; fail: for(i=0;i<s->nb_streams;i++) { av_free(s->streams[i]); return AVERROR_IO;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1) { RMContext *rm = VAR_0->priv_data; AVStream *st; ByteIOContext *pb = &VAR_0->pb; unsigned int VAR_2, VAR_3; int VAR_4, VAR_5, VAR_6, VAR_7; int64_t codec_pos; unsigned int VAR_8, VAR_9, VAR_10; char VAR_11[128]; int VAR_12 = 0; VAR_2 = get_le32(pb); if (VAR_2 == MKTAG('.', 'r', 'a', 0xfd)) { return rm_read_header_old(VAR_0, VAR_1); } else if (VAR_2 != MKTAG('.', 'R', 'M', 'F')) { return AVERROR_IO; get_be32(pb); get_be16(pb); get_be32(pb); get_be32(pb); for(;;) { if (url_feof(pb)) goto fail; VAR_2 = get_le32(pb); VAR_4 = get_be32(pb); get_be16(pb); #if 0 printf("VAR_2=%c%c%c%c (%08x) VAR_5=%d\n", (VAR_2) & 0xff, (VAR_2 >> 8) & 0xff, (VAR_2 >> 16) & 0xff, (VAR_2 >> 24) & 0xff, VAR_2, VAR_4); #endif if (VAR_4 < 10 && VAR_2 != MKTAG('D', 'A', 'T', 'A')) goto fail; switch(VAR_2) { case MKTAG('P', 'R', 'O', 'P'): get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); get_be16(pb); VAR_12 = get_be16(pb); break; case MKTAG('C', 'O', 'N', 'T'): get_str(pb, VAR_0->title, sizeof(VAR_0->title)); get_str(pb, VAR_0->author, sizeof(VAR_0->author)); get_str(pb, VAR_0->copyright, sizeof(VAR_0->copyright)); get_str(pb, VAR_0->comment, sizeof(VAR_0->comment)); break; case MKTAG('M', 'D', 'P', 'R'): st = av_new_stream(VAR_0, 0); if (!st) goto fail; st->id = get_be16(pb); get_be32(pb); st->codec->bit_rate = get_be32(pb); get_be32(pb); get_be32(pb); VAR_9 = get_be32(pb); get_be32(pb); VAR_10 = get_be32(pb); st->VAR_9 = VAR_9; st->VAR_10 = VAR_10; get_str8(pb, VAR_11, sizeof(VAR_11)); get_str8(pb, VAR_11, sizeof(VAR_11)); VAR_6 = get_be32(pb); codec_pos = url_ftell(pb); st->codec->codec_type = CODEC_TYPE_DATA; av_set_pts_info(st, 64, 1, 1000); VAR_3 = get_be32(pb); if (VAR_3 == MKTAG(0xfd, 'a', 'r', '.')) { rm_read_audio_stream_info(VAR_0, st, 0); } else { int VAR_13, VAR_14; if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { fail1: av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); goto skip; st->codec->codec_tag = get_le32(pb); if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0') && st->codec->codec_tag != MKTAG('R', 'V', '2', '0') && st->codec->codec_tag != MKTAG('R', 'V', '3', '0') && st->codec->codec_tag != MKTAG('R', 'V', '4', '0')) goto fail1; st->codec->width = get_be16(pb); st->codec->height = get_be16(pb); st->codec->time_base.num= 1; VAR_13= get_be16(pb); st->codec->codec_type = CODEC_TYPE_VIDEO; get_be32(pb); VAR_14= get_be16(pb); get_be16(pb); st->codec->extradata_size= VAR_6 - (url_ftell(pb) - codec_pos); st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); st->codec->time_base.den = VAR_13 * st->codec->time_base.num; #ifdef WORDS_BIGENDIAN VAR_8 = ((uint32_t*)st->codec->extradata)[1]; #else VAR_8 = bswap_32(((uint32_t*)st->codec->extradata)[1]); #endif st->codec->sub_id = VAR_8; switch((VAR_8>>28)){ case 1: st->codec->codec_id = CODEC_ID_RV10; break; case 2: st->codec->codec_id = CODEC_ID_RV20; break; case 3: st->codec->codec_id = CODEC_ID_RV30; break; case 4: st->codec->codec_id = CODEC_ID_RV40; break; default: goto fail1; skip: VAR_5 = url_ftell(pb) - codec_pos; url_fskip(pb, VAR_6 - VAR_5); break; case MKTAG('D', 'A', 'T', 'A'): goto header_end; default: url_fskip(pb, VAR_4 - 10); break; header_end: rm->nb_packets = get_be32(pb); if (!rm->nb_packets && (VAR_12 & 4)) rm->nb_packets = 3600 * 25; get_be32(pb); return 0; fail: for(VAR_7=0;VAR_7<VAR_0->nb_streams;VAR_7++) { av_free(VAR_0->streams[VAR_7]); return AVERROR_IO;
[ "static int FUNC_0(AVFormatContext *VAR_0, AVFormatParameters *VAR_1)\n{", "RMContext *rm = VAR_0->priv_data;", "AVStream *st;", "ByteIOContext *pb = &VAR_0->pb;", "unsigned int VAR_2, VAR_3;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "int64_t codec_pos;", "unsigned int VAR_8, VAR_9, VAR_10;", "char VAR_11[128];", "int VAR_12 = 0;", "VAR_2 = get_le32(pb);", "if (VAR_2 == MKTAG('.', 'r', 'a', 0xfd)) {", "return rm_read_header_old(VAR_0, VAR_1);", "} else if (VAR_2 != MKTAG('.', 'R', 'M', 'F')) {", "return AVERROR_IO;", "get_be32(pb);", "get_be16(pb);", "get_be32(pb);", "get_be32(pb);", "for(;;) {", "if (url_feof(pb))\ngoto fail;", "VAR_2 = get_le32(pb);", "VAR_4 = get_be32(pb);", "get_be16(pb);", "#if 0\nprintf(\"VAR_2=%c%c%c%c (%08x) VAR_5=%d\\n\",\n(VAR_2) & 0xff,\n(VAR_2 >> 8) & 0xff,\n(VAR_2 >> 16) & 0xff,\n(VAR_2 >> 24) & 0xff,\nVAR_2,\nVAR_4);", "#endif\nif (VAR_4 < 10 && VAR_2 != MKTAG('D', 'A', 'T', 'A'))\ngoto fail;", "switch(VAR_2) {", "case MKTAG('P', 'R', 'O', 'P'):\nget_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "get_be16(pb);", "VAR_12 = get_be16(pb);", "break;", "case MKTAG('C', 'O', 'N', 'T'):\nget_str(pb, VAR_0->title, sizeof(VAR_0->title));", "get_str(pb, VAR_0->author, sizeof(VAR_0->author));", "get_str(pb, VAR_0->copyright, sizeof(VAR_0->copyright));", "get_str(pb, VAR_0->comment, sizeof(VAR_0->comment));", "break;", "case MKTAG('M', 'D', 'P', 'R'):\nst = av_new_stream(VAR_0, 0);", "if (!st)\ngoto fail;", "st->id = get_be16(pb);", "get_be32(pb);", "st->codec->bit_rate = get_be32(pb);", "get_be32(pb);", "get_be32(pb);", "VAR_9 = get_be32(pb);", "get_be32(pb);", "VAR_10 = get_be32(pb);", "st->VAR_9 = VAR_9;", "st->VAR_10 = VAR_10;", "get_str8(pb, VAR_11, sizeof(VAR_11));", "get_str8(pb, VAR_11, sizeof(VAR_11));", "VAR_6 = get_be32(pb);", "codec_pos = url_ftell(pb);", "st->codec->codec_type = CODEC_TYPE_DATA;", "av_set_pts_info(st, 64, 1, 1000);", "VAR_3 = get_be32(pb);", "if (VAR_3 == MKTAG(0xfd, 'a', 'r', '.')) {", "rm_read_audio_stream_info(VAR_0, st, 0);", "} else {", "int VAR_13, VAR_14;", "if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {", "fail1:\nav_log(st->codec, AV_LOG_ERROR, \"Unsupported video codec\\n\");", "goto skip;", "st->codec->codec_tag = get_le32(pb);", "if ( st->codec->codec_tag != MKTAG('R', 'V', '1', '0')\n&& st->codec->codec_tag != MKTAG('R', 'V', '2', '0')\n&& st->codec->codec_tag != MKTAG('R', 'V', '3', '0')\n&& st->codec->codec_tag != MKTAG('R', 'V', '4', '0'))\ngoto fail1;", "st->codec->width = get_be16(pb);", "st->codec->height = get_be16(pb);", "st->codec->time_base.num= 1;", "VAR_13= get_be16(pb);", "st->codec->codec_type = CODEC_TYPE_VIDEO;", "get_be32(pb);", "VAR_14= get_be16(pb);", "get_be16(pb);", "st->codec->extradata_size= VAR_6 - (url_ftell(pb) - codec_pos);", "st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);", "get_buffer(pb, st->codec->extradata, st->codec->extradata_size);", "st->codec->time_base.den = VAR_13 * st->codec->time_base.num;", "#ifdef WORDS_BIGENDIAN\nVAR_8 = ((uint32_t*)st->codec->extradata)[1];", "#else\nVAR_8 = bswap_32(((uint32_t*)st->codec->extradata)[1]);", "#endif\nst->codec->sub_id = VAR_8;", "switch((VAR_8>>28)){", "case 1: st->codec->codec_id = CODEC_ID_RV10; break;", "case 2: st->codec->codec_id = CODEC_ID_RV20; break;", "case 3: st->codec->codec_id = CODEC_ID_RV30; break;", "case 4: st->codec->codec_id = CODEC_ID_RV40; break;", "default: goto fail1;", "skip:\nVAR_5 = url_ftell(pb) - codec_pos;", "url_fskip(pb, VAR_6 - VAR_5);", "break;", "case MKTAG('D', 'A', 'T', 'A'):\ngoto header_end;", "default:\nurl_fskip(pb, VAR_4 - 10);", "break;", "header_end:\nrm->nb_packets = get_be32(pb);", "if (!rm->nb_packets && (VAR_12 & 4))\nrm->nb_packets = 3600 * 25;", "get_be32(pb);", "return 0;", "fail:\nfor(VAR_7=0;VAR_7<VAR_0->nb_streams;VAR_7++) {", "av_free(VAR_0->streams[VAR_7]);", "return AVERROR_IO;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28, 29, 30, 31, 32, 33, 34, 35 ], [ 36, 37, 38 ], [ 39 ], [ 40, 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54, 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60, 61 ], [ 62, 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 83 ], [ 84 ], [ 85 ], [ 86 ], [ 87, 88 ], [ 89 ], [ 90 ], [ 92, 93, 94, 95, 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 109 ], [ 111, 112 ], [ 113, 114 ], [ 115, 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 121 ], [ 122 ], [ 123, 125 ], [ 126 ], [ 127 ], [ 128, 129 ], [ 130, 132 ], [ 133 ], [ 134, 135 ], [ 136, 137 ], [ 138 ], [ 139 ], [ 140, 141 ], [ 142 ], [ 143 ] ]
25,781
static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVParallelsState *s = bs->opaque; uint32_t idx, to_allocate, i; int64_t pos, space; pos = block_status(s, sector_num, nb_sectors, pnum); if (pos > 0) { return pos; } idx = sector_num / s->tracks; if (idx >= s->bat_size) { return -EINVAL; } to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; space = to_allocate * s->tracks; if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) { int ret; space += s->prealloc_size; if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { ret = bdrv_pwrite_zeroes(bs->file, s->data_end << BDRV_SECTOR_BITS, space << BDRV_SECTOR_BITS, 0); } else { ret = bdrv_truncate(bs->file, (s->data_end + space) << BDRV_SECTOR_BITS); } if (ret < 0) { return ret; } } for (i = 0; i < to_allocate; i++) { s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier); s->data_end += s->tracks; bitmap_set(s->bat_dirty_bmap, bat_entry_off(idx + i) / s->bat_dirty_block, 1); } return bat2sect(s, idx) + sector_num % s->tracks; }
true
qemu
86d1bd70987cd11d85d01f52aa5824c63d910471
static int64_t allocate_clusters(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVParallelsState *s = bs->opaque; uint32_t idx, to_allocate, i; int64_t pos, space; pos = block_status(s, sector_num, nb_sectors, pnum); if (pos > 0) { return pos; } idx = sector_num / s->tracks; if (idx >= s->bat_size) { return -EINVAL; } to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; space = to_allocate * s->tracks; if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) { int ret; space += s->prealloc_size; if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { ret = bdrv_pwrite_zeroes(bs->file, s->data_end << BDRV_SECTOR_BITS, space << BDRV_SECTOR_BITS, 0); } else { ret = bdrv_truncate(bs->file, (s->data_end + space) << BDRV_SECTOR_BITS); } if (ret < 0) { return ret; } } for (i = 0; i < to_allocate; i++) { s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier); s->data_end += s->tracks; bitmap_set(s->bat_dirty_bmap, bat_entry_off(idx + i) / s->bat_dirty_block, 1); } return bat2sect(s, idx) + sector_num % s->tracks; }
{ "code": [ " uint32_t idx, to_allocate, i;", " int64_t pos, space;", " if (idx >= s->bat_size) {", " return -EINVAL;" ], "line_no": [ 9, 11, 27, 29 ] }
static int64_t FUNC_0(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVParallelsState *s = bs->opaque; uint32_t idx, to_allocate, i; int64_t pos, space; pos = block_status(s, sector_num, nb_sectors, pnum); if (pos > 0) { return pos; } idx = sector_num / s->tracks; if (idx >= s->bat_size) { return -EINVAL; } to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx; space = to_allocate * s->tracks; if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) { int VAR_0; space += s->prealloc_size; if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) { VAR_0 = bdrv_pwrite_zeroes(bs->file, s->data_end << BDRV_SECTOR_BITS, space << BDRV_SECTOR_BITS, 0); } else { VAR_0 = bdrv_truncate(bs->file, (s->data_end + space) << BDRV_SECTOR_BITS); } if (VAR_0 < 0) { return VAR_0; } } for (i = 0; i < to_allocate; i++) { s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier); s->data_end += s->tracks; bitmap_set(s->bat_dirty_bmap, bat_entry_off(idx + i) / s->bat_dirty_block, 1); } return bat2sect(s, idx) + sector_num % s->tracks; }
[ "static int64_t FUNC_0(BlockDriverState *bs, int64_t sector_num,\nint nb_sectors, int *pnum)\n{", "BDRVParallelsState *s = bs->opaque;", "uint32_t idx, to_allocate, i;", "int64_t pos, space;", "pos = block_status(s, sector_num, nb_sectors, pnum);", "if (pos > 0) {", "return pos;", "}", "idx = sector_num / s->tracks;", "if (idx >= s->bat_size) {", "return -EINVAL;", "}", "to_allocate = DIV_ROUND_UP(sector_num + *pnum, s->tracks) - idx;", "space = to_allocate * s->tracks;", "if (s->data_end + space > bdrv_getlength(bs->file->bs) >> BDRV_SECTOR_BITS) {", "int VAR_0;", "space += s->prealloc_size;", "if (s->prealloc_mode == PRL_PREALLOC_MODE_FALLOCATE) {", "VAR_0 = bdrv_pwrite_zeroes(bs->file,\ns->data_end << BDRV_SECTOR_BITS,\nspace << BDRV_SECTOR_BITS, 0);", "} else {", "VAR_0 = bdrv_truncate(bs->file,\n(s->data_end + space) << BDRV_SECTOR_BITS);", "}", "if (VAR_0 < 0) {", "return VAR_0;", "}", "}", "for (i = 0; i < to_allocate; i++) {", "s->bat_bitmap[idx + i] = cpu_to_le32(s->data_end / s->off_multiplier);", "s->data_end += s->tracks;", "bitmap_set(s->bat_dirty_bmap,\nbat_entry_off(idx + i) / s->bat_dirty_block, 1);", "}", "return bat2sect(s, idx) + sector_num % s->tracks;", "}" ]
[ 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 85 ], [ 87 ] ]
25,783
static void send_scsi_cdb_read10(QPCIDevice *dev, void *ide_base, uint64_t lba, int nblocks) { Read10CDB pkt = { .padding = 0 }; int i; g_assert_cmpint(lba, <=, UINT32_MAX); g_assert_cmpint(nblocks, <=, UINT16_MAX); g_assert_cmpint(nblocks, >=, 0); /* Construct SCSI CDB packet */ pkt.opcode = 0x28; pkt.lba = cpu_to_be32(lba); pkt.nblocks = cpu_to_be16(nblocks); /* Send Packet */ for (i = 0; i < sizeof(Read10CDB)/2; i++) { qpci_io_writew(dev, ide_base + reg_data, le16_to_cpu(((uint16_t *)&pkt)[i])); } }
true
qemu
b4ba67d9a702507793c2724e56f98e9b0f7be02b
static void send_scsi_cdb_read10(QPCIDevice *dev, void *ide_base, uint64_t lba, int nblocks) { Read10CDB pkt = { .padding = 0 }; int i; g_assert_cmpint(lba, <=, UINT32_MAX); g_assert_cmpint(nblocks, <=, UINT16_MAX); g_assert_cmpint(nblocks, >=, 0); pkt.opcode = 0x28; pkt.lba = cpu_to_be32(lba); pkt.nblocks = cpu_to_be16(nblocks); for (i = 0; i < sizeof(Read10CDB)/2; i++) { qpci_io_writew(dev, ide_base + reg_data, le16_to_cpu(((uint16_t *)&pkt)[i])); } }
{ "code": [ "static void send_scsi_cdb_read10(QPCIDevice *dev, void *ide_base,", " qpci_io_writew(dev, ide_base + reg_data," ], "line_no": [ 1, 35 ] }
static void FUNC_0(QPCIDevice *VAR_0, void *VAR_1, uint64_t VAR_2, int VAR_3) { Read10CDB pkt = { .padding = 0 }; int VAR_4; g_assert_cmpint(VAR_2, <=, UINT32_MAX); g_assert_cmpint(VAR_3, <=, UINT16_MAX); g_assert_cmpint(VAR_3, >=, 0); pkt.opcode = 0x28; pkt.VAR_2 = cpu_to_be32(VAR_2); pkt.VAR_3 = cpu_to_be16(VAR_3); for (VAR_4 = 0; VAR_4 < sizeof(Read10CDB)/2; VAR_4++) { qpci_io_writew(VAR_0, VAR_1 + reg_data, le16_to_cpu(((uint16_t *)&pkt)[VAR_4])); } }
[ "static void FUNC_0(QPCIDevice *VAR_0, void *VAR_1,\nuint64_t VAR_2, int VAR_3)\n{", "Read10CDB pkt = { .padding = 0 };", "int VAR_4;", "g_assert_cmpint(VAR_2, <=, UINT32_MAX);", "g_assert_cmpint(VAR_3, <=, UINT16_MAX);", "g_assert_cmpint(VAR_3, >=, 0);", "pkt.opcode = 0x28;", "pkt.VAR_2 = cpu_to_be32(VAR_2);", "pkt.VAR_3 = cpu_to_be16(VAR_3);", "for (VAR_4 = 0; VAR_4 < sizeof(Read10CDB)/2; VAR_4++) {", "qpci_io_writew(VAR_0, VAR_1 + reg_data,\nle16_to_cpu(((uint16_t *)&pkt)[VAR_4]));", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
25,784
static int vobsub_read_header(AVFormatContext *s) { int i, ret = 0, header_parsed = 0, langidx = 0; MpegDemuxContext *vobsub = s->priv_data; char *sub_name = NULL; size_t fname_len; char *ext, *header_str; AVBPrint header; int64_t delay = 0; AVStream *st = NULL; sub_name = av_strdup(s->filename); fname_len = strlen(sub_name); ext = sub_name - 3 + fname_len; if (fname_len < 4 || *(ext - 1) != '.') { av_log(s, AV_LOG_ERROR, "The input index filename is too short " "to guess the associated .SUB file\n"); ret = AVERROR_INVALIDDATA; goto end; } memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3); av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name); ret = avformat_open_input(&vobsub->sub_ctx, sub_name, &ff_mpegps_demuxer, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", sub_name); goto end; } av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); while (!url_feof(s->pb)) { char line[2048]; int len = ff_get_line(s->pb, line, sizeof(line)); if (!len) break; line[strcspn(line, "\r\n")] = 0; if (!strncmp(line, "id:", 3)) { int n, stream_id = 0; char id[64] = {0}; n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id); if (n != 2) { av_log(s, AV_LOG_WARNING, "Unable to parse index line '%s', " "assuming 'id: und, index: 0'\n", line); strcpy(id, "und"); stream_id = 0; } if (stream_id >= FF_ARRAY_ELEMS(vobsub->q)) { av_log(s, AV_LOG_ERROR, "Maximum number of subtitles streams reached\n"); ret = AVERROR(EINVAL); goto end; } st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto end; } st->id = stream_id; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE; avpriv_set_pts_info(st, 64, 1, 1000); av_dict_set(&st->metadata, "language", id, 0); av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id); header_parsed = 1; } else if (st && !strncmp(line, "timestamp:", 10)) { AVPacket *sub; int hh, mm, ss, ms; int64_t pos, timestamp; const char *p = line + 10; if (!s->nb_streams) { av_log(s, AV_LOG_ERROR, "Timestamp declared before any stream\n"); ret = AVERROR_INVALIDDATA; goto end; } if (sscanf(p, "%02d:%02d:%02d:%03d, filepos: %"SCNx64, &hh, &mm, &ss, &ms, &pos) != 5) { av_log(s, AV_LOG_ERROR, "Unable to parse timestamp line '%s', " "abort parsing\n", line); break; } timestamp = (hh*3600LL + mm*60LL + ss) * 1000LL + ms + delay; timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base); sub = ff_subtitles_queue_insert(&vobsub->q[s->nb_streams - 1], "", 0, 0); if (!sub) { ret = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = timestamp; sub->stream_index = s->nb_streams - 1; } else if (st && !strncmp(line, "alt:", 4)) { const char *p = line + 4; while (*p == ' ') p++; av_dict_set(&st->metadata, "title", p, 0); av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p); header_parsed = 1; } else if (!strncmp(line, "delay:", 6)) { int sign = 1, hh = 0, mm = 0, ss = 0, ms = 0; const char *p = line + 6; while (*p == ' ') p++; if (*p == '-' || *p == '+') { sign = *p == '-' ? -1 : 1; p++; } sscanf(p, "%d:%d:%d:%d", &hh, &mm, &ss, &ms); delay = ((hh*3600LL + mm*60LL + ss) * 1000LL + ms) * sign; } else if (!strncmp(line, "langidx:", 8)) { const char *p = line + 8; if (sscanf(p, "%d", &langidx) != 1) av_log(s, AV_LOG_ERROR, "Invalid langidx specified\n"); } else if (!header_parsed) { if (line[0] && line[0] != '#') av_bprintf(&header, "%s\n", line); } } if (langidx < s->nb_streams) s->streams[langidx]->disposition |= AV_DISPOSITION_DEFAULT; for (i = 0; i < s->nb_streams; i++) { vobsub->q[i].sort = SUB_SORT_POS_TS; ff_subtitles_queue_finalize(&vobsub->q[i]); } if (!av_bprint_is_complete(&header)) { av_bprint_finalize(&header, NULL); ret = AVERROR(ENOMEM); goto end; } av_bprint_finalize(&header, &header_str); for (i = 0; i < s->nb_streams; i++) { AVStream *sub_st = s->streams[i]; sub_st->codec->extradata = av_strdup(header_str); sub_st->codec->extradata_size = header.len; } av_free(header_str); end: av_free(sub_name); return ret; }
true
FFmpeg
cba92a2226151abf0e3c24ed594e127203d485b8
static int vobsub_read_header(AVFormatContext *s) { int i, ret = 0, header_parsed = 0, langidx = 0; MpegDemuxContext *vobsub = s->priv_data; char *sub_name = NULL; size_t fname_len; char *ext, *header_str; AVBPrint header; int64_t delay = 0; AVStream *st = NULL; sub_name = av_strdup(s->filename); fname_len = strlen(sub_name); ext = sub_name - 3 + fname_len; if (fname_len < 4 || *(ext - 1) != '.') { av_log(s, AV_LOG_ERROR, "The input index filename is too short " "to guess the associated .SUB file\n"); ret = AVERROR_INVALIDDATA; goto end; } memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3); av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name); ret = avformat_open_input(&vobsub->sub_ctx, sub_name, &ff_mpegps_demuxer, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", sub_name); goto end; } av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); while (!url_feof(s->pb)) { char line[2048]; int len = ff_get_line(s->pb, line, sizeof(line)); if (!len) break; line[strcspn(line, "\r\n")] = 0; if (!strncmp(line, "id:", 3)) { int n, stream_id = 0; char id[64] = {0}; n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id); if (n != 2) { av_log(s, AV_LOG_WARNING, "Unable to parse index line '%s', " "assuming 'id: und, index: 0'\n", line); strcpy(id, "und"); stream_id = 0; } if (stream_id >= FF_ARRAY_ELEMS(vobsub->q)) { av_log(s, AV_LOG_ERROR, "Maximum number of subtitles streams reached\n"); ret = AVERROR(EINVAL); goto end; } st = avformat_new_stream(s, NULL); if (!st) { ret = AVERROR(ENOMEM); goto end; } st->id = stream_id; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE; avpriv_set_pts_info(st, 64, 1, 1000); av_dict_set(&st->metadata, "language", id, 0); av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id); header_parsed = 1; } else if (st && !strncmp(line, "timestamp:", 10)) { AVPacket *sub; int hh, mm, ss, ms; int64_t pos, timestamp; const char *p = line + 10; if (!s->nb_streams) { av_log(s, AV_LOG_ERROR, "Timestamp declared before any stream\n"); ret = AVERROR_INVALIDDATA; goto end; } if (sscanf(p, "%02d:%02d:%02d:%03d, filepos: %"SCNx64, &hh, &mm, &ss, &ms, &pos) != 5) { av_log(s, AV_LOG_ERROR, "Unable to parse timestamp line '%s', " "abort parsing\n", line); break; } timestamp = (hh*3600LL + mm*60LL + ss) * 1000LL + ms + delay; timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base); sub = ff_subtitles_queue_insert(&vobsub->q[s->nb_streams - 1], "", 0, 0); if (!sub) { ret = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = timestamp; sub->stream_index = s->nb_streams - 1; } else if (st && !strncmp(line, "alt:", 4)) { const char *p = line + 4; while (*p == ' ') p++; av_dict_set(&st->metadata, "title", p, 0); av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p); header_parsed = 1; } else if (!strncmp(line, "delay:", 6)) { int sign = 1, hh = 0, mm = 0, ss = 0, ms = 0; const char *p = line + 6; while (*p == ' ') p++; if (*p == '-' || *p == '+') { sign = *p == '-' ? -1 : 1; p++; } sscanf(p, "%d:%d:%d:%d", &hh, &mm, &ss, &ms); delay = ((hh*3600LL + mm*60LL + ss) * 1000LL + ms) * sign; } else if (!strncmp(line, "langidx:", 8)) { const char *p = line + 8; if (sscanf(p, "%d", &langidx) != 1) av_log(s, AV_LOG_ERROR, "Invalid langidx specified\n"); } else if (!header_parsed) { if (line[0] && line[0] != '#') av_bprintf(&header, "%s\n", line); } } if (langidx < s->nb_streams) s->streams[langidx]->disposition |= AV_DISPOSITION_DEFAULT; for (i = 0; i < s->nb_streams; i++) { vobsub->q[i].sort = SUB_SORT_POS_TS; ff_subtitles_queue_finalize(&vobsub->q[i]); } if (!av_bprint_is_complete(&header)) { av_bprint_finalize(&header, NULL); ret = AVERROR(ENOMEM); goto end; } av_bprint_finalize(&header, &header_str); for (i = 0; i < s->nb_streams; i++) { AVStream *sub_st = s->streams[i]; sub_st->codec->extradata = av_strdup(header_str); sub_st->codec->extradata_size = header.len; } av_free(header_str); end: av_free(sub_name); return ret; }
{ "code": [ " char line[2048];", " int n, stream_id = 0;", " char id[64] = {0};", " n = sscanf(line, \"id: %63[^,], index: %u\", id, &stream_id);", " if (n != 2) {", " st = avformat_new_stream(s, NULL);", " if (!st) {", " ret = AVERROR(ENOMEM);", " goto end;", " st->id = stream_id;", " st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;", " st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE;", " avpriv_set_pts_info(st, 64, 1, 1000);", " av_dict_set(&st->metadata, \"language\", id, 0);", " av_log(s, AV_LOG_DEBUG, \"IDX stream[%d] id=%s\\n\", stream_id, id);", " } else if (st && !strncmp(line, \"timestamp:\", 10)) {", " if (!s->nb_streams) {", " break;", " } else if (st && !strncmp(line, \"alt:\", 4)) {", " av_dict_set(&st->metadata, \"title\", p, 0);" ], "line_no": [ 61, 79, 81, 85, 87, 113, 115, 117, 107, 123, 125, 127, 129, 131, 133, 139, 151, 171, 199, 209 ] }
static int FUNC_0(AVFormatContext *VAR_0) { int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0; MpegDemuxContext *vobsub = VAR_0->priv_data; char *VAR_5 = NULL; size_t fname_len; char *VAR_6, *VAR_7; AVBPrint header; int64_t delay = 0; AVStream *st = NULL; VAR_5 = av_strdup(VAR_0->filename); fname_len = strlen(VAR_5); VAR_6 = VAR_5 - 3 + fname_len; if (fname_len < 4 || *(VAR_6 - 1) != '.') { av_log(VAR_0, AV_LOG_ERROR, "The input index filename is too short " "to guess the associated .SUB file\VAR_10"); VAR_2 = AVERROR_INVALIDDATA; goto end; } memcpy(VAR_6, !strncmp(VAR_6, "IDX", 3) ? "SUB" : "sub", 3); av_log(VAR_0, AV_LOG_VERBOSE, "IDX/SUB: %VAR_0 -> %VAR_0\VAR_10", VAR_0->filename, VAR_5); VAR_2 = avformat_open_input(&vobsub->sub_ctx, VAR_5, &ff_mpegps_demuxer, NULL); if (VAR_2 < 0) { av_log(VAR_0, AV_LOG_ERROR, "Unable to open %VAR_0 as MPEG subtitles\VAR_10", VAR_5); goto end; } av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); while (!url_feof(VAR_0->pb)) { char VAR_8[2048]; int VAR_9 = ff_get_line(VAR_0->pb, VAR_8, sizeof(VAR_8)); if (!VAR_9) break; VAR_8[strcspn(VAR_8, "\r\VAR_10")] = 0; if (!strncmp(VAR_8, "VAR_12:", 3)) { int VAR_10, VAR_11 = 0; char VAR_12[64] = {0}; VAR_10 = sscanf(VAR_8, "VAR_12: %63[^,], index: %u", VAR_12, &VAR_11); if (VAR_10 != 2) { av_log(VAR_0, AV_LOG_WARNING, "Unable to parse index VAR_8 '%VAR_0', " "assuming 'VAR_12: und, index: 0'\VAR_10", VAR_8); strcpy(VAR_12, "und"); VAR_11 = 0; } if (VAR_11 >= FF_ARRAY_ELEMS(vobsub->q)) { av_log(VAR_0, AV_LOG_ERROR, "Maximum number of subtitles streams reached\VAR_10"); VAR_2 = AVERROR(EINVAL); goto end; } st = avformat_new_stream(VAR_0, NULL); if (!st) { VAR_2 = AVERROR(ENOMEM); goto end; } st->VAR_12 = VAR_11; st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE; avpriv_set_pts_info(st, 64, 1, 1000); av_dict_set(&st->metadata, "language", VAR_12, 0); av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] VAR_12=%VAR_0\VAR_10", VAR_11, VAR_12); VAR_3 = 1; } else if (st && !strncmp(VAR_8, "timestamp:", 10)) { AVPacket *sub; int VAR_19, VAR_19, VAR_19, VAR_19; int64_t pos, timestamp; const char *VAR_19 = VAR_8 + 10; if (!VAR_0->nb_streams) { av_log(VAR_0, AV_LOG_ERROR, "Timestamp declared before any stream\VAR_10"); VAR_2 = AVERROR_INVALIDDATA; goto end; } if (sscanf(VAR_19, "%02d:%02d:%02d:%03d, filepos: %"SCNx64, &VAR_19, &VAR_19, &VAR_19, &VAR_19, &pos) != 5) { av_log(VAR_0, AV_LOG_ERROR, "Unable to parse timestamp VAR_8 '%VAR_0', " "abort parsing\VAR_10", VAR_8); break; } timestamp = (VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19 + delay; timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base); sub = ff_subtitles_queue_insert(&vobsub->q[VAR_0->nb_streams - 1], "", 0, 0); if (!sub) { VAR_2 = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = timestamp; sub->stream_index = VAR_0->nb_streams - 1; } else if (st && !strncmp(VAR_8, "alt:", 4)) { const char *VAR_19 = VAR_8 + 4; while (*VAR_19 == ' ') VAR_19++; av_dict_set(&st->metadata, "title", VAR_19, 0); av_log(VAR_0, AV_LOG_DEBUG, "IDX stream[%d] name=%VAR_0\VAR_10", st->VAR_12, VAR_19); VAR_3 = 1; } else if (!strncmp(VAR_8, "delay:", 6)) { int VAR_18 = 1, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0; const char *VAR_19 = VAR_8 + 6; while (*VAR_19 == ' ') VAR_19++; if (*VAR_19 == '-' || *VAR_19 == '+') { VAR_18 = *VAR_19 == '-' ? -1 : 1; VAR_19++; } sscanf(VAR_19, "%d:%d:%d:%d", &VAR_19, &VAR_19, &VAR_19, &VAR_19); delay = ((VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19) * VAR_18; } else if (!strncmp(VAR_8, "VAR_4:", 8)) { const char *VAR_19 = VAR_8 + 8; if (sscanf(VAR_19, "%d", &VAR_4) != 1) av_log(VAR_0, AV_LOG_ERROR, "Invalid VAR_4 specified\VAR_10"); } else if (!VAR_3) { if (VAR_8[0] && VAR_8[0] != '#') av_bprintf(&header, "%VAR_0\VAR_10", VAR_8); } } if (VAR_4 < VAR_0->nb_streams) VAR_0->streams[VAR_4]->disposition |= AV_DISPOSITION_DEFAULT; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { vobsub->q[VAR_1].sort = SUB_SORT_POS_TS; ff_subtitles_queue_finalize(&vobsub->q[VAR_1]); } if (!av_bprint_is_complete(&header)) { av_bprint_finalize(&header, NULL); VAR_2 = AVERROR(ENOMEM); goto end; } av_bprint_finalize(&header, &VAR_7); for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) { AVStream *sub_st = VAR_0->streams[VAR_1]; sub_st->codec->extradata = av_strdup(VAR_7); sub_st->codec->extradata_size = header.VAR_9; } av_free(VAR_7); end: av_free(VAR_5); return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "int VAR_1, VAR_2 = 0, VAR_3 = 0, VAR_4 = 0;", "MpegDemuxContext *vobsub = VAR_0->priv_data;", "char *VAR_5 = NULL;", "size_t fname_len;", "char *VAR_6, *VAR_7;", "AVBPrint header;", "int64_t delay = 0;", "AVStream *st = NULL;", "VAR_5 = av_strdup(VAR_0->filename);", "fname_len = strlen(VAR_5);", "VAR_6 = VAR_5 - 3 + fname_len;", "if (fname_len < 4 || *(VAR_6 - 1) != '.') {", "av_log(VAR_0, AV_LOG_ERROR, \"The input index filename is too short \"\n\"to guess the associated .SUB file\\VAR_10\");", "VAR_2 = AVERROR_INVALIDDATA;", "goto end;", "}", "memcpy(VAR_6, !strncmp(VAR_6, \"IDX\", 3) ? \"SUB\" : \"sub\", 3);", "av_log(VAR_0, AV_LOG_VERBOSE, \"IDX/SUB: %VAR_0 -> %VAR_0\\VAR_10\", VAR_0->filename, VAR_5);", "VAR_2 = avformat_open_input(&vobsub->sub_ctx, VAR_5, &ff_mpegps_demuxer, NULL);", "if (VAR_2 < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to open %VAR_0 as MPEG subtitles\\VAR_10\", VAR_5);", "goto end;", "}", "av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED);", "while (!url_feof(VAR_0->pb)) {", "char VAR_8[2048];", "int VAR_9 = ff_get_line(VAR_0->pb, VAR_8, sizeof(VAR_8));", "if (!VAR_9)\nbreak;", "VAR_8[strcspn(VAR_8, \"\\r\\VAR_10\")] = 0;", "if (!strncmp(VAR_8, \"VAR_12:\", 3)) {", "int VAR_10, VAR_11 = 0;", "char VAR_12[64] = {0};", "VAR_10 = sscanf(VAR_8, \"VAR_12: %63[^,], index: %u\", VAR_12, &VAR_11);", "if (VAR_10 != 2) {", "av_log(VAR_0, AV_LOG_WARNING, \"Unable to parse index VAR_8 '%VAR_0', \"\n\"assuming 'VAR_12: und, index: 0'\\VAR_10\", VAR_8);", "strcpy(VAR_12, \"und\");", "VAR_11 = 0;", "}", "if (VAR_11 >= FF_ARRAY_ELEMS(vobsub->q)) {", "av_log(VAR_0, AV_LOG_ERROR, \"Maximum number of subtitles streams reached\\VAR_10\");", "VAR_2 = AVERROR(EINVAL);", "goto end;", "}", "st = avformat_new_stream(VAR_0, NULL);", "if (!st) {", "VAR_2 = AVERROR(ENOMEM);", "goto end;", "}", "st->VAR_12 = VAR_11;", "st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;", "st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE;", "avpriv_set_pts_info(st, 64, 1, 1000);", "av_dict_set(&st->metadata, \"language\", VAR_12, 0);", "av_log(VAR_0, AV_LOG_DEBUG, \"IDX stream[%d] VAR_12=%VAR_0\\VAR_10\", VAR_11, VAR_12);", "VAR_3 = 1;", "} else if (st && !strncmp(VAR_8, \"timestamp:\", 10)) {", "AVPacket *sub;", "int VAR_19, VAR_19, VAR_19, VAR_19;", "int64_t pos, timestamp;", "const char *VAR_19 = VAR_8 + 10;", "if (!VAR_0->nb_streams) {", "av_log(VAR_0, AV_LOG_ERROR, \"Timestamp declared before any stream\\VAR_10\");", "VAR_2 = AVERROR_INVALIDDATA;", "goto end;", "}", "if (sscanf(VAR_19, \"%02d:%02d:%02d:%03d, filepos: %\"SCNx64,\n&VAR_19, &VAR_19, &VAR_19, &VAR_19, &pos) != 5) {", "av_log(VAR_0, AV_LOG_ERROR, \"Unable to parse timestamp VAR_8 '%VAR_0', \"\n\"abort parsing\\VAR_10\", VAR_8);", "break;", "}", "timestamp = (VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19 + delay;", "timestamp = av_rescale_q(timestamp, av_make_q(1, 1000), st->time_base);", "sub = ff_subtitles_queue_insert(&vobsub->q[VAR_0->nb_streams - 1], \"\", 0, 0);", "if (!sub) {", "VAR_2 = AVERROR(ENOMEM);", "goto end;", "}", "sub->pos = pos;", "sub->pts = timestamp;", "sub->stream_index = VAR_0->nb_streams - 1;", "} else if (st && !strncmp(VAR_8, \"alt:\", 4)) {", "const char *VAR_19 = VAR_8 + 4;", "while (*VAR_19 == ' ')\nVAR_19++;", "av_dict_set(&st->metadata, \"title\", VAR_19, 0);", "av_log(VAR_0, AV_LOG_DEBUG, \"IDX stream[%d] name=%VAR_0\\VAR_10\", st->VAR_12, VAR_19);", "VAR_3 = 1;", "} else if (!strncmp(VAR_8, \"delay:\", 6)) {", "int VAR_18 = 1, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0, VAR_19 = 0;", "const char *VAR_19 = VAR_8 + 6;", "while (*VAR_19 == ' ')\nVAR_19++;", "if (*VAR_19 == '-' || *VAR_19 == '+') {", "VAR_18 = *VAR_19 == '-' ? -1 : 1;", "VAR_19++;", "}", "sscanf(VAR_19, \"%d:%d:%d:%d\", &VAR_19, &VAR_19, &VAR_19, &VAR_19);", "delay = ((VAR_19*3600LL + VAR_19*60LL + VAR_19) * 1000LL + VAR_19) * VAR_18;", "} else if (!strncmp(VAR_8, \"VAR_4:\", 8)) {", "const char *VAR_19 = VAR_8 + 8;", "if (sscanf(VAR_19, \"%d\", &VAR_4) != 1)\nav_log(VAR_0, AV_LOG_ERROR, \"Invalid VAR_4 specified\\VAR_10\");", "} else if (!VAR_3) {", "if (VAR_8[0] && VAR_8[0] != '#')\nav_bprintf(&header, \"%VAR_0\\VAR_10\", VAR_8);", "}", "}", "if (VAR_4 < VAR_0->nb_streams)\nVAR_0->streams[VAR_4]->disposition |= AV_DISPOSITION_DEFAULT;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "vobsub->q[VAR_1].sort = SUB_SORT_POS_TS;", "ff_subtitles_queue_finalize(&vobsub->q[VAR_1]);", "}", "if (!av_bprint_is_complete(&header)) {", "av_bprint_finalize(&header, NULL);", "VAR_2 = AVERROR(ENOMEM);", "goto end;", "}", "av_bprint_finalize(&header, &VAR_7);", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) {", "AVStream *sub_st = VAR_0->streams[VAR_1];", "sub_st->codec->extradata = av_strdup(VAR_7);", "sub_st->codec->extradata_size = header.VAR_9;", "}", "av_free(VAR_7);", "end:\nav_free(VAR_5);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163, 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 267, 269 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 309, 311 ], [ 313 ], [ 315 ] ]
25,786
QBool *qobject_to_qbool(const QObject *obj) { if (qobject_type(obj) != QTYPE_QBOOL) return NULL; return container_of(obj, QBool, base); }
true
qemu
14b6160099f0caf5dc9d62e637b007bc5d719a96
QBool *qobject_to_qbool(const QObject *obj) { if (qobject_type(obj) != QTYPE_QBOOL) return NULL; return container_of(obj, QBool, base); }
{ "code": [ " if (qobject_type(obj) != QTYPE_QBOOL)" ], "line_no": [ 5 ] }
QBool *FUNC_0(const QObject *obj) { if (qobject_type(obj) != QTYPE_QBOOL) return NULL; return container_of(obj, QBool, base); }
[ "QBool *FUNC_0(const QObject *obj)\n{", "if (qobject_type(obj) != QTYPE_QBOOL)\nreturn NULL;", "return container_of(obj, QBool, base);", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ] ]
25,788
static av_always_inline int mvd_decode(HEVCContext *s) { int ret = 2; int k = 1; while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) { ret += 1 << k; k++; } if (k == CABAC_MAX_BIN) av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); while (k--) ret += get_cabac_bypass(&s->HEVClc->cc) << k; return get_cabac_bypass_sign(&s->HEVClc->cc, -ret); }
true
FFmpeg
d5028f61e44b7607b6a547f218f7d85217490a5b
static av_always_inline int mvd_decode(HEVCContext *s) { int ret = 2; int k = 1; while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) { ret += 1 << k; k++; } if (k == CABAC_MAX_BIN) av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); while (k--) ret += get_cabac_bypass(&s->HEVClc->cc) << k; return get_cabac_bypass_sign(&s->HEVClc->cc, -ret); }
{ "code": [ " ret += 1 << k;", " if (k == CABAC_MAX_BIN)" ], "line_no": [ 13, 19 ] }
static av_always_inline int FUNC_0(HEVCContext *s) { int VAR_0 = 2; int VAR_1 = 1; while (VAR_1 < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) { VAR_0 += 1 << VAR_1; VAR_1++; } if (VAR_1 == CABAC_MAX_BIN) av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", VAR_1); while (VAR_1--) VAR_0 += get_cabac_bypass(&s->HEVClc->cc) << VAR_1; return get_cabac_bypass_sign(&s->HEVClc->cc, -VAR_0); }
[ "static av_always_inline int FUNC_0(HEVCContext *s)\n{", "int VAR_0 = 2;", "int VAR_1 = 1;", "while (VAR_1 < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) {", "VAR_0 += 1 << VAR_1;", "VAR_1++;", "}", "if (VAR_1 == CABAC_MAX_BIN)\nav_log(s->avctx, AV_LOG_ERROR, \"CABAC_MAX_BIN : %d\\n\", VAR_1);", "while (VAR_1--)\nVAR_0 += get_cabac_bypass(&s->HEVClc->cc) << VAR_1;", "return get_cabac_bypass_sign(&s->HEVClc->cc, -VAR_0);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ] ]
25,789
static int handle_hypercall(S390CPU *cpu, struct kvm_run *run) { CPUS390XState *env = &cpu->env; cpu_synchronize_state(CPU(cpu)); env->regs[2] = s390_virtio_hypercall(env); return 0; }
true
qemu
77319f22635e3f0ef86730503b4d18dd9a833529
static int handle_hypercall(S390CPU *cpu, struct kvm_run *run) { CPUS390XState *env = &cpu->env; cpu_synchronize_state(CPU(cpu)); env->regs[2] = s390_virtio_hypercall(env); return 0; }
{ "code": [ " env->regs[2] = s390_virtio_hypercall(env);", " return 0;" ], "line_no": [ 11, 15 ] }
static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1) { CPUS390XState *env = &VAR_0->env; cpu_synchronize_state(CPU(VAR_0)); env->regs[2] = s390_virtio_hypercall(env); return 0; }
[ "static int FUNC_0(S390CPU *VAR_0, struct kvm_run *VAR_1)\n{", "CPUS390XState *env = &VAR_0->env;", "cpu_synchronize_state(CPU(VAR_0));", "env->regs[2] = s390_virtio_hypercall(env);", "return 0;", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
25,790
av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) { MpegEncContext *s = &v->s; int i; int mb_height = FFALIGN(s->mb_height, 2); /* Allocate mb bitplanes */ v->mv_type_mb_plane = av_malloc (s->mb_stride * mb_height); v->direct_mb_plane = av_malloc (s->mb_stride * mb_height); v->forward_mb_plane = av_malloc (s->mb_stride * mb_height); v->fieldtx_plane = av_mallocz(s->mb_stride * mb_height); v->acpred_plane = av_malloc (s->mb_stride * mb_height); v->over_flags_plane = av_malloc (s->mb_stride * mb_height); v->n_allocated_blks = s->mb_width + 2; v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); v->cbp = v->cbp_base + s->mb_stride; v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); v->ttblk = v->ttblk_base + s->mb_stride; v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); v->is_intra = v->is_intra_base + s->mb_stride; v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); v->luma_mv = v->luma_mv_base + s->mb_stride; /* allocate block type info in that way so it could be used with s->block_index[] */ v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; v->mb_type[1] = v->mb_type_base + s->b8_stride * (mb_height * 2 + 1) + s->mb_stride + 1; v->mb_type[2] = v->mb_type[1] + s->mb_stride * (mb_height + 1); /* allocate memory to store block level MV info */ v->blk_mv_type_base = av_mallocz( s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; v->mv_f_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); ff_intrax8_common_init(&v->x8,s); if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { for (i = 0; i < 4; i++) if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1; } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base || !v->mb_type_base) { goto error; } return 0; error: ff_vc1_decode_end(s->avctx); return AVERROR(ENOMEM); }
true
FFmpeg
01f0e6a0c9270f1d5bef08459a6f167cf55e0596
av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) { MpegEncContext *s = &v->s; int i; int mb_height = FFALIGN(s->mb_height, 2); v->mv_type_mb_plane = av_malloc (s->mb_stride * mb_height); v->direct_mb_plane = av_malloc (s->mb_stride * mb_height); v->forward_mb_plane = av_malloc (s->mb_stride * mb_height); v->fieldtx_plane = av_mallocz(s->mb_stride * mb_height); v->acpred_plane = av_malloc (s->mb_stride * mb_height); v->over_flags_plane = av_malloc (s->mb_stride * mb_height); v->n_allocated_blks = s->mb_width + 2; v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); v->cbp = v->cbp_base + s->mb_stride; v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); v->ttblk = v->ttblk_base + s->mb_stride; v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); v->is_intra = v->is_intra_base + s->mb_stride; v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); v->luma_mv = v->luma_mv_base + s->mb_stride; v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; v->mb_type[1] = v->mb_type_base + s->b8_stride * (mb_height * 2 + 1) + s->mb_stride + 1; v->mb_type[2] = v->mb_type[1] + s->mb_stride * (mb_height + 1); v->blk_mv_type_base = av_mallocz( s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; v->mv_f_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); ff_intrax8_common_init(&v->x8,s); if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { for (i = 0; i < 4; i++) if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1; } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base || !v->mb_type_base) { goto error; } return 0; error: ff_vc1_decode_end(s->avctx); return AVERROR(ENOMEM); }
{ "code": [ " for (i = 0; i < 4; i++)", " if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1;" ], "line_no": [ 89, 91 ] }
av_cold int FUNC_0(VC1Context *v) { MpegEncContext *s = &v->s; int VAR_0; int VAR_1 = FFALIGN(s->VAR_1, 2); v->mv_type_mb_plane = av_malloc (s->mb_stride * VAR_1); v->direct_mb_plane = av_malloc (s->mb_stride * VAR_1); v->forward_mb_plane = av_malloc (s->mb_stride * VAR_1); v->fieldtx_plane = av_mallocz(s->mb_stride * VAR_1); v->acpred_plane = av_malloc (s->mb_stride * VAR_1); v->over_flags_plane = av_malloc (s->mb_stride * VAR_1); v->n_allocated_blks = s->mb_width + 2; v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); v->cbp = v->cbp_base + s->mb_stride; v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); v->ttblk = v->ttblk_base + s->mb_stride; v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); v->is_intra = v->is_intra_base + s->mb_stride; v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); v->luma_mv = v->luma_mv_base + s->mb_stride; v->mb_type_base = av_malloc(s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2); v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; v->mb_type[1] = v->mb_type_base + s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride + 1; v->mb_type[2] = v->mb_type[1] + s->mb_stride * (VAR_1 + 1); v->blk_mv_type_base = av_mallocz( s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2); v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; v->mv_f_base = av_mallocz(2 * (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2)); v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2); v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2)); v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2); ff_intrax8_common_init(&v->x8,s); if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { for (VAR_0 = 0; VAR_0 < 4; VAR_0++) if (!(v->sr_rows[VAR_0 >> 1][VAR_0 & 1] = av_malloc(v->output_width))) return -1; } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base || !v->mb_type_base) { goto error; } return 0; error: ff_vc1_decode_end(s->avctx); return AVERROR(ENOMEM); }
[ "av_cold int FUNC_0(VC1Context *v)\n{", "MpegEncContext *s = &v->s;", "int VAR_0;", "int VAR_1 = FFALIGN(s->VAR_1, 2);", "v->mv_type_mb_plane = av_malloc (s->mb_stride * VAR_1);", "v->direct_mb_plane = av_malloc (s->mb_stride * VAR_1);", "v->forward_mb_plane = av_malloc (s->mb_stride * VAR_1);", "v->fieldtx_plane = av_mallocz(s->mb_stride * VAR_1);", "v->acpred_plane = av_malloc (s->mb_stride * VAR_1);", "v->over_flags_plane = av_malloc (s->mb_stride * VAR_1);", "v->n_allocated_blks = s->mb_width + 2;", "v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks);", "v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride);", "v->cbp = v->cbp_base + s->mb_stride;", "v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride);", "v->ttblk = v->ttblk_base + s->mb_stride;", "v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride);", "v->is_intra = v->is_intra_base + s->mb_stride;", "v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride);", "v->luma_mv = v->luma_mv_base + s->mb_stride;", "v->mb_type_base = av_malloc(s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2);", "v->mb_type[0] = v->mb_type_base + s->b8_stride + 1;", "v->mb_type[1] = v->mb_type_base + s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride + 1;", "v->mb_type[2] = v->mb_type[1] + s->mb_stride * (VAR_1 + 1);", "v->blk_mv_type_base = av_mallocz( s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2);", "v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1;", "v->mv_f_base = av_mallocz(2 * (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2));", "v->mv_f[0] = v->mv_f_base + s->b8_stride + 1;", "v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2);", "v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2));", "v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1;", "v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (VAR_1 * 2 + 1) + s->mb_stride * (VAR_1 + 1) * 2);", "ff_intrax8_common_init(&v->x8,s);", "if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {", "for (VAR_0 = 0; VAR_0 < 4; VAR_0++)", "if (!(v->sr_rows[VAR_0 >> 1][VAR_0 & 1] = av_malloc(v->output_width))) return -1;", "}", "if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane ||\n!v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base ||\n!v->mb_type_base) {", "goto error;", "}", "return 0;", "error:\nff_vc1_decode_end(s->avctx);", "return AVERROR(ENOMEM);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99, 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ] ]
25,791
static int vapic_prepare(VAPICROMState *s) { vapic_map_rom_writable(s); if (patch_hypercalls(s) < 0) { return -1; } vapic_enable_tpr_reporting(true); return 0; }
true
qemu
18e5eec4db96a00907eb588a2b803401637c7f67
static int vapic_prepare(VAPICROMState *s) { vapic_map_rom_writable(s); if (patch_hypercalls(s) < 0) { return -1; } vapic_enable_tpr_reporting(true); return 0; }
{ "code": [ " vapic_map_rom_writable(s);" ], "line_no": [ 5 ] }
static int FUNC_0(VAPICROMState *VAR_0) { vapic_map_rom_writable(VAR_0); if (patch_hypercalls(VAR_0) < 0) { return -1; } vapic_enable_tpr_reporting(true); return 0; }
[ "static int FUNC_0(VAPICROMState *VAR_0)\n{", "vapic_map_rom_writable(VAR_0);", "if (patch_hypercalls(VAR_0) < 0) {", "return -1;", "}", "vapic_enable_tpr_reporting(true);", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ] ]
25,792
void ahci_uninit(AHCIState *s) { int i, j; for (i = 0; i < s->ports; i++) { AHCIDevice *ad = &s->dev[i]; for (j = 0; j < 2; j++) { IDEState *s = &ad->port.ifs[j]; ide_exit(s); } } g_free(s->dev); }
true
qemu
955f5c7ba127746345a3d43b4d7c885ca159ae6b
void ahci_uninit(AHCIState *s) { int i, j; for (i = 0; i < s->ports; i++) { AHCIDevice *ad = &s->dev[i]; for (j = 0; j < 2; j++) { IDEState *s = &ad->port.ifs[j]; ide_exit(s); } } g_free(s->dev); }
{ "code": [], "line_no": [] }
void FUNC_0(AHCIState *VAR_0) { int VAR_1, VAR_2; for (VAR_1 = 0; VAR_1 < VAR_0->ports; VAR_1++) { AHCIDevice *ad = &VAR_0->dev[VAR_1]; for (VAR_2 = 0; VAR_2 < 2; VAR_2++) { IDEState *VAR_0 = &ad->port.ifs[VAR_2]; ide_exit(VAR_0); } } g_free(VAR_0->dev); }
[ "void FUNC_0(AHCIState *VAR_0)\n{", "int VAR_1, VAR_2;", "for (VAR_1 = 0; VAR_1 < VAR_0->ports; VAR_1++) {", "AHCIDevice *ad = &VAR_0->dev[VAR_1];", "for (VAR_2 = 0; VAR_2 < 2; VAR_2++) {", "IDEState *VAR_0 = &ad->port.ifs[VAR_2];", "ide_exit(VAR_0);", "}", "}", "g_free(VAR_0->dev);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 26 ], [ 30 ], [ 32 ] ]
25,793
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size; size = RAW_PACKET_SIZE; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); pkt->pos= avio_tell(s->pb); pkt->stream_index = 0; ret = ffio_read_partial(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; } pkt->size = ret; return ret; }
true
FFmpeg
efd6b80b402a54923f007378a7dc5397676a8f3a
int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) { int ret, size; size = RAW_PACKET_SIZE; if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM); pkt->pos= avio_tell(s->pb); pkt->stream_index = 0; ret = ffio_read_partial(s->pb, pkt->data, size); if (ret < 0) { av_free_packet(pkt); return ret; } pkt->size = ret; return ret; }
{ "code": [ " pkt->size = ret;" ], "line_no": [ 33 ] }
int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { int VAR_2, VAR_3; VAR_3 = RAW_PACKET_SIZE; if (av_new_packet(VAR_1, VAR_3) < 0) return AVERROR(ENOMEM); VAR_1->pos= avio_tell(VAR_0->pb); VAR_1->stream_index = 0; VAR_2 = ffio_read_partial(VAR_0->pb, VAR_1->data, VAR_3); if (VAR_2 < 0) { av_free_packet(VAR_1); return VAR_2; } VAR_1->VAR_3 = VAR_2; return VAR_2; }
[ "int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "int VAR_2, VAR_3;", "VAR_3 = RAW_PACKET_SIZE;", "if (av_new_packet(VAR_1, VAR_3) < 0)\nreturn AVERROR(ENOMEM);", "VAR_1->pos= avio_tell(VAR_0->pb);", "VAR_1->stream_index = 0;", "VAR_2 = ffio_read_partial(VAR_0->pb, VAR_1->data, VAR_3);", "if (VAR_2 < 0) {", "av_free_packet(VAR_1);", "return VAR_2;", "}", "VAR_1->VAR_3 = VAR_2;", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
25,794
static inline struct rgbvec interp_tetrahedral(const LUT3DContext *lut3d, const struct rgbvec *s) { const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)}; const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)]; const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)]; const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)]; const struct rgbvec c011 = lut3d->lut[PREV(s->r)][NEXT(s->g)][NEXT(s->b)]; const struct rgbvec c100 = lut3d->lut[NEXT(s->r)][PREV(s->g)][PREV(s->b)]; const struct rgbvec c101 = lut3d->lut[NEXT(s->r)][PREV(s->g)][NEXT(s->b)]; const struct rgbvec c110 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][PREV(s->b)]; const struct rgbvec c111 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][NEXT(s->b)]; struct rgbvec c; if (d.r > d.g) { if (d.g > d.b) { c.r = (1-d.r) * c000.r + (d.r-d.g) * c100.r + (d.g-d.b) * c110.r + (d.b) * c111.r; c.g = (1-d.r) * c000.g + (d.r-d.g) * c100.g + (d.g-d.b) * c110.g + (d.b) * c111.g; c.b = (1-d.r) * c000.b + (d.r-d.g) * c100.b + (d.g-d.b) * c110.b + (d.b) * c111.b; } else if (d.r > d.b) { c.r = (1-d.r) * c000.r + (d.r-d.b) * c100.r + (d.b-d.g) * c101.r + (d.g) * c111.r; c.g = (1-d.r) * c000.g + (d.r-d.b) * c100.g + (d.b-d.g) * c101.g + (d.g) * c111.g; c.b = (1-d.r) * c000.b + (d.r-d.b) * c100.b + (d.b-d.g) * c101.b + (d.g) * c111.b; } else { c.r = (1-d.b) * c000.r + (d.b-d.r) * c001.r + (d.r-d.g) * c101.r + (d.g) * c111.r; c.g = (1-d.b) * c000.g + (d.b-d.r) * c001.g + (d.r-d.g) * c101.g + (d.g) * c111.g; c.b = (1-d.b) * c000.b + (d.b-d.r) * c001.b + (d.r-d.g) * c101.b + (d.g) * c111.b; } } else { if (d.b > d.g) { c.r = (1-d.b) * c000.r + (d.b-d.g) * c001.r + (d.g-d.r) * c011.r + (d.r) * c111.r; c.g = (1-d.b) * c000.g + (d.b-d.g) * c001.g + (d.g-d.r) * c011.g + (d.r) * c111.g; c.b = (1-d.b) * c000.b + (d.b-d.g) * c001.b + (d.g-d.r) * c011.b + (d.r) * c111.b; } else if (d.b > d.r) { c.r = (1-d.g) * c000.r + (d.g-d.b) * c010.r + (d.b-d.r) * c011.r + (d.r) * c111.r; c.g = (1-d.g) * c000.g + (d.g-d.b) * c010.g + (d.b-d.r) * c011.g + (d.r) * c111.g; c.b = (1-d.g) * c000.b + (d.g-d.b) * c010.b + (d.b-d.r) * c011.b + (d.r) * c111.b; } else { c.r = (1-d.g) * c000.r + (d.g-d.r) * c010.r + (d.r-d.b) * c110.r + (d.b) * c111.r; c.g = (1-d.g) * c000.g + (d.g-d.r) * c010.g + (d.r-d.b) * c110.g + (d.b) * c111.g; c.b = (1-d.g) * c000.b + (d.g-d.r) * c010.b + (d.r-d.b) * c110.b + (d.b) * c111.b; } } return c; }
true
FFmpeg
b6ee25e300420a3c98b78a1c2e983250ff065038
static inline struct rgbvec interp_tetrahedral(const LUT3DContext *lut3d, const struct rgbvec *s) { const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)}; const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)]; const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)]; const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)]; const struct rgbvec c011 = lut3d->lut[PREV(s->r)][NEXT(s->g)][NEXT(s->b)]; const struct rgbvec c100 = lut3d->lut[NEXT(s->r)][PREV(s->g)][PREV(s->b)]; const struct rgbvec c101 = lut3d->lut[NEXT(s->r)][PREV(s->g)][NEXT(s->b)]; const struct rgbvec c110 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][PREV(s->b)]; const struct rgbvec c111 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][NEXT(s->b)]; struct rgbvec c; if (d.r > d.g) { if (d.g > d.b) { c.r = (1-d.r) * c000.r + (d.r-d.g) * c100.r + (d.g-d.b) * c110.r + (d.b) * c111.r; c.g = (1-d.r) * c000.g + (d.r-d.g) * c100.g + (d.g-d.b) * c110.g + (d.b) * c111.g; c.b = (1-d.r) * c000.b + (d.r-d.g) * c100.b + (d.g-d.b) * c110.b + (d.b) * c111.b; } else if (d.r > d.b) { c.r = (1-d.r) * c000.r + (d.r-d.b) * c100.r + (d.b-d.g) * c101.r + (d.g) * c111.r; c.g = (1-d.r) * c000.g + (d.r-d.b) * c100.g + (d.b-d.g) * c101.g + (d.g) * c111.g; c.b = (1-d.r) * c000.b + (d.r-d.b) * c100.b + (d.b-d.g) * c101.b + (d.g) * c111.b; } else { c.r = (1-d.b) * c000.r + (d.b-d.r) * c001.r + (d.r-d.g) * c101.r + (d.g) * c111.r; c.g = (1-d.b) * c000.g + (d.b-d.r) * c001.g + (d.r-d.g) * c101.g + (d.g) * c111.g; c.b = (1-d.b) * c000.b + (d.b-d.r) * c001.b + (d.r-d.g) * c101.b + (d.g) * c111.b; } } else { if (d.b > d.g) { c.r = (1-d.b) * c000.r + (d.b-d.g) * c001.r + (d.g-d.r) * c011.r + (d.r) * c111.r; c.g = (1-d.b) * c000.g + (d.b-d.g) * c001.g + (d.g-d.r) * c011.g + (d.r) * c111.g; c.b = (1-d.b) * c000.b + (d.b-d.g) * c001.b + (d.g-d.r) * c011.b + (d.r) * c111.b; } else if (d.b > d.r) { c.r = (1-d.g) * c000.r + (d.g-d.b) * c010.r + (d.b-d.r) * c011.r + (d.r) * c111.r; c.g = (1-d.g) * c000.g + (d.g-d.b) * c010.g + (d.b-d.r) * c011.g + (d.r) * c111.g; c.b = (1-d.g) * c000.b + (d.g-d.b) * c010.b + (d.b-d.r) * c011.b + (d.r) * c111.b; } else { c.r = (1-d.g) * c000.r + (d.g-d.r) * c010.r + (d.r-d.b) * c110.r + (d.b) * c111.r; c.g = (1-d.g) * c000.g + (d.g-d.r) * c010.g + (d.r-d.b) * c110.g + (d.b) * c111.g; c.b = (1-d.g) * c000.b + (d.g-d.r) * c010.b + (d.r-d.b) * c110.b + (d.b) * c111.b; } } return c; }
{ "code": [ " const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)};", " const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)];", " const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)];", " const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)];", " const struct rgbvec c011 = lut3d->lut[PREV(s->r)][NEXT(s->g)][NEXT(s->b)];", " const struct rgbvec c100 = lut3d->lut[NEXT(s->r)][PREV(s->g)][PREV(s->b)];", " const struct rgbvec c101 = lut3d->lut[NEXT(s->r)][PREV(s->g)][NEXT(s->b)];", " const struct rgbvec c110 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][PREV(s->b)];", " const struct rgbvec c111 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][NEXT(s->b)];", " const struct rgbvec d = {s->r - PREV(s->r), s->g - PREV(s->g), s->b - PREV(s->b)};", " const struct rgbvec c000 = lut3d->lut[PREV(s->r)][PREV(s->g)][PREV(s->b)];", " const struct rgbvec c001 = lut3d->lut[PREV(s->r)][PREV(s->g)][NEXT(s->b)];", " const struct rgbvec c010 = lut3d->lut[PREV(s->r)][NEXT(s->g)][PREV(s->b)];", " const struct rgbvec c011 = lut3d->lut[PREV(s->r)][NEXT(s->g)][NEXT(s->b)];", " const struct rgbvec c100 = lut3d->lut[NEXT(s->r)][PREV(s->g)][PREV(s->b)];", " const struct rgbvec c101 = lut3d->lut[NEXT(s->r)][PREV(s->g)][NEXT(s->b)];", " const struct rgbvec c110 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][PREV(s->b)];", " const struct rgbvec c111 = lut3d->lut[NEXT(s->r)][NEXT(s->g)][NEXT(s->b)];" ], "line_no": [ 7, 9, 11, 13, 15, 17, 19, 21, 23, 7, 9, 11, 13, 15, 17, 19, 21, 23 ] }
static inline struct rgbvec FUNC_0(const LUT3DContext *VAR_0, const struct rgbvec *VAR_1) { const struct rgbvec VAR_2 = {VAR_1->r - PREV(VAR_1->r), VAR_1->g - PREV(VAR_1->g), VAR_1->b - PREV(VAR_1->b)}; const struct rgbvec VAR_3 = VAR_0->lut[PREV(VAR_1->r)][PREV(VAR_1->g)][PREV(VAR_1->b)]; const struct rgbvec VAR_4 = VAR_0->lut[PREV(VAR_1->r)][PREV(VAR_1->g)][NEXT(VAR_1->b)]; const struct rgbvec VAR_5 = VAR_0->lut[PREV(VAR_1->r)][NEXT(VAR_1->g)][PREV(VAR_1->b)]; const struct rgbvec VAR_6 = VAR_0->lut[PREV(VAR_1->r)][NEXT(VAR_1->g)][NEXT(VAR_1->b)]; const struct rgbvec VAR_7 = VAR_0->lut[NEXT(VAR_1->r)][PREV(VAR_1->g)][PREV(VAR_1->b)]; const struct rgbvec VAR_8 = VAR_0->lut[NEXT(VAR_1->r)][PREV(VAR_1->g)][NEXT(VAR_1->b)]; const struct rgbvec VAR_9 = VAR_0->lut[NEXT(VAR_1->r)][NEXT(VAR_1->g)][PREV(VAR_1->b)]; const struct rgbvec VAR_10 = VAR_0->lut[NEXT(VAR_1->r)][NEXT(VAR_1->g)][NEXT(VAR_1->b)]; struct rgbvec VAR_11; if (VAR_2.r > VAR_2.g) { if (VAR_2.g > VAR_2.b) { VAR_11.r = (1-VAR_2.r) * VAR_3.r + (VAR_2.r-VAR_2.g) * VAR_7.r + (VAR_2.g-VAR_2.b) * VAR_9.r + (VAR_2.b) * VAR_10.r; VAR_11.g = (1-VAR_2.r) * VAR_3.g + (VAR_2.r-VAR_2.g) * VAR_7.g + (VAR_2.g-VAR_2.b) * VAR_9.g + (VAR_2.b) * VAR_10.g; VAR_11.b = (1-VAR_2.r) * VAR_3.b + (VAR_2.r-VAR_2.g) * VAR_7.b + (VAR_2.g-VAR_2.b) * VAR_9.b + (VAR_2.b) * VAR_10.b; } else if (VAR_2.r > VAR_2.b) { VAR_11.r = (1-VAR_2.r) * VAR_3.r + (VAR_2.r-VAR_2.b) * VAR_7.r + (VAR_2.b-VAR_2.g) * VAR_8.r + (VAR_2.g) * VAR_10.r; VAR_11.g = (1-VAR_2.r) * VAR_3.g + (VAR_2.r-VAR_2.b) * VAR_7.g + (VAR_2.b-VAR_2.g) * VAR_8.g + (VAR_2.g) * VAR_10.g; VAR_11.b = (1-VAR_2.r) * VAR_3.b + (VAR_2.r-VAR_2.b) * VAR_7.b + (VAR_2.b-VAR_2.g) * VAR_8.b + (VAR_2.g) * VAR_10.b; } else { VAR_11.r = (1-VAR_2.b) * VAR_3.r + (VAR_2.b-VAR_2.r) * VAR_4.r + (VAR_2.r-VAR_2.g) * VAR_8.r + (VAR_2.g) * VAR_10.r; VAR_11.g = (1-VAR_2.b) * VAR_3.g + (VAR_2.b-VAR_2.r) * VAR_4.g + (VAR_2.r-VAR_2.g) * VAR_8.g + (VAR_2.g) * VAR_10.g; VAR_11.b = (1-VAR_2.b) * VAR_3.b + (VAR_2.b-VAR_2.r) * VAR_4.b + (VAR_2.r-VAR_2.g) * VAR_8.b + (VAR_2.g) * VAR_10.b; } } else { if (VAR_2.b > VAR_2.g) { VAR_11.r = (1-VAR_2.b) * VAR_3.r + (VAR_2.b-VAR_2.g) * VAR_4.r + (VAR_2.g-VAR_2.r) * VAR_6.r + (VAR_2.r) * VAR_10.r; VAR_11.g = (1-VAR_2.b) * VAR_3.g + (VAR_2.b-VAR_2.g) * VAR_4.g + (VAR_2.g-VAR_2.r) * VAR_6.g + (VAR_2.r) * VAR_10.g; VAR_11.b = (1-VAR_2.b) * VAR_3.b + (VAR_2.b-VAR_2.g) * VAR_4.b + (VAR_2.g-VAR_2.r) * VAR_6.b + (VAR_2.r) * VAR_10.b; } else if (VAR_2.b > VAR_2.r) { VAR_11.r = (1-VAR_2.g) * VAR_3.r + (VAR_2.g-VAR_2.b) * VAR_5.r + (VAR_2.b-VAR_2.r) * VAR_6.r + (VAR_2.r) * VAR_10.r; VAR_11.g = (1-VAR_2.g) * VAR_3.g + (VAR_2.g-VAR_2.b) * VAR_5.g + (VAR_2.b-VAR_2.r) * VAR_6.g + (VAR_2.r) * VAR_10.g; VAR_11.b = (1-VAR_2.g) * VAR_3.b + (VAR_2.g-VAR_2.b) * VAR_5.b + (VAR_2.b-VAR_2.r) * VAR_6.b + (VAR_2.r) * VAR_10.b; } else { VAR_11.r = (1-VAR_2.g) * VAR_3.r + (VAR_2.g-VAR_2.r) * VAR_5.r + (VAR_2.r-VAR_2.b) * VAR_9.r + (VAR_2.b) * VAR_10.r; VAR_11.g = (1-VAR_2.g) * VAR_3.g + (VAR_2.g-VAR_2.r) * VAR_5.g + (VAR_2.r-VAR_2.b) * VAR_9.g + (VAR_2.b) * VAR_10.g; VAR_11.b = (1-VAR_2.g) * VAR_3.b + (VAR_2.g-VAR_2.r) * VAR_5.b + (VAR_2.r-VAR_2.b) * VAR_9.b + (VAR_2.b) * VAR_10.b; } } return VAR_11; }
[ "static inline struct rgbvec FUNC_0(const LUT3DContext *VAR_0,\nconst struct rgbvec *VAR_1)\n{", "const struct rgbvec VAR_2 = {VAR_1->r - PREV(VAR_1->r), VAR_1->g - PREV(VAR_1->g), VAR_1->b - PREV(VAR_1->b)};", "const struct rgbvec VAR_3 = VAR_0->lut[PREV(VAR_1->r)][PREV(VAR_1->g)][PREV(VAR_1->b)];", "const struct rgbvec VAR_4 = VAR_0->lut[PREV(VAR_1->r)][PREV(VAR_1->g)][NEXT(VAR_1->b)];", "const struct rgbvec VAR_5 = VAR_0->lut[PREV(VAR_1->r)][NEXT(VAR_1->g)][PREV(VAR_1->b)];", "const struct rgbvec VAR_6 = VAR_0->lut[PREV(VAR_1->r)][NEXT(VAR_1->g)][NEXT(VAR_1->b)];", "const struct rgbvec VAR_7 = VAR_0->lut[NEXT(VAR_1->r)][PREV(VAR_1->g)][PREV(VAR_1->b)];", "const struct rgbvec VAR_8 = VAR_0->lut[NEXT(VAR_1->r)][PREV(VAR_1->g)][NEXT(VAR_1->b)];", "const struct rgbvec VAR_9 = VAR_0->lut[NEXT(VAR_1->r)][NEXT(VAR_1->g)][PREV(VAR_1->b)];", "const struct rgbvec VAR_10 = VAR_0->lut[NEXT(VAR_1->r)][NEXT(VAR_1->g)][NEXT(VAR_1->b)];", "struct rgbvec VAR_11;", "if (VAR_2.r > VAR_2.g) {", "if (VAR_2.g > VAR_2.b) {", "VAR_11.r = (1-VAR_2.r) * VAR_3.r + (VAR_2.r-VAR_2.g) * VAR_7.r + (VAR_2.g-VAR_2.b) * VAR_9.r + (VAR_2.b) * VAR_10.r;", "VAR_11.g = (1-VAR_2.r) * VAR_3.g + (VAR_2.r-VAR_2.g) * VAR_7.g + (VAR_2.g-VAR_2.b) * VAR_9.g + (VAR_2.b) * VAR_10.g;", "VAR_11.b = (1-VAR_2.r) * VAR_3.b + (VAR_2.r-VAR_2.g) * VAR_7.b + (VAR_2.g-VAR_2.b) * VAR_9.b + (VAR_2.b) * VAR_10.b;", "} else if (VAR_2.r > VAR_2.b) {", "VAR_11.r = (1-VAR_2.r) * VAR_3.r + (VAR_2.r-VAR_2.b) * VAR_7.r + (VAR_2.b-VAR_2.g) * VAR_8.r + (VAR_2.g) * VAR_10.r;", "VAR_11.g = (1-VAR_2.r) * VAR_3.g + (VAR_2.r-VAR_2.b) * VAR_7.g + (VAR_2.b-VAR_2.g) * VAR_8.g + (VAR_2.g) * VAR_10.g;", "VAR_11.b = (1-VAR_2.r) * VAR_3.b + (VAR_2.r-VAR_2.b) * VAR_7.b + (VAR_2.b-VAR_2.g) * VAR_8.b + (VAR_2.g) * VAR_10.b;", "} else {", "VAR_11.r = (1-VAR_2.b) * VAR_3.r + (VAR_2.b-VAR_2.r) * VAR_4.r + (VAR_2.r-VAR_2.g) * VAR_8.r + (VAR_2.g) * VAR_10.r;", "VAR_11.g = (1-VAR_2.b) * VAR_3.g + (VAR_2.b-VAR_2.r) * VAR_4.g + (VAR_2.r-VAR_2.g) * VAR_8.g + (VAR_2.g) * VAR_10.g;", "VAR_11.b = (1-VAR_2.b) * VAR_3.b + (VAR_2.b-VAR_2.r) * VAR_4.b + (VAR_2.r-VAR_2.g) * VAR_8.b + (VAR_2.g) * VAR_10.b;", "}", "} else {", "if (VAR_2.b > VAR_2.g) {", "VAR_11.r = (1-VAR_2.b) * VAR_3.r + (VAR_2.b-VAR_2.g) * VAR_4.r + (VAR_2.g-VAR_2.r) * VAR_6.r + (VAR_2.r) * VAR_10.r;", "VAR_11.g = (1-VAR_2.b) * VAR_3.g + (VAR_2.b-VAR_2.g) * VAR_4.g + (VAR_2.g-VAR_2.r) * VAR_6.g + (VAR_2.r) * VAR_10.g;", "VAR_11.b = (1-VAR_2.b) * VAR_3.b + (VAR_2.b-VAR_2.g) * VAR_4.b + (VAR_2.g-VAR_2.r) * VAR_6.b + (VAR_2.r) * VAR_10.b;", "} else if (VAR_2.b > VAR_2.r) {", "VAR_11.r = (1-VAR_2.g) * VAR_3.r + (VAR_2.g-VAR_2.b) * VAR_5.r + (VAR_2.b-VAR_2.r) * VAR_6.r + (VAR_2.r) * VAR_10.r;", "VAR_11.g = (1-VAR_2.g) * VAR_3.g + (VAR_2.g-VAR_2.b) * VAR_5.g + (VAR_2.b-VAR_2.r) * VAR_6.g + (VAR_2.r) * VAR_10.g;", "VAR_11.b = (1-VAR_2.g) * VAR_3.b + (VAR_2.g-VAR_2.b) * VAR_5.b + (VAR_2.b-VAR_2.r) * VAR_6.b + (VAR_2.r) * VAR_10.b;", "} else {", "VAR_11.r = (1-VAR_2.g) * VAR_3.r + (VAR_2.g-VAR_2.r) * VAR_5.r + (VAR_2.r-VAR_2.b) * VAR_9.r + (VAR_2.b) * VAR_10.r;", "VAR_11.g = (1-VAR_2.g) * VAR_3.g + (VAR_2.g-VAR_2.r) * VAR_5.g + (VAR_2.r-VAR_2.b) * VAR_9.g + (VAR_2.b) * VAR_10.g;", "VAR_11.b = (1-VAR_2.g) * VAR_3.b + (VAR_2.g-VAR_2.r) * VAR_5.b + (VAR_2.r-VAR_2.b) * VAR_9.b + (VAR_2.b) * VAR_10.b;", "}", "}", "return VAR_11;", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ] ]
25,795
static av_cold int nvenc_setup_device(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; CUresult cu_res; CUcontext cu_context_curr; switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_H264_GUID; break; case AV_CODEC_ID_HEVC: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_HEVC_GUID; break; default: return AVERROR_BUG; } ctx->data_pix_fmt = avctx->pix_fmt; #if CONFIG_CUDA if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { AVHWFramesContext *frames_ctx; AVCUDADeviceContext *device_hwctx; if (!avctx->hw_frames_ctx) { av_log(avctx, AV_LOG_ERROR, "hw_frames_ctx must be set when using GPU frames as input\n"); return AVERROR(EINVAL); } frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; device_hwctx = frames_ctx->device_ctx->hwctx; ctx->cu_context = device_hwctx->cuda_ctx; ctx->data_pix_fmt = frames_ctx->sw_format; return 0; } #endif if (ctx->gpu >= dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "Requested GPU %d, but only %d GPUs are available!\n", ctx->gpu, dl_fn->nvenc_device_count); return AVERROR(EINVAL); } ctx->cu_context = NULL; cu_res = dl_fn->cu_ctx_create(&ctx->cu_context_internal, 4, dl_fn->nvenc_devices[ctx->gpu]); // CU_CTX_SCHED_BLOCKING_SYNC=4, avoid CPU spins if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed creating CUDA context for NVENC: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } cu_res = dl_fn->cu_ctx_pop_current(&cu_context_curr); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed popping CUDA context: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } ctx->cu_context = ctx->cu_context_internal; return 0; }
false
FFmpeg
0d021cc8b30a6f81c27fbeca7f99f1ee7a20acf8
static av_cold int nvenc_setup_device(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; CUresult cu_res; CUcontext cu_context_curr; switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_H264_GUID; break; case AV_CODEC_ID_HEVC: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_HEVC_GUID; break; default: return AVERROR_BUG; } ctx->data_pix_fmt = avctx->pix_fmt; #if CONFIG_CUDA if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { AVHWFramesContext *frames_ctx; AVCUDADeviceContext *device_hwctx; if (!avctx->hw_frames_ctx) { av_log(avctx, AV_LOG_ERROR, "hw_frames_ctx must be set when using GPU frames as input\n"); return AVERROR(EINVAL); } frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; device_hwctx = frames_ctx->device_ctx->hwctx; ctx->cu_context = device_hwctx->cuda_ctx; ctx->data_pix_fmt = frames_ctx->sw_format; return 0; } #endif if (ctx->gpu >= dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "Requested GPU %d, but only %d GPUs are available!\n", ctx->gpu, dl_fn->nvenc_device_count); return AVERROR(EINVAL); } ctx->cu_context = NULL; cu_res = dl_fn->cu_ctx_create(&ctx->cu_context_internal, 4, dl_fn->nvenc_devices[ctx->gpu]); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed creating CUDA context for NVENC: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } cu_res = dl_fn->cu_ctx_pop_current(&cu_context_curr); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed popping CUDA context: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } ctx->cu_context = ctx->cu_context_internal; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { NvencContext *ctx = avctx->priv_data; NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs; CUresult cu_res; CUcontext cu_context_curr; switch (avctx->codec->id) { case AV_CODEC_ID_H264: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_H264_GUID; break; case AV_CODEC_ID_HEVC: ctx->init_encode_params.encodeGUID = NV_ENC_CODEC_HEVC_GUID; break; default: return AVERROR_BUG; } ctx->data_pix_fmt = avctx->pix_fmt; #if CONFIG_CUDA if (avctx->pix_fmt == AV_PIX_FMT_CUDA) { AVHWFramesContext *frames_ctx; AVCUDADeviceContext *device_hwctx; if (!avctx->hw_frames_ctx) { av_log(avctx, AV_LOG_ERROR, "hw_frames_ctx must be set when using GPU frames as input\n"); return AVERROR(EINVAL); } frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; device_hwctx = frames_ctx->device_ctx->hwctx; ctx->cu_context = device_hwctx->cuda_ctx; ctx->data_pix_fmt = frames_ctx->sw_format; return 0; } #endif if (ctx->gpu >= dl_fn->nvenc_device_count) { av_log(avctx, AV_LOG_FATAL, "Requested GPU %d, but only %d GPUs are available!\n", ctx->gpu, dl_fn->nvenc_device_count); return AVERROR(EINVAL); } ctx->cu_context = NULL; cu_res = dl_fn->cu_ctx_create(&ctx->cu_context_internal, 4, dl_fn->nvenc_devices[ctx->gpu]); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed creating CUDA context for NVENC: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } cu_res = dl_fn->cu_ctx_pop_current(&cu_context_curr); if (cu_res != CUDA_SUCCESS) { av_log(avctx, AV_LOG_FATAL, "Failed popping CUDA context: 0x%x\n", (int)cu_res); return AVERROR_EXTERNAL; } ctx->cu_context = ctx->cu_context_internal; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "NvencContext *ctx = avctx->priv_data;", "NvencDynLoadFunctions *dl_fn = &ctx->nvenc_dload_funcs;", "CUresult cu_res;", "CUcontext cu_context_curr;", "switch (avctx->codec->id) {", "case AV_CODEC_ID_H264:\nctx->init_encode_params.encodeGUID = NV_ENC_CODEC_H264_GUID;", "break;", "case AV_CODEC_ID_HEVC:\nctx->init_encode_params.encodeGUID = NV_ENC_CODEC_HEVC_GUID;", "break;", "default:\nreturn AVERROR_BUG;", "}", "ctx->data_pix_fmt = avctx->pix_fmt;", "#if CONFIG_CUDA\nif (avctx->pix_fmt == AV_PIX_FMT_CUDA) {", "AVHWFramesContext *frames_ctx;", "AVCUDADeviceContext *device_hwctx;", "if (!avctx->hw_frames_ctx) {", "av_log(avctx, AV_LOG_ERROR, \"hw_frames_ctx must be set when using GPU frames as input\\n\");", "return AVERROR(EINVAL);", "}", "frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;", "device_hwctx = frames_ctx->device_ctx->hwctx;", "ctx->cu_context = device_hwctx->cuda_ctx;", "ctx->data_pix_fmt = frames_ctx->sw_format;", "return 0;", "}", "#endif\nif (ctx->gpu >= dl_fn->nvenc_device_count) {", "av_log(avctx, AV_LOG_FATAL, \"Requested GPU %d, but only %d GPUs are available!\\n\", ctx->gpu, dl_fn->nvenc_device_count);", "return AVERROR(EINVAL);", "}", "ctx->cu_context = NULL;", "cu_res = dl_fn->cu_ctx_create(&ctx->cu_context_internal, 4, dl_fn->nvenc_devices[ctx->gpu]);", "if (cu_res != CUDA_SUCCESS) {", "av_log(avctx, AV_LOG_FATAL, \"Failed creating CUDA context for NVENC: 0x%x\\n\", (int)cu_res);", "return AVERROR_EXTERNAL;", "}", "cu_res = dl_fn->cu_ctx_pop_current(&cu_context_curr);", "if (cu_res != CUDA_SUCCESS) {", "av_log(avctx, AV_LOG_FATAL, \"Failed popping CUDA context: 0x%x\\n\", (int)cu_res);", "return AVERROR_EXTERNAL;", "}", "ctx->cu_context = ctx->cu_context_internal;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123 ], [ 125 ] ]
25,796
static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c) { GetBitContext *gb = &ctx->gb; ALSChannelData *current = cd; unsigned int channels = ctx->avctx->channels; int entries = 0; while (entries < channels && !(current->stop_flag = get_bits1(gb))) { current->master_channel = get_bits_long(gb, av_ceil_log2(channels)); if (current->master_channel >= channels) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n"); return -1; } if (current->master_channel != c) { current->time_diff_flag = get_bits1(gb); current->weighting[0] = als_weighting(gb, 1, 16); current->weighting[1] = als_weighting(gb, 2, 14); current->weighting[2] = als_weighting(gb, 1, 16); if (current->time_diff_flag) { current->weighting[3] = als_weighting(gb, 1, 16); current->weighting[4] = als_weighting(gb, 1, 16); current->weighting[5] = als_weighting(gb, 1, 16); current->time_diff_sign = get_bits1(gb); current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3; } } current++; entries++; } if (entries == channels) { av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n"); return -1; } align_get_bits(gb); return 0; }
true
FFmpeg
ca488ad480360dfafcb5766f7bfbb567a0638979
static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c) { GetBitContext *gb = &ctx->gb; ALSChannelData *current = cd; unsigned int channels = ctx->avctx->channels; int entries = 0; while (entries < channels && !(current->stop_flag = get_bits1(gb))) { current->master_channel = get_bits_long(gb, av_ceil_log2(channels)); if (current->master_channel >= channels) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid master channel!\n"); return -1; } if (current->master_channel != c) { current->time_diff_flag = get_bits1(gb); current->weighting[0] = als_weighting(gb, 1, 16); current->weighting[1] = als_weighting(gb, 2, 14); current->weighting[2] = als_weighting(gb, 1, 16); if (current->time_diff_flag) { current->weighting[3] = als_weighting(gb, 1, 16); current->weighting[4] = als_weighting(gb, 1, 16); current->weighting[5] = als_weighting(gb, 1, 16); current->time_diff_sign = get_bits1(gb); current->time_diff_index = get_bits(gb, ctx->ltp_lag_length - 3) + 3; } } current++; entries++; } if (entries == channels) { av_log(ctx->avctx, AV_LOG_ERROR, "Damaged channel data!\n"); return -1; } align_get_bits(gb); return 0; }
{ "code": [ " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return 0;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;", " return -1;" ], "line_no": [ 75, 75, 75, 25, 75, 75, 75, 25, 75, 25, 83, 75, 25, 25, 25, 75, 75, 75, 75, 75 ] }
static int FUNC_0(ALSDecContext *VAR_0, ALSChannelData *VAR_1, int VAR_2) { GetBitContext *gb = &VAR_0->gb; ALSChannelData *current = VAR_1; unsigned int VAR_3 = VAR_0->avctx->VAR_3; int VAR_4 = 0; while (VAR_4 < VAR_3 && !(current->stop_flag = get_bits1(gb))) { current->master_channel = get_bits_long(gb, av_ceil_log2(VAR_3)); if (current->master_channel >= VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid master channel!\n"); return -1; } if (current->master_channel != VAR_2) { current->time_diff_flag = get_bits1(gb); current->weighting[0] = als_weighting(gb, 1, 16); current->weighting[1] = als_weighting(gb, 2, 14); current->weighting[2] = als_weighting(gb, 1, 16); if (current->time_diff_flag) { current->weighting[3] = als_weighting(gb, 1, 16); current->weighting[4] = als_weighting(gb, 1, 16); current->weighting[5] = als_weighting(gb, 1, 16); current->time_diff_sign = get_bits1(gb); current->time_diff_index = get_bits(gb, VAR_0->ltp_lag_length - 3) + 3; } } current++; VAR_4++; } if (VAR_4 == VAR_3) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Damaged channel data!\n"); return -1; } align_get_bits(gb); return 0; }
[ "static int FUNC_0(ALSDecContext *VAR_0, ALSChannelData *VAR_1, int VAR_2)\n{", "GetBitContext *gb = &VAR_0->gb;", "ALSChannelData *current = VAR_1;", "unsigned int VAR_3 = VAR_0->avctx->VAR_3;", "int VAR_4 = 0;", "while (VAR_4 < VAR_3 && !(current->stop_flag = get_bits1(gb))) {", "current->master_channel = get_bits_long(gb, av_ceil_log2(VAR_3));", "if (current->master_channel >= VAR_3) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid master channel!\\n\");", "return -1;", "}", "if (current->master_channel != VAR_2) {", "current->time_diff_flag = get_bits1(gb);", "current->weighting[0] = als_weighting(gb, 1, 16);", "current->weighting[1] = als_weighting(gb, 2, 14);", "current->weighting[2] = als_weighting(gb, 1, 16);", "if (current->time_diff_flag) {", "current->weighting[3] = als_weighting(gb, 1, 16);", "current->weighting[4] = als_weighting(gb, 1, 16);", "current->weighting[5] = als_weighting(gb, 1, 16);", "current->time_diff_sign = get_bits1(gb);", "current->time_diff_index = get_bits(gb, VAR_0->ltp_lag_length - 3) + 3;", "}", "}", "current++;", "VAR_4++;", "}", "if (VAR_4 == VAR_3) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Damaged channel data!\\n\");", "return -1;", "}", "align_get_bits(gb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ] ]
25,797
static void cpu_unregister_map_client(void *_client) { MapClient *client = (MapClient *)_client; QLIST_REMOVE(client, link); g_free(client); }
true
qemu
e95205e1f9cd2c4262b7a7b1c992a94512c86d0e
static void cpu_unregister_map_client(void *_client) { MapClient *client = (MapClient *)_client; QLIST_REMOVE(client, link); g_free(client); }
{ "code": [ "static void cpu_unregister_map_client(void *_client)", " MapClient *client = (MapClient *)_client;", " QLIST_REMOVE(client, link);", " g_free(client);" ], "line_no": [ 1, 5, 9, 11 ] }
static void FUNC_0(void *VAR_0) { MapClient *client = (MapClient *)VAR_0; QLIST_REMOVE(client, link); g_free(client); }
[ "static void FUNC_0(void *VAR_0)\n{", "MapClient *client = (MapClient *)VAR_0;", "QLIST_REMOVE(client, link);", "g_free(client);", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
25,798
static int rv34_decoder_alloc(RV34DecContext *r) { r->intra_types_stride = r->s.mb_width * 4 + 4; r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma)); r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma)); r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs)); r->intra_types_hist = av_malloc(r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist)); r->mb_type = av_mallocz(r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type)); if (!(r->cbp_chroma && r->cbp_luma && r->deblock_coefs && r->intra_types_hist && r->mb_type)) { rv34_decoder_free(r); return AVERROR(ENOMEM); } r->intra_types = r->intra_types_hist + r->intra_types_stride * 4; return 0; }
true
FFmpeg
ea1e630c47e70672a7933c048090601ce09c8195
static int rv34_decoder_alloc(RV34DecContext *r) { r->intra_types_stride = r->s.mb_width * 4 + 4; r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_chroma)); r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->cbp_luma)); r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height * sizeof(*r->deblock_coefs)); r->intra_types_hist = av_malloc(r->intra_types_stride * 4 * 2 * sizeof(*r->intra_types_hist)); r->mb_type = av_mallocz(r->s.mb_stride * r->s.mb_height * sizeof(*r->mb_type)); if (!(r->cbp_chroma && r->cbp_luma && r->deblock_coefs && r->intra_types_hist && r->mb_type)) { rv34_decoder_free(r); return AVERROR(ENOMEM); } r->intra_types = r->intra_types_hist + r->intra_types_stride * 4; return 0; }
{ "code": [ " r->cbp_chroma = av_malloc(r->s.mb_stride * r->s.mb_height *", " r->cbp_luma = av_malloc(r->s.mb_stride * r->s.mb_height *", " r->deblock_coefs = av_malloc(r->s.mb_stride * r->s.mb_height *" ], "line_no": [ 9, 13, 17 ] }
static int FUNC_0(RV34DecContext *VAR_0) { VAR_0->intra_types_stride = VAR_0->s.mb_width * 4 + 4; VAR_0->cbp_chroma = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height * sizeof(*VAR_0->cbp_chroma)); VAR_0->cbp_luma = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height * sizeof(*VAR_0->cbp_luma)); VAR_0->deblock_coefs = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height * sizeof(*VAR_0->deblock_coefs)); VAR_0->intra_types_hist = av_malloc(VAR_0->intra_types_stride * 4 * 2 * sizeof(*VAR_0->intra_types_hist)); VAR_0->mb_type = av_mallocz(VAR_0->s.mb_stride * VAR_0->s.mb_height * sizeof(*VAR_0->mb_type)); if (!(VAR_0->cbp_chroma && VAR_0->cbp_luma && VAR_0->deblock_coefs && VAR_0->intra_types_hist && VAR_0->mb_type)) { rv34_decoder_free(VAR_0); return AVERROR(ENOMEM); } VAR_0->intra_types = VAR_0->intra_types_hist + VAR_0->intra_types_stride * 4; return 0; }
[ "static int FUNC_0(RV34DecContext *VAR_0)\n{", "VAR_0->intra_types_stride = VAR_0->s.mb_width * 4 + 4;", "VAR_0->cbp_chroma = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height *\nsizeof(*VAR_0->cbp_chroma));", "VAR_0->cbp_luma = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height *\nsizeof(*VAR_0->cbp_luma));", "VAR_0->deblock_coefs = av_malloc(VAR_0->s.mb_stride * VAR_0->s.mb_height *\nsizeof(*VAR_0->deblock_coefs));", "VAR_0->intra_types_hist = av_malloc(VAR_0->intra_types_stride * 4 * 2 *\nsizeof(*VAR_0->intra_types_hist));", "VAR_0->mb_type = av_mallocz(VAR_0->s.mb_stride * VAR_0->s.mb_height *\nsizeof(*VAR_0->mb_type));", "if (!(VAR_0->cbp_chroma && VAR_0->cbp_luma && VAR_0->deblock_coefs &&\nVAR_0->intra_types_hist && VAR_0->mb_type)) {", "rv34_decoder_free(VAR_0);", "return AVERROR(ENOMEM);", "}", "VAR_0->intra_types = VAR_0->intra_types_hist + VAR_0->intra_types_stride * 4;", "return 0;", "}" ]
[ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ] ]
25,799
static int dvbsub_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { DVBSubParseContext *pc = s->priv_data; uint8_t *p, *p_end; int i, len, buf_pos = 0; av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); for (i=0; i < buf_size; i++) { av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16 != 0) av_dlog(avctx, "\n"); *poutbuf = NULL; *poutbuf_size = 0; s->fetch_timestamp = 1; if (s->last_pts != s->pts && s->pts != AV_NOPTS_VALUE) /* Start of a new packet */ { if (pc->packet_index != pc->packet_start) { av_dlog(avctx, "Discarding %d bytes\n", pc->packet_index - pc->packet_start); } pc->packet_start = 0; pc->packet_index = 0; if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) { av_dlog(avctx, "Bad packet header\n"); return -1; } buf_pos = 2; pc->in_packet = 1; } else { if (pc->packet_start != 0) { if (pc->packet_index != pc->packet_start) { memmove(pc->packet_buf, pc->packet_buf + pc->packet_start, pc->packet_index - pc->packet_start); pc->packet_index -= pc->packet_start; pc->packet_start = 0; } else { pc->packet_start = 0; pc->packet_index = 0; } } } if (buf_size - buf_pos + pc->packet_index > PARSE_BUF_SIZE) return -1; /* if not currently in a packet, discard data */ if (pc->in_packet == 0) return buf_size; memcpy(pc->packet_buf + pc->packet_index, buf + buf_pos, buf_size - buf_pos); pc->packet_index += buf_size - buf_pos; p = pc->packet_buf; p_end = pc->packet_buf + pc->packet_index; while (p < p_end) { if (*p == 0x0f) { if (p + 6 <= p_end) { len = AV_RB16(p + 4); if (p + len + 6 <= p_end) { *poutbuf_size += len + 6; p += len + 6; } else break; } else break; } else if (*p == 0xff) { if (p + 1 < p_end) { av_dlog(avctx, "Junk at end of packet\n"); } pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } else { av_log(avctx, AV_LOG_ERROR, "Junk in packet\n"); pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } } if (*poutbuf_size > 0) { *poutbuf = pc->packet_buf; pc->packet_start = *poutbuf_size; } if (s->pts == AV_NOPTS_VALUE) s->pts = s->last_pts; return buf_size; }
true
FFmpeg
de41d5372faa4ad7ad439e71975fc6f4ea0c0efc
static int dvbsub_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { DVBSubParseContext *pc = s->priv_data; uint8_t *p, *p_end; int i, len, buf_pos = 0; av_dlog(avctx, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", s->pts, s->last_pts, s->cur_frame_pts[s->cur_frame_start_index]); for (i=0; i < buf_size; i++) { av_dlog(avctx, "%02x ", buf[i]); if (i % 16 == 15) av_dlog(avctx, "\n"); } if (i % 16 != 0) av_dlog(avctx, "\n"); *poutbuf = NULL; *poutbuf_size = 0; s->fetch_timestamp = 1; if (s->last_pts != s->pts && s->pts != AV_NOPTS_VALUE) { if (pc->packet_index != pc->packet_start) { av_dlog(avctx, "Discarding %d bytes\n", pc->packet_index - pc->packet_start); } pc->packet_start = 0; pc->packet_index = 0; if (buf_size < 2 || buf[0] != 0x20 || buf[1] != 0x00) { av_dlog(avctx, "Bad packet header\n"); return -1; } buf_pos = 2; pc->in_packet = 1; } else { if (pc->packet_start != 0) { if (pc->packet_index != pc->packet_start) { memmove(pc->packet_buf, pc->packet_buf + pc->packet_start, pc->packet_index - pc->packet_start); pc->packet_index -= pc->packet_start; pc->packet_start = 0; } else { pc->packet_start = 0; pc->packet_index = 0; } } } if (buf_size - buf_pos + pc->packet_index > PARSE_BUF_SIZE) return -1; if (pc->in_packet == 0) return buf_size; memcpy(pc->packet_buf + pc->packet_index, buf + buf_pos, buf_size - buf_pos); pc->packet_index += buf_size - buf_pos; p = pc->packet_buf; p_end = pc->packet_buf + pc->packet_index; while (p < p_end) { if (*p == 0x0f) { if (p + 6 <= p_end) { len = AV_RB16(p + 4); if (p + len + 6 <= p_end) { *poutbuf_size += len + 6; p += len + 6; } else break; } else break; } else if (*p == 0xff) { if (p + 1 < p_end) { av_dlog(avctx, "Junk at end of packet\n"); } pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } else { av_log(avctx, AV_LOG_ERROR, "Junk in packet\n"); pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } } if (*poutbuf_size > 0) { *poutbuf = pc->packet_buf; pc->packet_start = *poutbuf_size; } if (s->pts == AV_NOPTS_VALUE) s->pts = s->last_pts; return buf_size; }
{ "code": [ " if (p + 6 <= p_end)", " if (p + len + 6 <= p_end)", " if (p + 1 < p_end)" ], "line_no": [ 161, 169, 189 ] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { DVBSubParseContext *pc = VAR_0->priv_data; uint8_t *p, *p_end; int VAR_6, VAR_7, VAR_8 = 0; av_dlog(VAR_1, "DVB parse packet pts=%"PRIx64", lpts=%"PRIx64", cpts=%"PRIx64":\n", VAR_0->pts, VAR_0->last_pts, VAR_0->cur_frame_pts[VAR_0->cur_frame_start_index]); for (VAR_6=0; VAR_6 < VAR_5; VAR_6++) { av_dlog(VAR_1, "%02x ", VAR_4[VAR_6]); if (VAR_6 % 16 == 15) av_dlog(VAR_1, "\n"); } if (VAR_6 % 16 != 0) av_dlog(VAR_1, "\n"); *VAR_2 = NULL; *VAR_3 = 0; VAR_0->fetch_timestamp = 1; if (VAR_0->last_pts != VAR_0->pts && VAR_0->pts != AV_NOPTS_VALUE) { if (pc->packet_index != pc->packet_start) { av_dlog(VAR_1, "Discarding %d bytes\n", pc->packet_index - pc->packet_start); } pc->packet_start = 0; pc->packet_index = 0; if (VAR_5 < 2 || VAR_4[0] != 0x20 || VAR_4[1] != 0x00) { av_dlog(VAR_1, "Bad packet header\n"); return -1; } VAR_8 = 2; pc->in_packet = 1; } else { if (pc->packet_start != 0) { if (pc->packet_index != pc->packet_start) { memmove(pc->packet_buf, pc->packet_buf + pc->packet_start, pc->packet_index - pc->packet_start); pc->packet_index -= pc->packet_start; pc->packet_start = 0; } else { pc->packet_start = 0; pc->packet_index = 0; } } } if (VAR_5 - VAR_8 + pc->packet_index > PARSE_BUF_SIZE) return -1; if (pc->in_packet == 0) return VAR_5; memcpy(pc->packet_buf + pc->packet_index, VAR_4 + VAR_8, VAR_5 - VAR_8); pc->packet_index += VAR_5 - VAR_8; p = pc->packet_buf; p_end = pc->packet_buf + pc->packet_index; while (p < p_end) { if (*p == 0x0f) { if (p + 6 <= p_end) { VAR_7 = AV_RB16(p + 4); if (p + VAR_7 + 6 <= p_end) { *VAR_3 += VAR_7 + 6; p += VAR_7 + 6; } else break; } else break; } else if (*p == 0xff) { if (p + 1 < p_end) { av_dlog(VAR_1, "Junk at end of packet\n"); } pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } else { av_log(VAR_1, AV_LOG_ERROR, "Junk in packet\n"); pc->packet_index = p - pc->packet_buf; pc->in_packet = 0; break; } } if (*VAR_3 > 0) { *VAR_2 = pc->packet_buf; pc->packet_start = *VAR_3; } if (VAR_0->pts == AV_NOPTS_VALUE) VAR_0->pts = VAR_0->last_pts; return VAR_5; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "DVBSubParseContext *pc = VAR_0->priv_data;", "uint8_t *p, *p_end;", "int VAR_6, VAR_7, VAR_8 = 0;", "av_dlog(VAR_1, \"DVB parse packet pts=%\"PRIx64\", lpts=%\"PRIx64\", cpts=%\"PRIx64\":\\n\",\nVAR_0->pts, VAR_0->last_pts, VAR_0->cur_frame_pts[VAR_0->cur_frame_start_index]);", "for (VAR_6=0; VAR_6 < VAR_5; VAR_6++)", "{", "av_dlog(VAR_1, \"%02x \", VAR_4[VAR_6]);", "if (VAR_6 % 16 == 15)\nav_dlog(VAR_1, \"\\n\");", "}", "if (VAR_6 % 16 != 0)\nav_dlog(VAR_1, \"\\n\");", "*VAR_2 = NULL;", "*VAR_3 = 0;", "VAR_0->fetch_timestamp = 1;", "if (VAR_0->last_pts != VAR_0->pts && VAR_0->pts != AV_NOPTS_VALUE)\n{", "if (pc->packet_index != pc->packet_start)\n{", "av_dlog(VAR_1, \"Discarding %d bytes\\n\",\npc->packet_index - pc->packet_start);", "}", "pc->packet_start = 0;", "pc->packet_index = 0;", "if (VAR_5 < 2 || VAR_4[0] != 0x20 || VAR_4[1] != 0x00) {", "av_dlog(VAR_1, \"Bad packet header\\n\");", "return -1;", "}", "VAR_8 = 2;", "pc->in_packet = 1;", "} else {", "if (pc->packet_start != 0)\n{", "if (pc->packet_index != pc->packet_start)\n{", "memmove(pc->packet_buf, pc->packet_buf + pc->packet_start,\npc->packet_index - pc->packet_start);", "pc->packet_index -= pc->packet_start;", "pc->packet_start = 0;", "} else {", "pc->packet_start = 0;", "pc->packet_index = 0;", "}", "}", "}", "if (VAR_5 - VAR_8 + pc->packet_index > PARSE_BUF_SIZE)\nreturn -1;", "if (pc->in_packet == 0)\nreturn VAR_5;", "memcpy(pc->packet_buf + pc->packet_index, VAR_4 + VAR_8, VAR_5 - VAR_8);", "pc->packet_index += VAR_5 - VAR_8;", "p = pc->packet_buf;", "p_end = pc->packet_buf + pc->packet_index;", "while (p < p_end)\n{", "if (*p == 0x0f)\n{", "if (p + 6 <= p_end)\n{", "VAR_7 = AV_RB16(p + 4);", "if (p + VAR_7 + 6 <= p_end)\n{", "*VAR_3 += VAR_7 + 6;", "p += VAR_7 + 6;", "} else", "break;", "} else", "break;", "} else if (*p == 0xff) {", "if (p + 1 < p_end)\n{", "av_dlog(VAR_1, \"Junk at end of packet\\n\");", "}", "pc->packet_index = p - pc->packet_buf;", "pc->in_packet = 0;", "break;", "} else {", "av_log(VAR_1, AV_LOG_ERROR, \"Junk in packet\\n\");", "pc->packet_index = p - pc->packet_buf;", "pc->in_packet = 0;", "break;", "}", "}", "if (*VAR_3 > 0)\n{", "*VAR_2 = pc->packet_buf;", "pc->packet_start = *VAR_3;", "}", "if (VAR_0->pts == AV_NOPTS_VALUE)\nVAR_0->pts = VAR_0->last_pts;", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 51 ], [ 55, 57 ], [ 59, 61 ], [ 63, 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 135, 137 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157, 159 ], [ 161, 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 239 ], [ 241 ] ]
25,800
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta) { int isv34, unsync; unsigned tlen; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; const ID3v2EMFunc *extra_func = NULL; unsigned char *uncompressed_buffer = NULL; int uncompressed_buffer_size = 0; av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len); switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */ int extlen = get_size(s->pb, 4); if (version == 4) /* In v2.4 the length includes the length field we just read. */ extlen -= 4; if (extlen < 0) { reason = "invalid extended header length"; goto error; } avio_skip(s->pb, extlen); len -= extlen + 4; if (len < 0) { reason = "extended header too long."; goto error; } } while (len >= taghdrlen) { unsigned int tflags = 0; int tunsync = 0; int tcomp = 0; int tencr = 0; unsigned long dlen; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if (version == 3) { tlen = avio_rb32(s->pb); } else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } if (tlen > (1<<28)) break; len -= taghdrlen + tlen; if (len < 0) break; next = avio_tell(s->pb) + tlen; if (!tlen) { if (tag[0]) av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", tag); continue; } if (tflags & ID3v2_FLAG_DATALEN) { if (tlen < 4) break; dlen = avio_rb32(s->pb); tlen -= 4; } else dlen = tlen; tcomp = tflags & ID3v2_FLAG_COMPRESSION; tencr = tflags & ID3v2_FLAG_ENCRYPTION; /* skip encrypted tags and, if no zlib, compressed tags */ if (tencr || (!CONFIG_ZLIB && tcomp)) { const char *type; if (!tcomp) type = "encrypted"; else if (!tencr) type = "compressed"; else type = "encrypted and compressed"; av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag); avio_skip(s->pb, tlen); /* check for text tag or supported special meta tag */ } else if (tag[0] == 'T' || (extra_meta && (extra_func = get_extra_meta_func(tag, isv34)))) { pbx = s->pb; if (unsync || tunsync || tcomp) { av_fast_malloc(&buffer, &buffer_size, tlen); if (!buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen); goto seek; } } if (unsync || tunsync) { int64_t end = avio_tell(s->pb) + tlen; uint8_t *b; b = buffer; while (avio_tell(s->pb) < end && b - buffer < tlen && !s->pb->eof_reached) { *b++ = avio_r8(s->pb); if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 && b - buffer < tlen && !s->pb->eof_reached ) { uint8_t val = avio_r8(s->pb); *b++ = val ? val : avio_r8(s->pb); } } ffio_init_context(&pb, buffer, b - buffer, 0, NULL, NULL, NULL, NULL); tlen = b - buffer; pbx = &pb; // read from sync buffer } #if CONFIG_ZLIB if (tcomp) { int err; av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen); av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen); if (!uncompressed_buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen); goto seek; } if (!(unsync || tunsync)) { err = avio_read(s->pb, buffer, tlen); if (err < 0) { av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n"); goto seek; } tlen = err; } err = uncompress(uncompressed_buffer, &dlen, buffer, tlen); if (err != Z_OK) { av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err); goto seek; } ffio_init_context(&pb, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL); tlen = dlen; pbx = &pb; // read from sync buffer } #endif if (tag[0] == 'T') /* parse text tag */ read_ttag(s, pbx, tlen, &s->metadata, tag); else /* parse special meta tag */ extra_func->read(s, pbx, tlen, tag, extra_meta); } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n"); avio_skip(s->pb, tlen); break; } /* Skip to end of tag */ seek: avio_seek(s->pb, next, SEEK_SET); } /* Footer preset, always 10 bytes, skip over it */ if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); av_free(uncompressed_buffer); return; }
true
FFmpeg
0e0f6bd4a5796f4f668092d7925a31b9b30fedd4
static void id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags, ID3v2ExtraMeta **extra_meta) { int isv34, unsync; unsigned tlen; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *buffer = NULL; int buffer_size = 0; const ID3v2EMFunc *extra_func = NULL; unsigned char *uncompressed_buffer = NULL; int uncompressed_buffer_size = 0; av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len); switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; break; case 3: case 4: isv34 = 1; taghdrlen = 10; break; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) { int extlen = get_size(s->pb, 4); if (version == 4) extlen -= 4; if (extlen < 0) { reason = "invalid extended header length"; goto error; } avio_skip(s->pb, extlen); len -= extlen + 4; if (len < 0) { reason = "extended header too long."; goto error; } } while (len >= taghdrlen) { unsigned int tflags = 0; int tunsync = 0; int tcomp = 0; int tencr = 0; unsigned long dlen; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if (version == 3) { tlen = avio_rb32(s->pb); } else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } if (tlen > (1<<28)) break; len -= taghdrlen + tlen; if (len < 0) break; next = avio_tell(s->pb) + tlen; if (!tlen) { if (tag[0]) av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", tag); continue; } if (tflags & ID3v2_FLAG_DATALEN) { if (tlen < 4) break; dlen = avio_rb32(s->pb); tlen -= 4; } else dlen = tlen; tcomp = tflags & ID3v2_FLAG_COMPRESSION; tencr = tflags & ID3v2_FLAG_ENCRYPTION; if (tencr || (!CONFIG_ZLIB && tcomp)) { const char *type; if (!tcomp) type = "encrypted"; else if (!tencr) type = "compressed"; else type = "encrypted and compressed"; av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T' || (extra_meta && (extra_func = get_extra_meta_func(tag, isv34)))) { pbx = s->pb; if (unsync || tunsync || tcomp) { av_fast_malloc(&buffer, &buffer_size, tlen); if (!buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen); goto seek; } } if (unsync || tunsync) { int64_t end = avio_tell(s->pb) + tlen; uint8_t *b; b = buffer; while (avio_tell(s->pb) < end && b - buffer < tlen && !s->pb->eof_reached) { *b++ = avio_r8(s->pb); if (*(b - 1) == 0xff && avio_tell(s->pb) < end - 1 && b - buffer < tlen && !s->pb->eof_reached ) { uint8_t val = avio_r8(s->pb); *b++ = val ? val : avio_r8(s->pb); } } ffio_init_context(&pb, buffer, b - buffer, 0, NULL, NULL, NULL, NULL); tlen = b - buffer; pbx = &pb; } #if CONFIG_ZLIB if (tcomp) { int err; av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen); av_fast_malloc(&uncompressed_buffer, &uncompressed_buffer_size, dlen); if (!uncompressed_buffer) { av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen); goto seek; } if (!(unsync || tunsync)) { err = avio_read(s->pb, buffer, tlen); if (err < 0) { av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n"); goto seek; } tlen = err; } err = uncompress(uncompressed_buffer, &dlen, buffer, tlen); if (err != Z_OK) { av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err); goto seek; } ffio_init_context(&pb, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL); tlen = dlen; pbx = &pb; } #endif if (tag[0] == 'T') read_ttag(s, pbx, tlen, &s->metadata, tag); else extra_func->read(s, pbx, tlen, tag, extra_meta); } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n"); avio_skip(s->pb, tlen); break; } seek: avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); av_free(uncompressed_buffer); return; }
{ "code": [ " avio_read(s->pb, tag, 4);", " avio_read(s->pb, tag, 3);" ], "line_no": [ 137, 155 ] }
static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2, uint8_t VAR_3, ID3v2ExtraMeta **VAR_4) { int VAR_5, VAR_6; unsigned VAR_7; char VAR_8[5]; int64_t next, end = avio_tell(VAR_0->pb) + VAR_1; int VAR_9; const char *VAR_10 = NULL; AVIOContext pb; AVIOContext *pbx; unsigned char *VAR_11 = NULL; int VAR_12 = 0; const ID3v2EMFunc *VAR_13 = NULL; unsigned char *VAR_14 = NULL; int VAR_15 = 0; av_log(VAR_0, AV_LOG_DEBUG, "id3v2 ver:%d VAR_3:%02X VAR_1:%d\n", VAR_2, VAR_3, VAR_1); switch (VAR_2) { case 2: if (VAR_3 & 0x40) { VAR_10 = "compression"; goto error; } VAR_5 = 0; VAR_9 = 6; break; case 3: case 4: VAR_5 = 1; VAR_9 = 10; break; default: VAR_10 = "VAR_2"; goto error; } VAR_6 = VAR_3 & 0x80; if (VAR_5 && VAR_3 & 0x40) { int VAR_16 = get_size(VAR_0->pb, 4); if (VAR_2 == 4) VAR_16 -= 4; if (VAR_16 < 0) { VAR_10 = "invalid extended header length"; goto error; } avio_skip(VAR_0->pb, VAR_16); VAR_1 -= VAR_16 + 4; if (VAR_1 < 0) { VAR_10 = "extended header too long."; goto error; } } while (VAR_1 >= VAR_9) { unsigned int VAR_17 = 0; int VAR_18 = 0; int VAR_19 = 0; int VAR_20 = 0; unsigned long VAR_21; if (VAR_5) { avio_read(VAR_0->pb, VAR_8, 4); VAR_8[4] = 0; if (VAR_2 == 3) { VAR_7 = avio_rb32(VAR_0->pb); } else VAR_7 = get_size(VAR_0->pb, 4); VAR_17 = avio_rb16(VAR_0->pb); VAR_18 = VAR_17 & ID3v2_FLAG_UNSYNCH; } else { avio_read(VAR_0->pb, VAR_8, 3); VAR_8[3] = 0; VAR_7 = avio_rb24(VAR_0->pb); } if (VAR_7 > (1<<28)) break; VAR_1 -= VAR_9 + VAR_7; if (VAR_1 < 0) break; next = avio_tell(VAR_0->pb) + VAR_7; if (!VAR_7) { if (VAR_8[0]) av_log(VAR_0, AV_LOG_DEBUG, "Invalid empty frame %VAR_0, skipping.\n", VAR_8); continue; } if (VAR_17 & ID3v2_FLAG_DATALEN) { if (VAR_7 < 4) break; VAR_21 = avio_rb32(VAR_0->pb); VAR_7 -= 4; } else VAR_21 = VAR_7; VAR_19 = VAR_17 & ID3v2_FLAG_COMPRESSION; VAR_20 = VAR_17 & ID3v2_FLAG_ENCRYPTION; if (VAR_20 || (!CONFIG_ZLIB && VAR_19)) { const char *VAR_22; if (!VAR_19) VAR_22 = "encrypted"; else if (!VAR_20) VAR_22 = "compressed"; else VAR_22 = "encrypted and compressed"; av_log(VAR_0, AV_LOG_WARNING, "Skipping %VAR_0 ID3v2 frame %VAR_0.\n", VAR_22, VAR_8); avio_skip(VAR_0->pb, VAR_7); } else if (VAR_8[0] == 'T' || (VAR_4 && (VAR_13 = get_extra_meta_func(VAR_8, VAR_5)))) { pbx = VAR_0->pb; if (VAR_6 || VAR_18 || VAR_19) { av_fast_malloc(&VAR_11, &VAR_12, VAR_7); if (!VAR_11) { av_log(VAR_0, AV_LOG_ERROR, "Failed to alloc %d bytes\n", VAR_7); goto seek; } } if (VAR_6 || VAR_18) { int64_t end = avio_tell(VAR_0->pb) + VAR_7; uint8_t *b; b = VAR_11; while (avio_tell(VAR_0->pb) < end && b - VAR_11 < VAR_7 && !VAR_0->pb->eof_reached) { *b++ = avio_r8(VAR_0->pb); if (*(b - 1) == 0xff && avio_tell(VAR_0->pb) < end - 1 && b - VAR_11 < VAR_7 && !VAR_0->pb->eof_reached ) { uint8_t val = avio_r8(VAR_0->pb); *b++ = val ? val : avio_r8(VAR_0->pb); } } ffio_init_context(&pb, VAR_11, b - VAR_11, 0, NULL, NULL, NULL, NULL); VAR_7 = b - VAR_11; pbx = &pb; } #if CONFIG_ZLIB if (VAR_19) { int err; av_log(VAR_0, AV_LOG_DEBUG, "Compresssed frame %VAR_0 VAR_7=%d VAR_21=%ld\n", VAR_8, VAR_7, VAR_21); av_fast_malloc(&VAR_14, &VAR_15, VAR_21); if (!VAR_14) { av_log(VAR_0, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", VAR_21); goto seek; } if (!(VAR_6 || VAR_18)) { err = avio_read(VAR_0->pb, VAR_11, VAR_7); if (err < 0) { av_log(VAR_0, AV_LOG_ERROR, "Failed to read compressed VAR_8\n"); goto seek; } VAR_7 = err; } err = uncompress(VAR_14, &VAR_21, VAR_11, VAR_7); if (err != Z_OK) { av_log(VAR_0, AV_LOG_ERROR, "Failed to uncompress VAR_8: %d\n", err); goto seek; } ffio_init_context(&pb, VAR_14, VAR_21, 0, NULL, NULL, NULL, NULL); VAR_7 = VAR_21; pbx = &pb; } #endif if (VAR_8[0] == 'T') read_ttag(VAR_0, pbx, VAR_7, &VAR_0->metadata, VAR_8); else VAR_13->read(VAR_0, pbx, VAR_7, VAR_8, VAR_4); } else if (!VAR_8[0]) { if (VAR_8[1]) av_log(VAR_0, AV_LOG_WARNING, "invalid frame id, assuming padding\n"); avio_skip(VAR_0->pb, VAR_7); break; } seek: avio_seek(VAR_0->pb, next, SEEK_SET); } if (VAR_2 == 4 && VAR_3 & 0x10) end += 10; error: if (VAR_10) av_log(VAR_0, AV_LOG_INFO, "ID3v2.%d VAR_8 skipped, cannot handle %VAR_0\n", VAR_2, VAR_10); avio_seek(VAR_0->pb, end, SEEK_SET); av_free(VAR_11); av_free(VAR_14); return; }
[ "static void FUNC_0(AVFormatContext *VAR_0, int VAR_1, uint8_t VAR_2,\nuint8_t VAR_3, ID3v2ExtraMeta **VAR_4)\n{", "int VAR_5, VAR_6;", "unsigned VAR_7;", "char VAR_8[5];", "int64_t next, end = avio_tell(VAR_0->pb) + VAR_1;", "int VAR_9;", "const char *VAR_10 = NULL;", "AVIOContext pb;", "AVIOContext *pbx;", "unsigned char *VAR_11 = NULL;", "int VAR_12 = 0;", "const ID3v2EMFunc *VAR_13 = NULL;", "unsigned char *VAR_14 = NULL;", "int VAR_15 = 0;", "av_log(VAR_0, AV_LOG_DEBUG, \"id3v2 ver:%d VAR_3:%02X VAR_1:%d\\n\", VAR_2, VAR_3, VAR_1);", "switch (VAR_2) {", "case 2:\nif (VAR_3 & 0x40) {", "VAR_10 = \"compression\";", "goto error;", "}", "VAR_5 = 0;", "VAR_9 = 6;", "break;", "case 3:\ncase 4:\nVAR_5 = 1;", "VAR_9 = 10;", "break;", "default:\nVAR_10 = \"VAR_2\";", "goto error;", "}", "VAR_6 = VAR_3 & 0x80;", "if (VAR_5 && VAR_3 & 0x40) {", "int VAR_16 = get_size(VAR_0->pb, 4);", "if (VAR_2 == 4)\nVAR_16 -= 4;", "if (VAR_16 < 0) {", "VAR_10 = \"invalid extended header length\";", "goto error;", "}", "avio_skip(VAR_0->pb, VAR_16);", "VAR_1 -= VAR_16 + 4;", "if (VAR_1 < 0) {", "VAR_10 = \"extended header too long.\";", "goto error;", "}", "}", "while (VAR_1 >= VAR_9) {", "unsigned int VAR_17 = 0;", "int VAR_18 = 0;", "int VAR_19 = 0;", "int VAR_20 = 0;", "unsigned long VAR_21;", "if (VAR_5) {", "avio_read(VAR_0->pb, VAR_8, 4);", "VAR_8[4] = 0;", "if (VAR_2 == 3) {", "VAR_7 = avio_rb32(VAR_0->pb);", "} else", "VAR_7 = get_size(VAR_0->pb, 4);", "VAR_17 = avio_rb16(VAR_0->pb);", "VAR_18 = VAR_17 & ID3v2_FLAG_UNSYNCH;", "} else {", "avio_read(VAR_0->pb, VAR_8, 3);", "VAR_8[3] = 0;", "VAR_7 = avio_rb24(VAR_0->pb);", "}", "if (VAR_7 > (1<<28))\nbreak;", "VAR_1 -= VAR_9 + VAR_7;", "if (VAR_1 < 0)\nbreak;", "next = avio_tell(VAR_0->pb) + VAR_7;", "if (!VAR_7) {", "if (VAR_8[0])\nav_log(VAR_0, AV_LOG_DEBUG, \"Invalid empty frame %VAR_0, skipping.\\n\",\nVAR_8);", "continue;", "}", "if (VAR_17 & ID3v2_FLAG_DATALEN) {", "if (VAR_7 < 4)\nbreak;", "VAR_21 = avio_rb32(VAR_0->pb);", "VAR_7 -= 4;", "} else", "VAR_21 = VAR_7;", "VAR_19 = VAR_17 & ID3v2_FLAG_COMPRESSION;", "VAR_20 = VAR_17 & ID3v2_FLAG_ENCRYPTION;", "if (VAR_20 || (!CONFIG_ZLIB && VAR_19)) {", "const char *VAR_22;", "if (!VAR_19)\nVAR_22 = \"encrypted\";", "else if (!VAR_20)\nVAR_22 = \"compressed\";", "else\nVAR_22 = \"encrypted and compressed\";", "av_log(VAR_0, AV_LOG_WARNING, \"Skipping %VAR_0 ID3v2 frame %VAR_0.\\n\", VAR_22, VAR_8);", "avio_skip(VAR_0->pb, VAR_7);", "} else if (VAR_8[0] == 'T' ||", "(VAR_4 &&\n(VAR_13 = get_extra_meta_func(VAR_8, VAR_5)))) {", "pbx = VAR_0->pb;", "if (VAR_6 || VAR_18 || VAR_19) {", "av_fast_malloc(&VAR_11, &VAR_12, VAR_7);", "if (!VAR_11) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to alloc %d bytes\\n\", VAR_7);", "goto seek;", "}", "}", "if (VAR_6 || VAR_18) {", "int64_t end = avio_tell(VAR_0->pb) + VAR_7;", "uint8_t *b;", "b = VAR_11;", "while (avio_tell(VAR_0->pb) < end && b - VAR_11 < VAR_7 && !VAR_0->pb->eof_reached) {", "*b++ = avio_r8(VAR_0->pb);", "if (*(b - 1) == 0xff && avio_tell(VAR_0->pb) < end - 1 &&\nb - VAR_11 < VAR_7 &&\n!VAR_0->pb->eof_reached ) {", "uint8_t val = avio_r8(VAR_0->pb);", "*b++ = val ? val : avio_r8(VAR_0->pb);", "}", "}", "ffio_init_context(&pb, VAR_11, b - VAR_11, 0, NULL, NULL, NULL,\nNULL);", "VAR_7 = b - VAR_11;", "pbx = &pb;", "}", "#if CONFIG_ZLIB\nif (VAR_19) {", "int err;", "av_log(VAR_0, AV_LOG_DEBUG, \"Compresssed frame %VAR_0 VAR_7=%d VAR_21=%ld\\n\", VAR_8, VAR_7, VAR_21);", "av_fast_malloc(&VAR_14, &VAR_15, VAR_21);", "if (!VAR_14) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to alloc %ld bytes\\n\", VAR_21);", "goto seek;", "}", "if (!(VAR_6 || VAR_18)) {", "err = avio_read(VAR_0->pb, VAR_11, VAR_7);", "if (err < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to read compressed VAR_8\\n\");", "goto seek;", "}", "VAR_7 = err;", "}", "err = uncompress(VAR_14, &VAR_21, VAR_11, VAR_7);", "if (err != Z_OK) {", "av_log(VAR_0, AV_LOG_ERROR, \"Failed to uncompress VAR_8: %d\\n\", err);", "goto seek;", "}", "ffio_init_context(&pb, VAR_14, VAR_21, 0, NULL, NULL, NULL, NULL);", "VAR_7 = VAR_21;", "pbx = &pb;", "}", "#endif\nif (VAR_8[0] == 'T')\nread_ttag(VAR_0, pbx, VAR_7, &VAR_0->metadata, VAR_8);", "else\nVAR_13->read(VAR_0, pbx, VAR_7, VAR_8, VAR_4);", "} else if (!VAR_8[0]) {", "if (VAR_8[1])\nav_log(VAR_0, AV_LOG_WARNING, \"invalid frame id, assuming padding\\n\");", "avio_skip(VAR_0->pb, VAR_7);", "break;", "}", "seek:\navio_seek(VAR_0->pb, next, SEEK_SET);", "}", "if (VAR_2 == 4 && VAR_3 & 0x10)\nend += 10;", "error:\nif (VAR_10)\nav_log(VAR_0, AV_LOG_INFO, \"ID3v2.%d VAR_8 skipped, cannot handle %VAR_0\\n\",\nVAR_2, VAR_10);", "avio_seek(VAR_0->pb, end, SEEK_SET);", "av_free(VAR_11);", "av_free(VAR_14);", "return;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61, 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 171, 173 ], [ 177 ], [ 181 ], [ 183, 185, 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227, 229 ], [ 231, 233 ], [ 237 ], [ 239 ], [ 243 ], [ 245, 247 ], [ 249 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 283, 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295, 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307, 309 ], [ 311 ], [ 315 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367, 369, 373 ], [ 375, 379 ], [ 381 ], [ 383, 385 ], [ 387 ], [ 389 ], [ 391 ], [ 395, 397 ], [ 399 ], [ 405, 407 ], [ 411, 413, 415, 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ] ]
25,801
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, int ecpl, int start_subband, int end_subband, const uint8_t *default_band_struct, uint8_t *band_struct, int *num_subbands, int *num_bands, uint8_t *band_sizes) { int subbnd, bnd, n_subbands, n_bands; uint8_t bnd_sz[22]; n_subbands = end_subband - start_subband; /* decode band structure from bitstream or use default */ if (!eac3 || get_bits1(gbc)) { for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) { band_struct[subbnd] = get_bits1(gbc); } } else if (!blk) { memcpy(band_struct, &default_band_struct[start_subband+1], n_subbands-1); } band_struct[n_subbands-1] = 0; /* calculate number of bands and band sizes based on band structure. note that the first 4 subbands in enhanced coupling span only 6 bins instead of 12. */ if (num_bands || band_sizes ) { n_bands = n_subbands; bnd_sz[0] = ecpl ? 6 : 12; for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) { int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12; if (band_struct[subbnd-1]) { n_bands--; bnd_sz[bnd] += subbnd_size; } else { bnd_sz[++bnd] = subbnd_size; } } } /* set optional output params */ if (num_subbands) *num_subbands = n_subbands; if (num_bands) *num_bands = n_bands; if (band_sizes) memcpy(band_sizes, bnd_sz, n_bands); }
true
FFmpeg
f23dc1e1f9ee3a00db951d3dec7d5bfb0e04dae8
static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, int ecpl, int start_subband, int end_subband, const uint8_t *default_band_struct, uint8_t *band_struct, int *num_subbands, int *num_bands, uint8_t *band_sizes) { int subbnd, bnd, n_subbands, n_bands; uint8_t bnd_sz[22]; n_subbands = end_subband - start_subband; if (!eac3 || get_bits1(gbc)) { for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) { band_struct[subbnd] = get_bits1(gbc); } } else if (!blk) { memcpy(band_struct, &default_band_struct[start_subband+1], n_subbands-1); } band_struct[n_subbands-1] = 0; if (num_bands || band_sizes ) { n_bands = n_subbands; bnd_sz[0] = ecpl ? 6 : 12; for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) { int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12; if (band_struct[subbnd-1]) { n_bands--; bnd_sz[bnd] += subbnd_size; } else { bnd_sz[++bnd] = subbnd_size; } } } if (num_subbands) *num_subbands = n_subbands; if (num_bands) *num_bands = n_bands; if (band_sizes) memcpy(band_sizes, bnd_sz, n_bands); }
{ "code": [ " int subbnd, bnd, n_subbands, n_bands;" ], "line_no": [ 13 ] }
static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, const uint8_t *VAR_6, uint8_t *VAR_7, int *VAR_8, int *VAR_9, uint8_t *VAR_10) { int VAR_11, VAR_12, VAR_13, VAR_14; uint8_t bnd_sz[22]; VAR_13 = VAR_5 - VAR_4; if (!VAR_2 || get_bits1(VAR_0)) { for (VAR_11 = 0; VAR_11 < VAR_13 - 1; VAR_11++) { VAR_7[VAR_11] = get_bits1(VAR_0); } } else if (!VAR_1) { memcpy(VAR_7, &VAR_6[VAR_4+1], VAR_13-1); } VAR_7[VAR_13-1] = 0; if (VAR_9 || VAR_10 ) { VAR_14 = VAR_13; bnd_sz[0] = VAR_3 ? 6 : 12; for (VAR_12 = 0, VAR_11 = 1; VAR_11 < VAR_13; VAR_11++) { int VAR_15 = (VAR_3 && VAR_11 < 4) ? 6 : 12; if (VAR_7[VAR_11-1]) { VAR_14--; bnd_sz[VAR_12] += VAR_15; } else { bnd_sz[++VAR_12] = VAR_15; } } } if (VAR_8) *VAR_8 = VAR_13; if (VAR_9) *VAR_9 = VAR_14; if (VAR_10) memcpy(VAR_10, bnd_sz, VAR_14); }
[ "static void FUNC_0(GetBitContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4, int VAR_5,\nconst uint8_t *VAR_6,\nuint8_t *VAR_7, int *VAR_8,\nint *VAR_9, uint8_t *VAR_10)\n{", "int VAR_11, VAR_12, VAR_13, VAR_14;", "uint8_t bnd_sz[22];", "VAR_13 = VAR_5 - VAR_4;", "if (!VAR_2 || get_bits1(VAR_0)) {", "for (VAR_11 = 0; VAR_11 < VAR_13 - 1; VAR_11++) {", "VAR_7[VAR_11] = get_bits1(VAR_0);", "}", "} else if (!VAR_1) {", "memcpy(VAR_7,\n&VAR_6[VAR_4+1],\nVAR_13-1);", "}", "VAR_7[VAR_13-1] = 0;", "if (VAR_9 || VAR_10 ) {", "VAR_14 = VAR_13;", "bnd_sz[0] = VAR_3 ? 6 : 12;", "for (VAR_12 = 0, VAR_11 = 1; VAR_11 < VAR_13; VAR_11++) {", "int VAR_15 = (VAR_3 && VAR_11 < 4) ? 6 : 12;", "if (VAR_7[VAR_11-1]) {", "VAR_14--;", "bnd_sz[VAR_12] += VAR_15;", "} else {", "bnd_sz[++VAR_12] = VAR_15;", "}", "}", "}", "if (VAR_8)\n*VAR_8 = VAR_13;", "if (VAR_9)\n*VAR_9 = VAR_14;", "if (VAR_10)\nmemcpy(VAR_10, bnd_sz, VAR_14);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 95 ] ]
25,802
static void dump_iterate(DumpState *s, Error **errp) { GuestPhysBlock *block; int64_t size; int ret; Error *local_err = NULL; while (1) { block = s->next_block; size = block->target_end - block->target_start; if (s->has_filter) { size -= s->start; if (s->begin + s->length < block->target_end) { size -= block->target_end - (s->begin + s->length); } } write_memory(s, block, s->start, size, &local_err); if (local_err) { error_propagate(errp, local_err); return; } ret = get_next_block(s, block); if (ret == 1) { dump_completed(s); } } }
true
qemu
08a655be71d0a130a5d9bf7816d096ec31c4f055
static void dump_iterate(DumpState *s, Error **errp) { GuestPhysBlock *block; int64_t size; int ret; Error *local_err = NULL; while (1) { block = s->next_block; size = block->target_end - block->target_start; if (s->has_filter) { size -= s->start; if (s->begin + s->length < block->target_end) { size -= block->target_end - (s->begin + s->length); } } write_memory(s, block, s->start, size, &local_err); if (local_err) { error_propagate(errp, local_err); return; } ret = get_next_block(s, block); if (ret == 1) { dump_completed(s); } } }
{ "code": [ " int ret;", " while (1) {", " ret = get_next_block(s, block);", " if (ret == 1) {", " dump_completed(s);" ], "line_no": [ 9, 15, 47, 49, 51 ] }
static void FUNC_0(DumpState *VAR_0, Error **VAR_1) { GuestPhysBlock *block; int64_t size; int VAR_2; Error *local_err = NULL; while (1) { block = VAR_0->next_block; size = block->target_end - block->target_start; if (VAR_0->has_filter) { size -= VAR_0->start; if (VAR_0->begin + VAR_0->length < block->target_end) { size -= block->target_end - (VAR_0->begin + VAR_0->length); } } write_memory(VAR_0, block, VAR_0->start, size, &local_err); if (local_err) { error_propagate(VAR_1, local_err); return; } VAR_2 = get_next_block(VAR_0, block); if (VAR_2 == 1) { dump_completed(VAR_0); } } }
[ "static void FUNC_0(DumpState *VAR_0, Error **VAR_1)\n{", "GuestPhysBlock *block;", "int64_t size;", "int VAR_2;", "Error *local_err = NULL;", "while (1) {", "block = VAR_0->next_block;", "size = block->target_end - block->target_start;", "if (VAR_0->has_filter) {", "size -= VAR_0->start;", "if (VAR_0->begin + VAR_0->length < block->target_end) {", "size -= block->target_end - (VAR_0->begin + VAR_0->length);", "}", "}", "write_memory(VAR_0, block, VAR_0->start, size, &local_err);", "if (local_err) {", "error_propagate(VAR_1, local_err);", "return;", "}", "VAR_2 = get_next_block(VAR_0, block);", "if (VAR_2 == 1) {", "dump_completed(VAR_0);", "}", "}", "}" ]
[ 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
25,803
fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, target_phys_addr_t mmio_base, DriveInfo **fds) { fdctrl_t *fdctrl; DeviceState *dev; fdctrl_sysbus_t *sys; dev = qdev_create(NULL, "sysbus-fdc"); sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); fdctrl = &sys->state; fdctrl->dma_chann = dma_chann; /* FIXME */ qdev_prop_set_drive(dev, "driveA", fds[0]); qdev_prop_set_drive(dev, "driveB", fds[1]); if (qdev_init(dev) != 0) return NULL; sysbus_connect_irq(&sys->busdev, 0, irq); sysbus_mmio_map(&sys->busdev, 0, mmio_base); return fdctrl; }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann, target_phys_addr_t mmio_base, DriveInfo **fds) { fdctrl_t *fdctrl; DeviceState *dev; fdctrl_sysbus_t *sys; dev = qdev_create(NULL, "sysbus-fdc"); sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); fdctrl = &sys->state; fdctrl->dma_chann = dma_chann; qdev_prop_set_drive(dev, "driveA", fds[0]); qdev_prop_set_drive(dev, "driveB", fds[1]); if (qdev_init(dev) != 0) return NULL; sysbus_connect_irq(&sys->busdev, 0, irq); sysbus_mmio_map(&sys->busdev, 0, mmio_base); return fdctrl; }
{ "code": [ " if (qdev_init(dev) != 0)", " return NULL;", " if (qdev_init(dev) != 0)", " return NULL;" ], "line_no": [ 29, 31, 29, 31 ] }
fdctrl_t *FUNC_0(qemu_irq irq, int dma_chann, target_phys_addr_t mmio_base, DriveInfo **fds) { fdctrl_t *fdctrl; DeviceState *dev; fdctrl_sysbus_t *sys; dev = qdev_create(NULL, "sysbus-fdc"); sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev); fdctrl = &sys->state; fdctrl->dma_chann = dma_chann; qdev_prop_set_drive(dev, "driveA", fds[0]); qdev_prop_set_drive(dev, "driveB", fds[1]); if (qdev_init(dev) != 0) return NULL; sysbus_connect_irq(&sys->busdev, 0, irq); sysbus_mmio_map(&sys->busdev, 0, mmio_base); return fdctrl; }
[ "fdctrl_t *FUNC_0(qemu_irq irq, int dma_chann,\ntarget_phys_addr_t mmio_base,\nDriveInfo **fds)\n{", "fdctrl_t *fdctrl;", "DeviceState *dev;", "fdctrl_sysbus_t *sys;", "dev = qdev_create(NULL, \"sysbus-fdc\");", "sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);", "fdctrl = &sys->state;", "fdctrl->dma_chann = dma_chann;", "qdev_prop_set_drive(dev, \"driveA\", fds[0]);", "qdev_prop_set_drive(dev, \"driveB\", fds[1]);", "if (qdev_init(dev) != 0)\nreturn NULL;", "sysbus_connect_irq(&sys->busdev, 0, irq);", "sysbus_mmio_map(&sys->busdev, 0, mmio_base);", "return fdctrl;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
25,804
static void uhci_async_complete(USBPort *port, USBPacket *packet) { UHCIAsync *async = container_of(packet, UHCIAsync, packet); UHCIState *s = async->queue->uhci; if (async->isoc) { UHCI_TD td; uint32_t link = async->td; uint32_t int_mask = 0, val; pci_dma_read(&s->dev, link & ~0xf, &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); uhci_async_unlink(async); uhci_complete_td(s, &td, async, &int_mask); s->pending_int_mask |= int_mask; /* update the status bits of the TD */ val = cpu_to_le32(td.ctrl); pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val)); uhci_async_free(async); } else { async->done = 1; uhci_process_frame(s); } }
false
qemu
9a16c5950d9ce38671a1ac259dcde3e707767922
static void uhci_async_complete(USBPort *port, USBPacket *packet) { UHCIAsync *async = container_of(packet, UHCIAsync, packet); UHCIState *s = async->queue->uhci; if (async->isoc) { UHCI_TD td; uint32_t link = async->td; uint32_t int_mask = 0, val; pci_dma_read(&s->dev, link & ~0xf, &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); uhci_async_unlink(async); uhci_complete_td(s, &td, async, &int_mask); s->pending_int_mask |= int_mask; val = cpu_to_le32(td.ctrl); pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val)); uhci_async_free(async); } else { async->done = 1; uhci_process_frame(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(USBPort *VAR_0, USBPacket *VAR_1) { UHCIAsync *async = container_of(VAR_1, UHCIAsync, VAR_1); UHCIState *s = async->queue->uhci; if (async->isoc) { UHCI_TD td; uint32_t link = async->td; uint32_t int_mask = 0, val; pci_dma_read(&s->dev, link & ~0xf, &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); uhci_async_unlink(async); uhci_complete_td(s, &td, async, &int_mask); s->pending_int_mask |= int_mask; val = cpu_to_le32(td.ctrl); pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val)); uhci_async_free(async); } else { async->done = 1; uhci_process_frame(s); } }
[ "static void FUNC_0(USBPort *VAR_0, USBPacket *VAR_1)\n{", "UHCIAsync *async = container_of(VAR_1, UHCIAsync, VAR_1);", "UHCIState *s = async->queue->uhci;", "if (async->isoc) {", "UHCI_TD td;", "uint32_t link = async->td;", "uint32_t int_mask = 0, val;", "pci_dma_read(&s->dev, link & ~0xf, &td, sizeof(td));", "le32_to_cpus(&td.link);", "le32_to_cpus(&td.ctrl);", "le32_to_cpus(&td.token);", "le32_to_cpus(&td.buffer);", "uhci_async_unlink(async);", "uhci_complete_td(s, &td, async, &int_mask);", "s->pending_int_mask |= int_mask;", "val = cpu_to_le32(td.ctrl);", "pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val));", "uhci_async_free(async);", "} else {", "async->done = 1;", "uhci_process_frame(s);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
25,805
int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg) { ThreadPoolCo tpc = { .co = qemu_coroutine_self(), .ret = -EINPROGRESS }; assert(qemu_in_coroutine()); thread_pool_submit_aio(func, arg, thread_pool_co_cb, &tpc); qemu_coroutine_yield(); return tpc.ret; }
false
qemu
c4d9d19645a484298a67e9021060bc7c2b081d0f
int coroutine_fn thread_pool_submit_co(ThreadPoolFunc *func, void *arg) { ThreadPoolCo tpc = { .co = qemu_coroutine_self(), .ret = -EINPROGRESS }; assert(qemu_in_coroutine()); thread_pool_submit_aio(func, arg, thread_pool_co_cb, &tpc); qemu_coroutine_yield(); return tpc.ret; }
{ "code": [], "line_no": [] }
int VAR_0 thread_pool_submit_co(ThreadPoolFunc *func, void *arg) { ThreadPoolCo tpc = { .co = qemu_coroutine_self(), .ret = -EINPROGRESS }; assert(qemu_in_coroutine()); thread_pool_submit_aio(func, arg, thread_pool_co_cb, &tpc); qemu_coroutine_yield(); return tpc.ret; }
[ "int VAR_0 thread_pool_submit_co(ThreadPoolFunc *func, void *arg)\n{", "ThreadPoolCo tpc = { .co = qemu_coroutine_self(), .ret = -EINPROGRESS };", "assert(qemu_in_coroutine());", "thread_pool_submit_aio(func, arg, thread_pool_co_cb, &tpc);", "qemu_coroutine_yield();", "return tpc.ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
25,806
static void uhci_process_frame(UHCIState *s) { uint32_t frame_addr, link, old_td_ctrl, val, int_mask; uint32_t curr_qh; int cnt, ret; UHCI_TD td; UHCI_QH qh; QhDb qhdb; frame_addr = s->fl_base_addr + ((s->frnum & 0x3ff) << 2); DPRINTF("uhci: processing frame %d addr 0x%x\n" , s->frnum, frame_addr); cpu_physical_memory_read(frame_addr, (uint8_t *)&link, 4); le32_to_cpus(&link); int_mask = 0; curr_qh = 0; qhdb_reset(&qhdb); for (cnt = FRAME_MAX_LOOPS; is_valid(link) && cnt; cnt--) { if (is_qh(link)) { /* QH */ if (qhdb_insert(&qhdb, link)) { /* * We're going in circles. Which is not a bug because * HCD is allowed to do that as part of the BW management. * In our case though it makes no sense to spin here. Sync transations * are already done, and async completion handler will re-process * the frame when something is ready. */ DPRINTF("uhci: detected loop. qh 0x%x\n", link); break; } cpu_physical_memory_read(link & ~0xf, (uint8_t *) &qh, sizeof(qh)); le32_to_cpus(&qh.link); le32_to_cpus(&qh.el_link); DPRINTF("uhci: QH 0x%x load. link 0x%x elink 0x%x\n", link, qh.link, qh.el_link); if (!is_valid(qh.el_link)) { /* QH w/o elements */ curr_qh = 0; link = qh.link; } else { /* QH with elements */ curr_qh = link; link = qh.el_link; } continue; } /* TD */ cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); DPRINTF("uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); old_td_ctrl = td.ctrl; ret = uhci_handle_td(s, link, &td, &int_mask); if (old_td_ctrl != td.ctrl) { /* update the status bits of the TD */ val = cpu_to_le32(td.ctrl); cpu_physical_memory_write((link & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); } if (ret < 0) { /* interrupted frame */ break; } if (ret == 2 || ret == 1) { DPRINTF("uhci: TD 0x%x %s. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, ret == 2 ? "pend" : "skip", td.link, td.ctrl, td.token, curr_qh); link = curr_qh ? qh.link : td.link; continue; } /* completed TD */ DPRINTF("uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); link = td.link; if (curr_qh) { /* update QH element link */ qh.el_link = link; val = cpu_to_le32(qh.el_link); cpu_physical_memory_write((curr_qh & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); if (!depth_first(link)) { /* done with this QH */ DPRINTF("uhci: QH 0x%x done. link 0x%x elink 0x%x\n", curr_qh, qh.link, qh.el_link); curr_qh = 0; link = qh.link; } } /* go to the next entry */ } s->pending_int_mask |= int_mask; }
false
qemu
fff23ee9a5de74ab111b3cea9eec56782e7d7c50
static void uhci_process_frame(UHCIState *s) { uint32_t frame_addr, link, old_td_ctrl, val, int_mask; uint32_t curr_qh; int cnt, ret; UHCI_TD td; UHCI_QH qh; QhDb qhdb; frame_addr = s->fl_base_addr + ((s->frnum & 0x3ff) << 2); DPRINTF("uhci: processing frame %d addr 0x%x\n" , s->frnum, frame_addr); cpu_physical_memory_read(frame_addr, (uint8_t *)&link, 4); le32_to_cpus(&link); int_mask = 0; curr_qh = 0; qhdb_reset(&qhdb); for (cnt = FRAME_MAX_LOOPS; is_valid(link) && cnt; cnt--) { if (is_qh(link)) { if (qhdb_insert(&qhdb, link)) { DPRINTF("uhci: detected loop. qh 0x%x\n", link); break; } cpu_physical_memory_read(link & ~0xf, (uint8_t *) &qh, sizeof(qh)); le32_to_cpus(&qh.link); le32_to_cpus(&qh.el_link); DPRINTF("uhci: QH 0x%x load. link 0x%x elink 0x%x\n", link, qh.link, qh.el_link); if (!is_valid(qh.el_link)) { curr_qh = 0; link = qh.link; } else { curr_qh = link; link = qh.el_link; } continue; } cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); DPRINTF("uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); old_td_ctrl = td.ctrl; ret = uhci_handle_td(s, link, &td, &int_mask); if (old_td_ctrl != td.ctrl) { val = cpu_to_le32(td.ctrl); cpu_physical_memory_write((link & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); } if (ret < 0) { break; } if (ret == 2 || ret == 1) { DPRINTF("uhci: TD 0x%x %s. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, ret == 2 ? "pend" : "skip", td.link, td.ctrl, td.token, curr_qh); link = curr_qh ? qh.link : td.link; continue; } DPRINTF("uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); link = td.link; if (curr_qh) { qh.el_link = link; val = cpu_to_le32(qh.el_link); cpu_physical_memory_write((curr_qh & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); if (!depth_first(link)) { DPRINTF("uhci: QH 0x%x done. link 0x%x elink 0x%x\n", curr_qh, qh.link, qh.el_link); curr_qh = 0; link = qh.link; } } } s->pending_int_mask |= int_mask; }
{ "code": [], "line_no": [] }
static void FUNC_0(UHCIState *VAR_0) { uint32_t frame_addr, link, old_td_ctrl, val, int_mask; uint32_t curr_qh; int VAR_1, VAR_2; UHCI_TD td; UHCI_QH qh; QhDb qhdb; frame_addr = VAR_0->fl_base_addr + ((VAR_0->frnum & 0x3ff) << 2); DPRINTF("uhci: processing frame %d addr 0x%x\n" , VAR_0->frnum, frame_addr); cpu_physical_memory_read(frame_addr, (uint8_t *)&link, 4); le32_to_cpus(&link); int_mask = 0; curr_qh = 0; qhdb_reset(&qhdb); for (VAR_1 = FRAME_MAX_LOOPS; is_valid(link) && VAR_1; VAR_1--) { if (is_qh(link)) { if (qhdb_insert(&qhdb, link)) { DPRINTF("uhci: detected loop. qh 0x%x\n", link); break; } cpu_physical_memory_read(link & ~0xf, (uint8_t *) &qh, sizeof(qh)); le32_to_cpus(&qh.link); le32_to_cpus(&qh.el_link); DPRINTF("uhci: QH 0x%x load. link 0x%x elink 0x%x\n", link, qh.link, qh.el_link); if (!is_valid(qh.el_link)) { curr_qh = 0; link = qh.link; } else { curr_qh = link; link = qh.el_link; } continue; } cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td)); le32_to_cpus(&td.link); le32_to_cpus(&td.ctrl); le32_to_cpus(&td.token); le32_to_cpus(&td.buffer); DPRINTF("uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); old_td_ctrl = td.ctrl; VAR_2 = uhci_handle_td(VAR_0, link, &td, &int_mask); if (old_td_ctrl != td.ctrl) { val = cpu_to_le32(td.ctrl); cpu_physical_memory_write((link & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); } if (VAR_2 < 0) { break; } if (VAR_2 == 2 || VAR_2 == 1) { DPRINTF("uhci: TD 0x%x %VAR_0. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, VAR_2 == 2 ? "pend" : "skip", td.link, td.ctrl, td.token, curr_qh); link = curr_qh ? qh.link : td.link; continue; } DPRINTF("uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\n", link, td.link, td.ctrl, td.token, curr_qh); link = td.link; if (curr_qh) { qh.el_link = link; val = cpu_to_le32(qh.el_link); cpu_physical_memory_write((curr_qh & ~0xf) + 4, (const uint8_t *)&val, sizeof(val)); if (!depth_first(link)) { DPRINTF("uhci: QH 0x%x done. link 0x%x elink 0x%x\n", curr_qh, qh.link, qh.el_link); curr_qh = 0; link = qh.link; } } } VAR_0->pending_int_mask |= int_mask; }
[ "static void FUNC_0(UHCIState *VAR_0)\n{", "uint32_t frame_addr, link, old_td_ctrl, val, int_mask;", "uint32_t curr_qh;", "int VAR_1, VAR_2;", "UHCI_TD td;", "UHCI_QH qh;", "QhDb qhdb;", "frame_addr = VAR_0->fl_base_addr + ((VAR_0->frnum & 0x3ff) << 2);", "DPRINTF(\"uhci: processing frame %d addr 0x%x\\n\" , VAR_0->frnum, frame_addr);", "cpu_physical_memory_read(frame_addr, (uint8_t *)&link, 4);", "le32_to_cpus(&link);", "int_mask = 0;", "curr_qh = 0;", "qhdb_reset(&qhdb);", "for (VAR_1 = FRAME_MAX_LOOPS; is_valid(link) && VAR_1; VAR_1--) {", "if (is_qh(link)) {", "if (qhdb_insert(&qhdb, link)) {", "DPRINTF(\"uhci: detected loop. qh 0x%x\\n\", link);", "break;", "}", "cpu_physical_memory_read(link & ~0xf, (uint8_t *) &qh, sizeof(qh));", "le32_to_cpus(&qh.link);", "le32_to_cpus(&qh.el_link);", "DPRINTF(\"uhci: QH 0x%x load. link 0x%x elink 0x%x\\n\",\nlink, qh.link, qh.el_link);", "if (!is_valid(qh.el_link)) {", "curr_qh = 0;", "link = qh.link;", "} else {", "curr_qh = link;", "link = qh.el_link;", "}", "continue;", "}", "cpu_physical_memory_read(link & ~0xf, (uint8_t *) &td, sizeof(td));", "le32_to_cpus(&td.link);", "le32_to_cpus(&td.ctrl);", "le32_to_cpus(&td.token);", "le32_to_cpus(&td.buffer);", "DPRINTF(\"uhci: TD 0x%x load. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\\n\",\nlink, td.link, td.ctrl, td.token, curr_qh);", "old_td_ctrl = td.ctrl;", "VAR_2 = uhci_handle_td(VAR_0, link, &td, &int_mask);", "if (old_td_ctrl != td.ctrl) {", "val = cpu_to_le32(td.ctrl);", "cpu_physical_memory_write((link & ~0xf) + 4,\n(const uint8_t *)&val, sizeof(val));", "}", "if (VAR_2 < 0) {", "break;", "}", "if (VAR_2 == 2 || VAR_2 == 1) {", "DPRINTF(\"uhci: TD 0x%x %VAR_0. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\\n\",\nlink, VAR_2 == 2 ? \"pend\" : \"skip\",\ntd.link, td.ctrl, td.token, curr_qh);", "link = curr_qh ? qh.link : td.link;", "continue;", "}", "DPRINTF(\"uhci: TD 0x%x done. link 0x%x ctrl 0x%x token 0x%x qh 0x%x\\n\",\nlink, td.link, td.ctrl, td.token, curr_qh);", "link = td.link;", "if (curr_qh) {", "qh.el_link = link;", "val = cpu_to_le32(qh.el_link);", "cpu_physical_memory_write((curr_qh & ~0xf) + 4,\n(const uint8_t *)&val, sizeof(val));", "if (!depth_first(link)) {", "DPRINTF(\"uhci: QH 0x%x done. link 0x%x elink 0x%x\\n\",\ncurr_qh, qh.link, qh.el_link);", "curr_qh = 0;", "link = qh.link;", "}", "}", "}", "VAR_0->pending_int_mask |= int_mask;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 51 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127, 129 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 161 ], [ 163, 165, 167 ], [ 171 ], [ 173 ], [ 175 ], [ 183, 185 ], [ 189 ], [ 193 ], [ 197 ], [ 199 ], [ 201, 203 ], [ 207 ], [ 213, 215 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 231 ], [ 235 ], [ 237 ] ]
25,807
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AVFrame tmp; AVFrame *padded_frame = NULL; int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); return 0; } /* ensure that extended_data is properly set */ if (frame && !frame->extended_data) { if (av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > AV_NUM_DATA_POINTERS) { av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, " "with more than %d channels, but extended_data is not set.\n", AV_NUM_DATA_POINTERS); return AVERROR(EINVAL); } av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n"); tmp = *frame; tmp.extended_data = tmp.data; frame = &tmp; } /* check for valid frame size */ if (frame) { if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (frame->nb_samples > avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n"); return AVERROR(EINVAL); } } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (frame->nb_samples < avctx->frame_size && !avctx->internal->last_audio_frame) { ret = pad_last_frame(avctx, &padded_frame, frame); if (ret < 0) return ret; frame = padded_frame; avctx->internal->last_audio_frame = 1; } if (frame->nb_samples != avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\n", frame->nb_samples, avctx->frame_size); ret = AVERROR(EINVAL); goto end; } } } ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret) { if (*got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; avpkt->destruct = user_pkt.destruct; } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) { av_free_packet(avpkt); av_init_packet(avpkt); goto end; } /* NOTE: if we add any audio encoders which output non-keyframe packets, * this needs to be moved to the encoders, but for now we can do it * here to simplify things */ avpkt->flags |= AV_PKT_FLAG_KEY; end: av_frame_free(&padded_frame); return ret; }
false
FFmpeg
8ab80707841a73ca7708e1e1aa97f3513fff3d35
int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AVFrame tmp; AVFrame *padded_frame = NULL; int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); return 0; } if (frame && !frame->extended_data) { if (av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > AV_NUM_DATA_POINTERS) { av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, " "with more than %d channels, but extended_data is not set.\n", AV_NUM_DATA_POINTERS); return AVERROR(EINVAL); } av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n"); tmp = *frame; tmp.extended_data = tmp.data; frame = &tmp; } if (frame) { if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (frame->nb_samples > avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n"); return AVERROR(EINVAL); } } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (frame->nb_samples < avctx->frame_size && !avctx->internal->last_audio_frame) { ret = pad_last_frame(avctx, &padded_frame, frame); if (ret < 0) return ret; frame = padded_frame; avctx->internal->last_audio_frame = 1; } if (frame->nb_samples != avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\n", frame->nb_samples, avctx->frame_size); ret = AVERROR(EINVAL); goto end; } } } ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret) { if (*got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; avpkt->destruct = user_pkt.destruct; } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) { av_free_packet(avpkt); av_init_packet(avpkt); goto end; } avpkt->flags |= AV_PKT_FLAG_KEY; end: av_frame_free(&padded_frame); return ret; }
{ "code": [], "line_no": [] }
int VAR_0 avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AVFrame tmp; AVFrame *padded_frame = NULL; int ret; AVPacket user_pkt = *avpkt; int needs_realloc = !user_pkt.data; *got_packet_ptr = 0; if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { av_free_packet(avpkt); av_init_packet(avpkt); return 0; } if (frame && !frame->extended_data) { if (av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > AV_NUM_DATA_POINTERS) { av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, " "with more than %d channels, but extended_data is not set.\n", AV_NUM_DATA_POINTERS); return AVERROR(EINVAL); } av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n"); tmp = *frame; tmp.extended_data = tmp.data; frame = &tmp; } if (frame) { if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { if (frame->nb_samples > avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n"); return AVERROR(EINVAL); } } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { if (frame->nb_samples < avctx->frame_size && !avctx->internal->last_audio_frame) { ret = pad_last_frame(avctx, &padded_frame, frame); if (ret < 0) return ret; frame = padded_frame; avctx->internal->last_audio_frame = 1; } if (frame->nb_samples != avctx->frame_size) { av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\n", frame->nb_samples, avctx->frame_size); ret = AVERROR(EINVAL); goto end; } } } ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); if (!ret) { if (*got_packet_ptr) { if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { if (avpkt->pts == AV_NOPTS_VALUE) avpkt->pts = frame->pts; if (!avpkt->duration) avpkt->duration = ff_samples_to_time_base(avctx, frame->nb_samples); } avpkt->dts = avpkt->pts; } else { avpkt->size = 0; } } if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { needs_realloc = 0; if (user_pkt.data) { if (user_pkt.size >= avpkt->size) { memcpy(user_pkt.data, avpkt->data, avpkt->size); } else { av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); avpkt->size = user_pkt.size; ret = -1; } avpkt->buf = user_pkt.buf; avpkt->data = user_pkt.data; avpkt->destruct = user_pkt.destruct; } else { if (av_dup_packet(avpkt) < 0) { ret = AVERROR(ENOMEM); } } } if (!ret) { if (needs_realloc && avpkt->data) { ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (ret >= 0) avpkt->data = avpkt->buf->data; } avctx->frame_number++; } if (ret < 0 || !*got_packet_ptr) { av_free_packet(avpkt); av_init_packet(avpkt); goto end; } avpkt->flags |= AV_PKT_FLAG_KEY; end: av_frame_free(&padded_frame); return ret; }
[ "int VAR_0 avcodec_encode_audio2(AVCodecContext *avctx,\nAVPacket *avpkt,\nconst AVFrame *frame,\nint *got_packet_ptr)\n{", "AVFrame tmp;", "AVFrame *padded_frame = NULL;", "int ret;", "AVPacket user_pkt = *avpkt;", "int needs_realloc = !user_pkt.data;", "*got_packet_ptr = 0;", "if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) {", "av_free_packet(avpkt);", "av_init_packet(avpkt);", "return 0;", "}", "if (frame && !frame->extended_data) {", "if (av_sample_fmt_is_planar(avctx->sample_fmt) &&\navctx->channels > AV_NUM_DATA_POINTERS) {", "av_log(avctx, AV_LOG_ERROR, \"Encoding to a planar sample format, \"\n\"with more than %d channels, but extended_data is not set.\\n\",\nAV_NUM_DATA_POINTERS);", "return AVERROR(EINVAL);", "}", "av_log(avctx, AV_LOG_WARNING, \"extended_data is not set.\\n\");", "tmp = *frame;", "tmp.extended_data = tmp.data;", "frame = &tmp;", "}", "if (frame) {", "if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {", "if (frame->nb_samples > avctx->frame_size) {", "av_log(avctx, AV_LOG_ERROR, \"more samples than frame size (avcodec_encode_audio2)\\n\");", "return AVERROR(EINVAL);", "}", "} else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) {", "if (frame->nb_samples < avctx->frame_size &&\n!avctx->internal->last_audio_frame) {", "ret = pad_last_frame(avctx, &padded_frame, frame);", "if (ret < 0)\nreturn ret;", "frame = padded_frame;", "avctx->internal->last_audio_frame = 1;", "}", "if (frame->nb_samples != avctx->frame_size) {", "av_log(avctx, AV_LOG_ERROR, \"nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\\n\", frame->nb_samples, avctx->frame_size);", "ret = AVERROR(EINVAL);", "goto end;", "}", "}", "}", "ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);", "if (!ret) {", "if (*got_packet_ptr) {", "if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) {", "if (avpkt->pts == AV_NOPTS_VALUE)\navpkt->pts = frame->pts;", "if (!avpkt->duration)\navpkt->duration = ff_samples_to_time_base(avctx,\nframe->nb_samples);", "}", "avpkt->dts = avpkt->pts;", "} else {", "avpkt->size = 0;", "}", "}", "if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) {", "needs_realloc = 0;", "if (user_pkt.data) {", "if (user_pkt.size >= avpkt->size) {", "memcpy(user_pkt.data, avpkt->data, avpkt->size);", "} else {", "av_log(avctx, AV_LOG_ERROR, \"Provided packet is too small, needs to be %d\\n\", avpkt->size);", "avpkt->size = user_pkt.size;", "ret = -1;", "}", "avpkt->buf = user_pkt.buf;", "avpkt->data = user_pkt.data;", "avpkt->destruct = user_pkt.destruct;", "} else {", "if (av_dup_packet(avpkt) < 0) {", "ret = AVERROR(ENOMEM);", "}", "}", "}", "if (!ret) {", "if (needs_realloc && avpkt->data) {", "ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);", "if (ret >= 0)\navpkt->data = avpkt->buf->data;", "}", "avctx->frame_number++;", "}", "if (ret < 0 || !*got_packet_ptr) {", "av_free_packet(avpkt);", "av_init_packet(avpkt);", "goto end;", "}", "avpkt->flags |= AV_PKT_FLAG_KEY;", "end:\nav_frame_free(&padded_frame);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43, 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 99 ], [ 101 ], [ 103 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 207 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 231 ], [ 235, 237 ], [ 241 ], [ 243 ] ]
25,808
static void virtio_input_handle_sts(VirtIODevice *vdev, VirtQueue *vq) { VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); VirtIOInput *vinput = VIRTIO_INPUT(vdev); virtio_input_event event; VirtQueueElement elem; int len; while (virtqueue_pop(vinput->sts, &elem)) { memset(&event, 0, sizeof(event)); len = iov_to_buf(elem.out_sg, elem.out_num, 0, &event, sizeof(event)); if (vic->handle_status) { vic->handle_status(vinput, &event); } virtqueue_push(vinput->sts, &elem, len); } virtio_notify(vdev, vinput->sts); }
false
qemu
51b19ebe4320f3dcd93cea71235c1219318ddfd2
static void virtio_input_handle_sts(VirtIODevice *vdev, VirtQueue *vq) { VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vdev); VirtIOInput *vinput = VIRTIO_INPUT(vdev); virtio_input_event event; VirtQueueElement elem; int len; while (virtqueue_pop(vinput->sts, &elem)) { memset(&event, 0, sizeof(event)); len = iov_to_buf(elem.out_sg, elem.out_num, 0, &event, sizeof(event)); if (vic->handle_status) { vic->handle_status(vinput, &event); } virtqueue_push(vinput->sts, &elem, len); } virtio_notify(vdev, vinput->sts); }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1) { VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(VAR_0); VirtIOInput *vinput = VIRTIO_INPUT(VAR_0); virtio_input_event event; VirtQueueElement elem; int VAR_2; while (virtqueue_pop(vinput->sts, &elem)) { memset(&event, 0, sizeof(event)); VAR_2 = iov_to_buf(elem.out_sg, elem.out_num, 0, &event, sizeof(event)); if (vic->handle_status) { vic->handle_status(vinput, &event); } virtqueue_push(vinput->sts, &elem, VAR_2); } virtio_notify(VAR_0, vinput->sts); }
[ "static void FUNC_0(VirtIODevice *VAR_0, VirtQueue *VAR_1)\n{", "VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(VAR_0);", "VirtIOInput *vinput = VIRTIO_INPUT(VAR_0);", "virtio_input_event event;", "VirtQueueElement elem;", "int VAR_2;", "while (virtqueue_pop(vinput->sts, &elem)) {", "memset(&event, 0, sizeof(event));", "VAR_2 = iov_to_buf(elem.out_sg, elem.out_num,\n0, &event, sizeof(event));", "if (vic->handle_status) {", "vic->handle_status(vinput, &event);", "}", "virtqueue_push(vinput->sts, &elem, VAR_2);", "}", "virtio_notify(VAR_0, vinput->sts);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
25,809
void qmp_guest_file_close(int64_t handle, Error **err) { GuestFileHandle *gfh = guest_file_handle_find(handle, err); int ret; slog("guest-file-close called, handle: %ld", handle); if (!gfh) { return; } ret = fclose(gfh->fh); if (ret == -1) { error_set(err, QERR_QGA_COMMAND_FAILED, "fclose() failed"); return; } QTAILQ_REMOVE(&guest_file_state.filehandles, gfh, next); g_free(gfh); }
false
qemu
3ac4b7c51e3ba181a86983ba2601a595ed8f3b1d
void qmp_guest_file_close(int64_t handle, Error **err) { GuestFileHandle *gfh = guest_file_handle_find(handle, err); int ret; slog("guest-file-close called, handle: %ld", handle); if (!gfh) { return; } ret = fclose(gfh->fh); if (ret == -1) { error_set(err, QERR_QGA_COMMAND_FAILED, "fclose() failed"); return; } QTAILQ_REMOVE(&guest_file_state.filehandles, gfh, next); g_free(gfh); }
{ "code": [], "line_no": [] }
void FUNC_0(int64_t VAR_0, Error **VAR_1) { GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_1); int VAR_2; slog("guest-file-close called, VAR_0: %ld", VAR_0); if (!gfh) { return; } VAR_2 = fclose(gfh->fh); if (VAR_2 == -1) { error_set(VAR_1, QERR_QGA_COMMAND_FAILED, "fclose() failed"); return; } QTAILQ_REMOVE(&guest_file_state.filehandles, gfh, next); g_free(gfh); }
[ "void FUNC_0(int64_t VAR_0, Error **VAR_1)\n{", "GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_1);", "int VAR_2;", "slog(\"guest-file-close called, VAR_0: %ld\", VAR_0);", "if (!gfh) {", "return;", "}", "VAR_2 = fclose(gfh->fh);", "if (VAR_2 == -1) {", "error_set(VAR_1, QERR_QGA_COMMAND_FAILED, \"fclose() failed\");", "return;", "}", "QTAILQ_REMOVE(&guest_file_state.filehandles, gfh, next);", "g_free(gfh);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ] ]
25,811
static int convert_read(ImgConvertState *s, int64_t sector_num, int nb_sectors, uint8_t *buf) { int n; int ret; if (s->status == BLK_ZERO || s->status == BLK_BACKING_FILE) { return 0; } assert(nb_sectors <= s->buf_sectors); while (nb_sectors > 0) { BlockBackend *blk; int64_t bs_sectors; /* In the case of compression with multiple source files, we can get a * nb_sectors that spreads into the next part. So we must be able to * read across multiple BDSes for one convert_read() call. */ convert_select_part(s, sector_num); blk = s->src[s->src_cur]; bs_sectors = s->src_sectors[s->src_cur]; n = MIN(nb_sectors, bs_sectors - (sector_num - s->src_cur_offset)); ret = blk_read(blk, sector_num - s->src_cur_offset, buf, n); if (ret < 0) { return ret; } sector_num += n; nb_sectors -= n; buf += n * BDRV_SECTOR_SIZE; } return 0; }
false
qemu
aad15de4275d2fc90acdf6101493dfee4e39b803
static int convert_read(ImgConvertState *s, int64_t sector_num, int nb_sectors, uint8_t *buf) { int n; int ret; if (s->status == BLK_ZERO || s->status == BLK_BACKING_FILE) { return 0; } assert(nb_sectors <= s->buf_sectors); while (nb_sectors > 0) { BlockBackend *blk; int64_t bs_sectors; convert_select_part(s, sector_num); blk = s->src[s->src_cur]; bs_sectors = s->src_sectors[s->src_cur]; n = MIN(nb_sectors, bs_sectors - (sector_num - s->src_cur_offset)); ret = blk_read(blk, sector_num - s->src_cur_offset, buf, n); if (ret < 0) { return ret; } sector_num += n; nb_sectors -= n; buf += n * BDRV_SECTOR_SIZE; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(ImgConvertState *VAR_0, int64_t VAR_1, int VAR_2, uint8_t *VAR_3) { int VAR_4; int VAR_5; if (VAR_0->status == BLK_ZERO || VAR_0->status == BLK_BACKING_FILE) { return 0; } assert(VAR_2 <= VAR_0->buf_sectors); while (VAR_2 > 0) { BlockBackend *blk; int64_t bs_sectors; convert_select_part(VAR_0, VAR_1); blk = VAR_0->src[VAR_0->src_cur]; bs_sectors = VAR_0->src_sectors[VAR_0->src_cur]; VAR_4 = MIN(VAR_2, bs_sectors - (VAR_1 - VAR_0->src_cur_offset)); VAR_5 = blk_read(blk, VAR_1 - VAR_0->src_cur_offset, VAR_3, VAR_4); if (VAR_5 < 0) { return VAR_5; } VAR_1 += VAR_4; VAR_2 -= VAR_4; VAR_3 += VAR_4 * BDRV_SECTOR_SIZE; } return 0; }
[ "static int FUNC_0(ImgConvertState *VAR_0, int64_t VAR_1, int VAR_2,\nuint8_t *VAR_3)\n{", "int VAR_4;", "int VAR_5;", "if (VAR_0->status == BLK_ZERO || VAR_0->status == BLK_BACKING_FILE) {", "return 0;", "}", "assert(VAR_2 <= VAR_0->buf_sectors);", "while (VAR_2 > 0) {", "BlockBackend *blk;", "int64_t bs_sectors;", "convert_select_part(VAR_0, VAR_1);", "blk = VAR_0->src[VAR_0->src_cur];", "bs_sectors = VAR_0->src_sectors[VAR_0->src_cur];", "VAR_4 = MIN(VAR_2, bs_sectors - (VAR_1 - VAR_0->src_cur_offset));", "VAR_5 = blk_read(blk, VAR_1 - VAR_0->src_cur_offset, VAR_3, VAR_4);", "if (VAR_5 < 0) {", "return VAR_5;", "}", "VAR_1 += VAR_4;", "VAR_2 -= VAR_4;", "VAR_3 += VAR_4 * BDRV_SECTOR_SIZE;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
25,812
static void qemu_announce_self_once(void *opaque) { static int count = SELF_ANNOUNCE_ROUNDS; QEMUTimer *timer = *(QEMUTimer **)opaque; qemu_foreach_nic(qemu_announce_self_iter, NULL); if (--count) { /* delay 50ms, 150ms, 250ms, ... */ qemu_mod_timer(timer, qemu_get_clock(rt_clock) + 50 + (SELF_ANNOUNCE_ROUNDS - count - 1) * 100); } else { qemu_del_timer(timer); qemu_free_timer(timer); } }
false
qemu
7bd427d801e1e3293a634d3c83beadaa90ffb911
static void qemu_announce_self_once(void *opaque) { static int count = SELF_ANNOUNCE_ROUNDS; QEMUTimer *timer = *(QEMUTimer **)opaque; qemu_foreach_nic(qemu_announce_self_iter, NULL); if (--count) { qemu_mod_timer(timer, qemu_get_clock(rt_clock) + 50 + (SELF_ANNOUNCE_ROUNDS - count - 1) * 100); } else { qemu_del_timer(timer); qemu_free_timer(timer); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { static int VAR_1 = SELF_ANNOUNCE_ROUNDS; QEMUTimer *timer = *(QEMUTimer **)VAR_0; qemu_foreach_nic(qemu_announce_self_iter, NULL); if (--VAR_1) { qemu_mod_timer(timer, qemu_get_clock(rt_clock) + 50 + (SELF_ANNOUNCE_ROUNDS - VAR_1 - 1) * 100); } else { qemu_del_timer(timer); qemu_free_timer(timer); } }
[ "static void FUNC_0(void *VAR_0)\n{", "static int VAR_1 = SELF_ANNOUNCE_ROUNDS;", "QEMUTimer *timer = *(QEMUTimer **)VAR_0;", "qemu_foreach_nic(qemu_announce_self_iter, NULL);", "if (--VAR_1) {", "qemu_mod_timer(timer, qemu_get_clock(rt_clock) +\n50 + (SELF_ANNOUNCE_ROUNDS - VAR_1 - 1) * 100);", "} else {", "qemu_del_timer(timer);", "qemu_free_timer(timer);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
25,815
static int nvme_init(PCIDevice *pci_dev) { NvmeCtrl *n = NVME(pci_dev); NvmeIdCtrl *id = &n->id_ctrl; int i; int64_t bs_size; uint8_t *pci_conf; if (!(n->conf.bs)) { return -1; } bs_size = bdrv_getlength(n->conf.bs); if (bs_size < 0) { return -1; } blkconf_serial(&n->conf, &n->serial); if (!n->serial) { return -1; } pci_conf = pci_dev->config; pci_conf[PCI_INTERRUPT_PIN] = 1; pci_config_set_prog_interface(pci_dev->config, 0x2); pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(&n->parent_obj, 0x80); n->num_namespaces = 1; n->num_queues = 64; n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4); n->ns_size = bs_size / (uint64_t)n->num_namespaces; n->namespaces = g_new0(NvmeNamespace, n->num_namespaces); n->sq = g_new0(NvmeSQueue *, n->num_queues); n->cq = g_new0(NvmeCQueue *, n->num_queues); memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(&n->parent_obj, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4); id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); strpadcpy((char *)id->fr, sizeof(id->fr), "1.0", ' '); strpadcpy((char *)id->sn, sizeof(id->sn), n->serial, ' '); id->rab = 6; id->ieee[0] = 0x00; id->ieee[1] = 0x02; id->ieee[2] = 0xb3; id->oacs = cpu_to_le16(0); id->frmw = 7 << 1; id->lpa = 1 << 0; id->sqes = (0x6 << 4) | 0x6; id->cqes = (0x4 << 4) | 0x4; id->nn = cpu_to_le32(n->num_namespaces); id->psd[0].mp = cpu_to_le16(0x9c4); id->psd[0].enlat = cpu_to_le32(0x10); id->psd[0].exlat = cpu_to_le32(0x4); n->bar.cap = 0; NVME_CAP_SET_MQES(n->bar.cap, 0x7ff); NVME_CAP_SET_CQR(n->bar.cap, 1); NVME_CAP_SET_AMS(n->bar.cap, 1); NVME_CAP_SET_TO(n->bar.cap, 0xf); NVME_CAP_SET_CSS(n->bar.cap, 1); n->bar.vs = 0x00010001; n->bar.intmc = n->bar.intms = 0; for (i = 0; i < n->num_namespaces; i++) { NvmeNamespace *ns = &n->namespaces[i]; NvmeIdNs *id_ns = &ns->id_ns; id_ns->nsfeat = 0; id_ns->nlbaf = 0; id_ns->flbas = 0; id_ns->mc = 0; id_ns->dpc = 0; id_ns->dps = 0; id_ns->lbaf[0].ds = BDRV_SECTOR_BITS; id_ns->ncap = id_ns->nuse = id_ns->nsze = cpu_to_le64(n->ns_size >> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); } return 0; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static int nvme_init(PCIDevice *pci_dev) { NvmeCtrl *n = NVME(pci_dev); NvmeIdCtrl *id = &n->id_ctrl; int i; int64_t bs_size; uint8_t *pci_conf; if (!(n->conf.bs)) { return -1; } bs_size = bdrv_getlength(n->conf.bs); if (bs_size < 0) { return -1; } blkconf_serial(&n->conf, &n->serial); if (!n->serial) { return -1; } pci_conf = pci_dev->config; pci_conf[PCI_INTERRUPT_PIN] = 1; pci_config_set_prog_interface(pci_dev->config, 0x2); pci_config_set_class(pci_dev->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(&n->parent_obj, 0x80); n->num_namespaces = 1; n->num_queues = 64; n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4); n->ns_size = bs_size / (uint64_t)n->num_namespaces; n->namespaces = g_new0(NvmeNamespace, n->num_namespaces); n->sq = g_new0(NvmeSQueue *, n->num_queues); n->cq = g_new0(NvmeCQueue *, n->num_queues); memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(&n->parent_obj, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4); id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); strpadcpy((char *)id->fr, sizeof(id->fr), "1.0", ' '); strpadcpy((char *)id->sn, sizeof(id->sn), n->serial, ' '); id->rab = 6; id->ieee[0] = 0x00; id->ieee[1] = 0x02; id->ieee[2] = 0xb3; id->oacs = cpu_to_le16(0); id->frmw = 7 << 1; id->lpa = 1 << 0; id->sqes = (0x6 << 4) | 0x6; id->cqes = (0x4 << 4) | 0x4; id->nn = cpu_to_le32(n->num_namespaces); id->psd[0].mp = cpu_to_le16(0x9c4); id->psd[0].enlat = cpu_to_le32(0x10); id->psd[0].exlat = cpu_to_le32(0x4); n->bar.cap = 0; NVME_CAP_SET_MQES(n->bar.cap, 0x7ff); NVME_CAP_SET_CQR(n->bar.cap, 1); NVME_CAP_SET_AMS(n->bar.cap, 1); NVME_CAP_SET_TO(n->bar.cap, 0xf); NVME_CAP_SET_CSS(n->bar.cap, 1); n->bar.vs = 0x00010001; n->bar.intmc = n->bar.intms = 0; for (i = 0; i < n->num_namespaces; i++) { NvmeNamespace *ns = &n->namespaces[i]; NvmeIdNs *id_ns = &ns->id_ns; id_ns->nsfeat = 0; id_ns->nlbaf = 0; id_ns->flbas = 0; id_ns->mc = 0; id_ns->dpc = 0; id_ns->dps = 0; id_ns->lbaf[0].ds = BDRV_SECTOR_BITS; id_ns->ncap = id_ns->nuse = id_ns->nsze = cpu_to_le64(n->ns_size >> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { NvmeCtrl *n = NVME(VAR_0); NvmeIdCtrl *id = &n->id_ctrl; int VAR_1; int64_t bs_size; uint8_t *pci_conf; if (!(n->conf.bs)) { return -1; } bs_size = bdrv_getlength(n->conf.bs); if (bs_size < 0) { return -1; } blkconf_serial(&n->conf, &n->serial); if (!n->serial) { return -1; } pci_conf = VAR_0->config; pci_conf[PCI_INTERRUPT_PIN] = 1; pci_config_set_prog_interface(VAR_0->config, 0x2); pci_config_set_class(VAR_0->config, PCI_CLASS_STORAGE_EXPRESS); pcie_endpoint_cap_init(&n->parent_obj, 0x80); n->num_namespaces = 1; n->num_queues = 64; n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4); n->ns_size = bs_size / (uint64_t)n->num_namespaces; n->namespaces = g_new0(NvmeNamespace, n->num_namespaces); n->sq = g_new0(NvmeSQueue *, n->num_queues); n->cq = g_new0(NvmeCQueue *, n->num_queues); memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n, "nvme", n->reg_size); pci_register_bar(&n->parent_obj, 0, PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64, &n->iomem); msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4); id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID)); id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID)); strpadcpy((char *)id->mn, sizeof(id->mn), "QEMU NVMe Ctrl", ' '); strpadcpy((char *)id->fr, sizeof(id->fr), "1.0", ' '); strpadcpy((char *)id->sn, sizeof(id->sn), n->serial, ' '); id->rab = 6; id->ieee[0] = 0x00; id->ieee[1] = 0x02; id->ieee[2] = 0xb3; id->oacs = cpu_to_le16(0); id->frmw = 7 << 1; id->lpa = 1 << 0; id->sqes = (0x6 << 4) | 0x6; id->cqes = (0x4 << 4) | 0x4; id->nn = cpu_to_le32(n->num_namespaces); id->psd[0].mp = cpu_to_le16(0x9c4); id->psd[0].enlat = cpu_to_le32(0x10); id->psd[0].exlat = cpu_to_le32(0x4); n->bar.cap = 0; NVME_CAP_SET_MQES(n->bar.cap, 0x7ff); NVME_CAP_SET_CQR(n->bar.cap, 1); NVME_CAP_SET_AMS(n->bar.cap, 1); NVME_CAP_SET_TO(n->bar.cap, 0xf); NVME_CAP_SET_CSS(n->bar.cap, 1); n->bar.vs = 0x00010001; n->bar.intmc = n->bar.intms = 0; for (VAR_1 = 0; VAR_1 < n->num_namespaces; VAR_1++) { NvmeNamespace *ns = &n->namespaces[VAR_1]; NvmeIdNs *id_ns = &ns->id_ns; id_ns->nsfeat = 0; id_ns->nlbaf = 0; id_ns->flbas = 0; id_ns->mc = 0; id_ns->dpc = 0; id_ns->dps = 0; id_ns->lbaf[0].ds = BDRV_SECTOR_BITS; id_ns->ncap = id_ns->nuse = id_ns->nsze = cpu_to_le64(n->ns_size >> id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds); } return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "NvmeCtrl *n = NVME(VAR_0);", "NvmeIdCtrl *id = &n->id_ctrl;", "int VAR_1;", "int64_t bs_size;", "uint8_t *pci_conf;", "if (!(n->conf.bs)) {", "return -1;", "}", "bs_size = bdrv_getlength(n->conf.bs);", "if (bs_size < 0) {", "return -1;", "}", "blkconf_serial(&n->conf, &n->serial);", "if (!n->serial) {", "return -1;", "}", "pci_conf = VAR_0->config;", "pci_conf[PCI_INTERRUPT_PIN] = 1;", "pci_config_set_prog_interface(VAR_0->config, 0x2);", "pci_config_set_class(VAR_0->config, PCI_CLASS_STORAGE_EXPRESS);", "pcie_endpoint_cap_init(&n->parent_obj, 0x80);", "n->num_namespaces = 1;", "n->num_queues = 64;", "n->reg_size = 1 << qemu_fls(0x1004 + 2 * (n->num_queues + 1) * 4);", "n->ns_size = bs_size / (uint64_t)n->num_namespaces;", "n->namespaces = g_new0(NvmeNamespace, n->num_namespaces);", "n->sq = g_new0(NvmeSQueue *, n->num_queues);", "n->cq = g_new0(NvmeCQueue *, n->num_queues);", "memory_region_init_io(&n->iomem, OBJECT(n), &nvme_mmio_ops, n,\n\"nvme\", n->reg_size);", "pci_register_bar(&n->parent_obj, 0,\nPCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_64,\n&n->iomem);", "msix_init_exclusive_bar(&n->parent_obj, n->num_queues, 4);", "id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID));", "id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));", "strpadcpy((char *)id->mn, sizeof(id->mn), \"QEMU NVMe Ctrl\", ' ');", "strpadcpy((char *)id->fr, sizeof(id->fr), \"1.0\", ' ');", "strpadcpy((char *)id->sn, sizeof(id->sn), n->serial, ' ');", "id->rab = 6;", "id->ieee[0] = 0x00;", "id->ieee[1] = 0x02;", "id->ieee[2] = 0xb3;", "id->oacs = cpu_to_le16(0);", "id->frmw = 7 << 1;", "id->lpa = 1 << 0;", "id->sqes = (0x6 << 4) | 0x6;", "id->cqes = (0x4 << 4) | 0x4;", "id->nn = cpu_to_le32(n->num_namespaces);", "id->psd[0].mp = cpu_to_le16(0x9c4);", "id->psd[0].enlat = cpu_to_le32(0x10);", "id->psd[0].exlat = cpu_to_le32(0x4);", "n->bar.cap = 0;", "NVME_CAP_SET_MQES(n->bar.cap, 0x7ff);", "NVME_CAP_SET_CQR(n->bar.cap, 1);", "NVME_CAP_SET_AMS(n->bar.cap, 1);", "NVME_CAP_SET_TO(n->bar.cap, 0xf);", "NVME_CAP_SET_CSS(n->bar.cap, 1);", "n->bar.vs = 0x00010001;", "n->bar.intmc = n->bar.intms = 0;", "for (VAR_1 = 0; VAR_1 < n->num_namespaces; VAR_1++) {", "NvmeNamespace *ns = &n->namespaces[VAR_1];", "NvmeIdNs *id_ns = &ns->id_ns;", "id_ns->nsfeat = 0;", "id_ns->nlbaf = 0;", "id_ns->flbas = 0;", "id_ns->mc = 0;", "id_ns->dpc = 0;", "id_ns->dps = 0;", "id_ns->lbaf[0].ds = BDRV_SECTOR_BITS;", "id_ns->ncap = id_ns->nuse = id_ns->nsze =\ncpu_to_le64(n->ns_size >>\nid_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(ns->id_ns.flbas)].ds);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81, 83, 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171, 173 ], [ 175 ], [ 177 ], [ 179 ] ]
25,816
int blk_get_max_transfer_length(BlockBackend *blk) { BlockDriverState *bs = blk_bs(blk); if (bs) { return bs->bl.max_transfer_length; } else { return 0; } }
false
qemu
24ce9a20260713e86377cfa78fb8699335759f4f
int blk_get_max_transfer_length(BlockBackend *blk) { BlockDriverState *bs = blk_bs(blk); if (bs) { return bs->bl.max_transfer_length; } else { return 0; } }
{ "code": [], "line_no": [] }
int FUNC_0(BlockBackend *VAR_0) { BlockDriverState *bs = blk_bs(VAR_0); if (bs) { return bs->bl.max_transfer_length; } else { return 0; } }
[ "int FUNC_0(BlockBackend *VAR_0)\n{", "BlockDriverState *bs = blk_bs(VAR_0);", "if (bs) {", "return bs->bl.max_transfer_length;", "} else {", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
25,817
START_TEST(qstring_append_chr_test) { int i; QString *qstring; const char *str = "qstring append char unit-test"; qstring = qstring_new(); for (i = 0; str[i]; i++) qstring_append_chr(qstring, str[i]); fail_unless(strcmp(str, qstring_get_str(qstring)) == 0); QDECREF(qstring); }
false
qemu
0ac7cc2af500b948510f2481c22e84a57b0a2447
START_TEST(qstring_append_chr_test) { int i; QString *qstring; const char *str = "qstring append char unit-test"; qstring = qstring_new(); for (i = 0; str[i]; i++) qstring_append_chr(qstring, str[i]); fail_unless(strcmp(str, qstring_get_str(qstring)) == 0); QDECREF(qstring); }
{ "code": [], "line_no": [] }
FUNC_0(VAR_0) { int VAR_1; QString *qstring; const char *VAR_2 = "qstring append char unit-test"; qstring = qstring_new(); for (VAR_1 = 0; VAR_2[VAR_1]; VAR_1++) qstring_append_chr(qstring, VAR_2[VAR_1]); fail_unless(strcmp(VAR_2, qstring_get_str(qstring)) == 0); QDECREF(qstring); }
[ "FUNC_0(VAR_0)\n{", "int VAR_1;", "QString *qstring;", "const char *VAR_2 = \"qstring append char unit-test\";", "qstring = qstring_new();", "for (VAR_1 = 0; VAR_2[VAR_1]; VAR_1++)", "qstring_append_chr(qstring, VAR_2[VAR_1]);", "fail_unless(strcmp(VAR_2, qstring_get_str(qstring)) == 0);", "QDECREF(qstring);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ] ]
25,818
static int ftp_get_line(FTPContext *s, char *line, int line_size) { int ch; char *q = line; int ori_block_flag = s->conn_control_block_flag; for (;;) { ch = ftp_getc(s); if (ch < 0) { s->conn_control_block_flag = ori_block_flag; return ch; } if (ch == '\n') { /* process line */ if (q > line && q[-1] == '\r') q--; *q = '\0'; s->conn_control_block_flag = ori_block_flag; return 0; } else { s->conn_control_block_flag = 0; /* line need to be finished */ if ((q - line) < line_size - 1) *q++ = ch; } } }
false
FFmpeg
247e658784ead984f96021acb9c95052ba599f26
static int ftp_get_line(FTPContext *s, char *line, int line_size) { int ch; char *q = line; int ori_block_flag = s->conn_control_block_flag; for (;;) { ch = ftp_getc(s); if (ch < 0) { s->conn_control_block_flag = ori_block_flag; return ch; } if (ch == '\n') { if (q > line && q[-1] == '\r') q--; *q = '\0'; s->conn_control_block_flag = ori_block_flag; return 0; } else { s->conn_control_block_flag = 0; if ((q - line) < line_size - 1) *q++ = ch; } } }
{ "code": [], "line_no": [] }
static int FUNC_0(FTPContext *VAR_0, char *VAR_1, int VAR_2) { int VAR_3; char *VAR_4 = VAR_1; int VAR_5 = VAR_0->conn_control_block_flag; for (;;) { VAR_3 = ftp_getc(VAR_0); if (VAR_3 < 0) { VAR_0->conn_control_block_flag = VAR_5; return VAR_3; } if (VAR_3 == '\n') { if (VAR_4 > VAR_1 && VAR_4[-1] == '\r') VAR_4--; *VAR_4 = '\0'; VAR_0->conn_control_block_flag = VAR_5; return 0; } else { VAR_0->conn_control_block_flag = 0; if ((VAR_4 - VAR_1) < VAR_2 - 1) *VAR_4++ = VAR_3; } } }
[ "static int FUNC_0(FTPContext *VAR_0, char *VAR_1, int VAR_2)\n{", "int VAR_3;", "char *VAR_4 = VAR_1;", "int VAR_5 = VAR_0->conn_control_block_flag;", "for (;;) {", "VAR_3 = ftp_getc(VAR_0);", "if (VAR_3 < 0) {", "VAR_0->conn_control_block_flag = VAR_5;", "return VAR_3;", "}", "if (VAR_3 == '\\n') {", "if (VAR_4 > VAR_1 && VAR_4[-1] == '\\r')\nVAR_4--;", "*VAR_4 = '\\0';", "VAR_0->conn_control_block_flag = VAR_5;", "return 0;", "} else {", "VAR_0->conn_control_block_flag = 0;", "if ((VAR_4 - VAR_1) < VAR_2 - 1)\n*VAR_4++ = VAR_3;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ] ]
25,819
static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) { BDRVRawState *s = bs->opaque; if (s->offset || s->has_size) { return -ENOTSUP; } return bdrv_co_ioctl(bs->file->bs, req, buf); }
false
qemu
2e6fc7eb1a4af1b127df5f07b8bb28af891946fa
static int raw_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) { BDRVRawState *s = bs->opaque; if (s->offset || s->has_size) { return -ENOTSUP; } return bdrv_co_ioctl(bs->file->bs, req, buf); }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, unsigned long int VAR_1, void *VAR_2) { BDRVRawState *s = VAR_0->opaque; if (s->offset || s->has_size) { return -ENOTSUP; } return bdrv_co_ioctl(VAR_0->file->VAR_0, VAR_1, VAR_2); }
[ "static int FUNC_0(BlockDriverState *VAR_0, unsigned long int VAR_1, void *VAR_2)\n{", "BDRVRawState *s = VAR_0->opaque;", "if (s->offset || s->has_size) {", "return -ENOTSUP;", "}", "return bdrv_co_ioctl(VAR_0->file->VAR_0, VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
25,820
static void lsi_io_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { LSIState *s = opaque; lsi_reg_writeb(s, addr & 0xff, val); }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void lsi_io_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { LSIState *s = opaque; lsi_reg_writeb(s, addr & 0xff, val); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { LSIState *s = VAR_0; lsi_reg_writeb(s, VAR_1 & 0xff, VAR_2); }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "LSIState *s = VAR_0;", "lsi_reg_writeb(s, VAR_1 & 0xff, VAR_2);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
25,821
void input_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) { int64_t value = 0; char *enum_str; assert(strings); visit_type_str(v, &enum_str, name, errp); if (error_is_set(errp)) { return; } while (strings[value] != NULL) { if (strcmp(strings[value], enum_str) == 0) { break; } value++; } if (strings[value] == NULL) { error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null"); g_free(enum_str); return; } g_free(enum_str); *obj = value; }
false
qemu
94c3db85b4cc1d4e078859834a761bcc9d988780
void input_type_enum(Visitor *v, int *obj, const char *strings[], const char *kind, const char *name, Error **errp) { int64_t value = 0; char *enum_str; assert(strings); visit_type_str(v, &enum_str, name, errp); if (error_is_set(errp)) { return; } while (strings[value] != NULL) { if (strcmp(strings[value], enum_str) == 0) { break; } value++; } if (strings[value] == NULL) { error_set(errp, QERR_INVALID_PARAMETER, name ? name : "null"); g_free(enum_str); return; } g_free(enum_str); *obj = value; }
{ "code": [], "line_no": [] }
void FUNC_0(Visitor *VAR_0, int *VAR_1, const char *VAR_2[], const char *VAR_3, const char *VAR_4, Error **VAR_5) { int64_t value = 0; char *VAR_6; assert(VAR_2); visit_type_str(VAR_0, &VAR_6, VAR_4, VAR_5); if (error_is_set(VAR_5)) { return; } while (VAR_2[value] != NULL) { if (strcmp(VAR_2[value], VAR_6) == 0) { break; } value++; } if (VAR_2[value] == NULL) { error_set(VAR_5, QERR_INVALID_PARAMETER, VAR_4 ? VAR_4 : "null"); g_free(VAR_6); return; } g_free(VAR_6); *VAR_1 = value; }
[ "void FUNC_0(Visitor *VAR_0, int *VAR_1, const char *VAR_2[],\nconst char *VAR_3, const char *VAR_4,\nError **VAR_5)\n{", "int64_t value = 0;", "char *VAR_6;", "assert(VAR_2);", "visit_type_str(VAR_0, &VAR_6, VAR_4, VAR_5);", "if (error_is_set(VAR_5)) {", "return;", "}", "while (VAR_2[value] != NULL) {", "if (strcmp(VAR_2[value], VAR_6) == 0) {", "break;", "}", "value++;", "}", "if (VAR_2[value] == NULL) {", "error_set(VAR_5, QERR_INVALID_PARAMETER, VAR_4 ? VAR_4 : \"null\");", "g_free(VAR_6);", "return;", "}", "g_free(VAR_6);", "*VAR_1 = value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ] ]
25,822
int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) { CPUState *cpu = ENV_GET_CPU(env); TaskState *ts = cpu->opaque; struct emulated_sigtable *k; struct sigqueue *q, **pq; abi_ulong handler; int queue; trace_user_queue_signal(env, sig); k = &ts->sigtab[sig - 1]; queue = gdb_queuesig (); handler = sigact_table[sig - 1]._sa_handler; if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { /* Guest has blocked SIGSEGV but we got one anyway. Assume this * is a forced SIGSEGV (ie one the kernel handles via force_sig_info * because it got a real MMU fault). A blocked SIGSEGV in that * situation is treated as if using the default handler. This is * not correct if some other process has randomly sent us a SIGSEGV * via kill(), but that is not easy to distinguish at this point, * so we assume it doesn't happen. */ handler = TARGET_SIG_DFL; } if (!queue && handler == TARGET_SIG_DFL) { if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); return 0; } else /* default handler : ignore some signal. The other are fatal */ if (sig != TARGET_SIGCHLD && sig != TARGET_SIGURG && sig != TARGET_SIGWINCH && sig != TARGET_SIGCONT) { force_sig(sig); } else { return 0; /* indicate ignored */ } } else if (!queue && handler == TARGET_SIG_IGN) { /* ignore signal */ return 0; } else if (!queue && handler == TARGET_SIG_ERR) { force_sig(sig); } else { pq = &k->first; if (sig < TARGET_SIGRTMIN) { /* if non real time signal, we queue exactly one signal */ if (!k->pending) q = &k->info; else return 0; } else { if (!k->pending) { /* first signal */ q = &k->info; } else { q = alloc_sigqueue(env); if (!q) return -EAGAIN; while (*pq != NULL) pq = &(*pq)->next; } } *pq = q; q->info = *info; q->next = NULL; k->pending = 1; /* signal that a new signal is pending */ atomic_set(&ts->signal_pending, 1); return 1; /* indicates that the signal was queued */ } }
false
qemu
c19c1578f8a9b894f5e368e35139620a98bf6a69
int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info) { CPUState *cpu = ENV_GET_CPU(env); TaskState *ts = cpu->opaque; struct emulated_sigtable *k; struct sigqueue *q, **pq; abi_ulong handler; int queue; trace_user_queue_signal(env, sig); k = &ts->sigtab[sig - 1]; queue = gdb_queuesig (); handler = sigact_table[sig - 1]._sa_handler; if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { handler = TARGET_SIG_DFL; } if (!queue && handler == TARGET_SIG_DFL) { if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); return 0; } else if (sig != TARGET_SIGCHLD && sig != TARGET_SIGURG && sig != TARGET_SIGWINCH && sig != TARGET_SIGCONT) { force_sig(sig); } else { return 0; } } else if (!queue && handler == TARGET_SIG_IGN) { return 0; } else if (!queue && handler == TARGET_SIG_ERR) { force_sig(sig); } else { pq = &k->first; if (sig < TARGET_SIGRTMIN) { if (!k->pending) q = &k->info; else return 0; } else { if (!k->pending) { q = &k->info; } else { q = alloc_sigqueue(env); if (!q) return -EAGAIN; while (*pq != NULL) pq = &(*pq)->next; } } *pq = q; q->info = *info; q->next = NULL; k->pending = 1; atomic_set(&ts->signal_pending, 1); return 1; } }
{ "code": [], "line_no": [] }
int FUNC_0(CPUArchState *VAR_0, int VAR_1, target_siginfo_t *VAR_2) { CPUState *cpu = ENV_GET_CPU(VAR_0); TaskState *ts = cpu->opaque; struct emulated_sigtable *VAR_3; struct sigqueue *VAR_4, **VAR_5; abi_ulong handler; int VAR_6; trace_user_queue_signal(VAR_0, VAR_1); VAR_3 = &ts->sigtab[VAR_1 - 1]; VAR_6 = gdb_queuesig (); handler = sigact_table[VAR_1 - 1]._sa_handler; if (VAR_1 == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { handler = TARGET_SIG_DFL; } if (!VAR_6 && handler == TARGET_SIG_DFL) { if (VAR_1 == TARGET_SIGTSTP || VAR_1 == TARGET_SIGTTIN || VAR_1 == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); return 0; } else if (VAR_1 != TARGET_SIGCHLD && VAR_1 != TARGET_SIGURG && VAR_1 != TARGET_SIGWINCH && VAR_1 != TARGET_SIGCONT) { force_sig(VAR_1); } else { return 0; } } else if (!VAR_6 && handler == TARGET_SIG_IGN) { return 0; } else if (!VAR_6 && handler == TARGET_SIG_ERR) { force_sig(VAR_1); } else { VAR_5 = &VAR_3->first; if (VAR_1 < TARGET_SIGRTMIN) { if (!VAR_3->pending) VAR_4 = &VAR_3->VAR_2; else return 0; } else { if (!VAR_3->pending) { VAR_4 = &VAR_3->VAR_2; } else { VAR_4 = alloc_sigqueue(VAR_0); if (!VAR_4) return -EAGAIN; while (*VAR_5 != NULL) VAR_5 = &(*VAR_5)->next; } } *VAR_5 = VAR_4; VAR_4->VAR_2 = *VAR_2; VAR_4->next = NULL; VAR_3->pending = 1; atomic_set(&ts->signal_pending, 1); return 1; } }
[ "int FUNC_0(CPUArchState *VAR_0, int VAR_1, target_siginfo_t *VAR_2)\n{", "CPUState *cpu = ENV_GET_CPU(VAR_0);", "TaskState *ts = cpu->opaque;", "struct emulated_sigtable *VAR_3;", "struct sigqueue *VAR_4, **VAR_5;", "abi_ulong handler;", "int VAR_6;", "trace_user_queue_signal(VAR_0, VAR_1);", "VAR_3 = &ts->sigtab[VAR_1 - 1];", "VAR_6 = gdb_queuesig ();", "handler = sigact_table[VAR_1 - 1]._sa_handler;", "if (VAR_1 == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) {", "handler = TARGET_SIG_DFL;", "}", "if (!VAR_6 && handler == TARGET_SIG_DFL) {", "if (VAR_1 == TARGET_SIGTSTP || VAR_1 == TARGET_SIGTTIN || VAR_1 == TARGET_SIGTTOU) {", "kill(getpid(),SIGSTOP);", "return 0;", "} else", "if (VAR_1 != TARGET_SIGCHLD &&\nVAR_1 != TARGET_SIGURG &&\nVAR_1 != TARGET_SIGWINCH &&\nVAR_1 != TARGET_SIGCONT) {", "force_sig(VAR_1);", "} else {", "return 0;", "}", "} else if (!VAR_6 && handler == TARGET_SIG_IGN) {", "return 0;", "} else if (!VAR_6 && handler == TARGET_SIG_ERR) {", "force_sig(VAR_1);", "} else {", "VAR_5 = &VAR_3->first;", "if (VAR_1 < TARGET_SIGRTMIN) {", "if (!VAR_3->pending)\nVAR_4 = &VAR_3->VAR_2;", "else\nreturn 0;", "} else {", "if (!VAR_3->pending) {", "VAR_4 = &VAR_3->VAR_2;", "} else {", "VAR_4 = alloc_sigqueue(VAR_0);", "if (!VAR_4)\nreturn -EAGAIN;", "while (*VAR_5 != NULL)\nVAR_5 = &(*VAR_5)->next;", "}", "}", "*VAR_5 = VAR_4;", "VAR_4->VAR_2 = *VAR_2;", "VAR_4->next = NULL;", "VAR_3->pending = 1;", "atomic_set(&ts->signal_pending, 1);", "return 1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ] ]
25,823
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int i; int w= s->width; int h= s->height; InternalBuffer *buf; int *picture_number; if(pic->data[0]!=NULL) { av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n"); return -1; } if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) { av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n"); return -1; } if(avcodec_check_dimensions(s,w,h)) return -1; if(s->internal_buffer==NULL){ s->internal_buffer= av_mallocz(INTERNAL_BUFFER_SIZE*sizeof(InternalBuffer)); } #if 0 s->internal_buffer= av_fast_realloc( s->internal_buffer, &s->internal_buffer_size, sizeof(InternalBuffer)*FFMAX(99, s->internal_buffer_count+1)/*FIXME*/ ); #endif buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num; //FIXME ugly hack (*picture_number)++; if(buf->base[0]){ pic->age= *picture_number - buf->last_pic_num; buf->last_pic_num= *picture_number; }else{ int h_chroma_shift, v_chroma_shift; int pixel_size, size[3]; AVPicture picture; avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); if(!(s->flags&CODEC_FLAG_EMU_EDGE)){ w+= EDGE_WIDTH*2; h+= EDGE_WIDTH*2; } avpicture_fill(&picture, NULL, s->pix_fmt, w, h); pixel_size= picture.linesize[0]*8 / w; //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", (int)picture.data[1], w, h, s->pix_fmt); assert(pixel_size>=1); //FIXME next ensures that linesize= 2^x uvlinesize, thats needed because some MC code assumes it if(pixel_size == 3*8) w= ALIGN(w, STRIDE_ALIGN<<h_chroma_shift); else w= ALIGN(pixel_size*w, STRIDE_ALIGN<<(h_chroma_shift+3)) / pixel_size; size[1] = avpicture_fill(&picture, NULL, s->pix_fmt, w, h); size[0] = picture.linesize[0] * h; size[1] -= size[0]; if(picture.data[2]) size[1]= size[2]= size[1]/2; else size[2]= 0; buf->last_pic_num= -256*256*256*64; memset(buf->base, 0, sizeof(buf->base)); memset(buf->data, 0, sizeof(buf->data)); for(i=0; i<3 && size[i]; i++){ const int h_shift= i==0 ? 0 : h_chroma_shift; const int v_shift= i==0 ? 0 : v_chroma_shift; buf->linesize[i]= picture.linesize[i]; buf->base[i]= av_malloc(size[i]+16); //FIXME 16 if(buf->base[i]==NULL) return -1; memset(buf->base[i], 128, size[i]); // no edge if EDEG EMU or not planar YUV, we check for PAL8 redundantly to protect against a exploitable bug regression ... if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) buf->data[i] = buf->base[i]; else buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN); } pic->age= 256*256*256*64; } pic->type= FF_BUFFER_TYPE_INTERNAL; for(i=0; i<4; i++){ pic->base[i]= buf->base[i]; pic->data[i]= buf->data[i]; pic->linesize[i]= buf->linesize[i]; } s->internal_buffer_count++; return 0; }
true
FFmpeg
5b67307a6898d9b1b1b78034d4f4fa79932d91bf
int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ int i; int w= s->width; int h= s->height; InternalBuffer *buf; int *picture_number; if(pic->data[0]!=NULL) { av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n"); return -1; } if(s->internal_buffer_count >= INTERNAL_BUFFER_SIZE) { av_log(s, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n"); return -1; } if(avcodec_check_dimensions(s,w,h)) return -1; if(s->internal_buffer==NULL){ s->internal_buffer= av_mallocz(INTERNAL_BUFFER_SIZE*sizeof(InternalBuffer)); } #if 0 s->internal_buffer= av_fast_realloc( s->internal_buffer, &s->internal_buffer_size, sizeof(InternalBuffer)*FFMAX(99, s->internal_buffer_count+1) ); #endif buf= &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; picture_number= &(((InternalBuffer*)s->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num; (*picture_number)++; if(buf->base[0]){ pic->age= *picture_number - buf->last_pic_num; buf->last_pic_num= *picture_number; }else{ int h_chroma_shift, v_chroma_shift; int pixel_size, size[3]; AVPicture picture; avcodec_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); if(!(s->flags&CODEC_FLAG_EMU_EDGE)){ w+= EDGE_WIDTH*2; h+= EDGE_WIDTH*2; } avpicture_fill(&picture, NULL, s->pix_fmt, w, h); pixel_size= picture.linesize[0]*8 / w; assert(pixel_size>=1); if(pixel_size == 3*8) w= ALIGN(w, STRIDE_ALIGN<<h_chroma_shift); else w= ALIGN(pixel_size*w, STRIDE_ALIGN<<(h_chroma_shift+3)) / pixel_size; size[1] = avpicture_fill(&picture, NULL, s->pix_fmt, w, h); size[0] = picture.linesize[0] * h; size[1] -= size[0]; if(picture.data[2]) size[1]= size[2]= size[1]/2; else size[2]= 0; buf->last_pic_num= -256*256*256*64; memset(buf->base, 0, sizeof(buf->base)); memset(buf->data, 0, sizeof(buf->data)); for(i=0; i<3 && size[i]; i++){ const int h_shift= i==0 ? 0 : h_chroma_shift; const int v_shift= i==0 ? 0 : v_chroma_shift; buf->linesize[i]= picture.linesize[i]; buf->base[i]= av_malloc(size[i]+16); if(buf->base[i]==NULL) return -1; memset(buf->base[i], 128, size[i]); if((s->flags&CODEC_FLAG_EMU_EDGE) || (s->pix_fmt == PIX_FMT_PAL8) || !size[2]) buf->data[i] = buf->base[i]; else buf->data[i] = buf->base[i] + ALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), STRIDE_ALIGN); } pic->age= 256*256*256*64; } pic->type= FF_BUFFER_TYPE_INTERNAL; for(i=0; i<4; i++){ pic->base[i]= buf->base[i]; pic->data[i]= buf->data[i]; pic->linesize[i]= buf->linesize[i]; } s->internal_buffer_count++; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){ int VAR_2; int VAR_3= VAR_0->width; int VAR_4= VAR_0->height; InternalBuffer *buf; int *VAR_5; if(VAR_1->data[0]!=NULL) { av_log(VAR_0, AV_LOG_ERROR, "VAR_1->data[0]!=NULL in FUNC_0\n"); return -1; } if(VAR_0->internal_buffer_count >= INTERNAL_BUFFER_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "internal_buffer_count overflow (missing release_buffer?)\n"); return -1; } if(avcodec_check_dimensions(VAR_0,VAR_3,VAR_4)) return -1; if(VAR_0->internal_buffer==NULL){ VAR_0->internal_buffer= av_mallocz(INTERNAL_BUFFER_SIZE*sizeof(InternalBuffer)); } #if 0 VAR_0->internal_buffer= av_fast_realloc( VAR_0->internal_buffer, &VAR_0->internal_buffer_size, sizeof(InternalBuffer)*FFMAX(99, VAR_0->internal_buffer_count+1) ); #endif buf= &((InternalBuffer*)VAR_0->internal_buffer)[VAR_0->internal_buffer_count]; VAR_5= &(((InternalBuffer*)VAR_0->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num; (*VAR_5)++; if(buf->base[0]){ VAR_1->age= *VAR_5 - buf->last_pic_num; buf->last_pic_num= *VAR_5; }else{ int VAR_6, VAR_7; int VAR_8, VAR_9[3]; AVPicture picture; avcodec_get_chroma_sub_sample(VAR_0->pix_fmt, &VAR_6, &VAR_7); if(!(VAR_0->flags&CODEC_FLAG_EMU_EDGE)){ VAR_3+= EDGE_WIDTH*2; VAR_4+= EDGE_WIDTH*2; } avpicture_fill(&picture, NULL, VAR_0->pix_fmt, VAR_3, VAR_4); VAR_8= picture.linesize[0]*8 / VAR_3; assert(VAR_8>=1); if(VAR_8 == 3*8) VAR_3= ALIGN(VAR_3, STRIDE_ALIGN<<VAR_6); else VAR_3= ALIGN(VAR_8*VAR_3, STRIDE_ALIGN<<(VAR_6+3)) / VAR_8; VAR_9[1] = avpicture_fill(&picture, NULL, VAR_0->pix_fmt, VAR_3, VAR_4); VAR_9[0] = picture.linesize[0] * VAR_4; VAR_9[1] -= VAR_9[0]; if(picture.data[2]) VAR_9[1]= VAR_9[2]= VAR_9[1]/2; else VAR_9[2]= 0; buf->last_pic_num= -256*256*256*64; memset(buf->base, 0, sizeof(buf->base)); memset(buf->data, 0, sizeof(buf->data)); for(VAR_2=0; VAR_2<3 && VAR_9[VAR_2]; VAR_2++){ const int VAR_10= VAR_2==0 ? 0 : VAR_6; const int VAR_11= VAR_2==0 ? 0 : VAR_7; buf->linesize[VAR_2]= picture.linesize[VAR_2]; buf->base[VAR_2]= av_malloc(VAR_9[VAR_2]+16); if(buf->base[VAR_2]==NULL) return -1; memset(buf->base[VAR_2], 128, VAR_9[VAR_2]); if((VAR_0->flags&CODEC_FLAG_EMU_EDGE) || (VAR_0->pix_fmt == PIX_FMT_PAL8) || !VAR_9[2]) buf->data[VAR_2] = buf->base[VAR_2]; else buf->data[VAR_2] = buf->base[VAR_2] + ALIGN((buf->linesize[VAR_2]*EDGE_WIDTH>>VAR_11) + (EDGE_WIDTH>>VAR_10), STRIDE_ALIGN); } VAR_1->age= 256*256*256*64; } VAR_1->type= FF_BUFFER_TYPE_INTERNAL; for(VAR_2=0; VAR_2<4; VAR_2++){ VAR_1->base[VAR_2]= buf->base[VAR_2]; VAR_1->data[VAR_2]= buf->data[VAR_2]; VAR_1->linesize[VAR_2]= buf->linesize[VAR_2]; } VAR_0->internal_buffer_count++; return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1){", "int VAR_2;", "int VAR_3= VAR_0->width;", "int VAR_4= VAR_0->height;", "InternalBuffer *buf;", "int *VAR_5;", "if(VAR_1->data[0]!=NULL) {", "av_log(VAR_0, AV_LOG_ERROR, \"VAR_1->data[0]!=NULL in FUNC_0\\n\");", "return -1;", "}", "if(VAR_0->internal_buffer_count >= INTERNAL_BUFFER_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"internal_buffer_count overflow (missing release_buffer?)\\n\");", "return -1;", "}", "if(avcodec_check_dimensions(VAR_0,VAR_3,VAR_4))\nreturn -1;", "if(VAR_0->internal_buffer==NULL){", "VAR_0->internal_buffer= av_mallocz(INTERNAL_BUFFER_SIZE*sizeof(InternalBuffer));", "}", "#if 0\nVAR_0->internal_buffer= av_fast_realloc(\nVAR_0->internal_buffer,\n&VAR_0->internal_buffer_size,\nsizeof(InternalBuffer)*FFMAX(99, VAR_0->internal_buffer_count+1)\n);", "#endif\nbuf= &((InternalBuffer*)VAR_0->internal_buffer)[VAR_0->internal_buffer_count];", "VAR_5= &(((InternalBuffer*)VAR_0->internal_buffer)[INTERNAL_BUFFER_SIZE-1]).last_pic_num;", "(*VAR_5)++;", "if(buf->base[0]){", "VAR_1->age= *VAR_5 - buf->last_pic_num;", "buf->last_pic_num= *VAR_5;", "}else{", "int VAR_6, VAR_7;", "int VAR_8, VAR_9[3];", "AVPicture picture;", "avcodec_get_chroma_sub_sample(VAR_0->pix_fmt, &VAR_6, &VAR_7);", "if(!(VAR_0->flags&CODEC_FLAG_EMU_EDGE)){", "VAR_3+= EDGE_WIDTH*2;", "VAR_4+= EDGE_WIDTH*2;", "}", "avpicture_fill(&picture, NULL, VAR_0->pix_fmt, VAR_3, VAR_4);", "VAR_8= picture.linesize[0]*8 / VAR_3;", "assert(VAR_8>=1);", "if(VAR_8 == 3*8)\nVAR_3= ALIGN(VAR_3, STRIDE_ALIGN<<VAR_6);", "else\nVAR_3= ALIGN(VAR_8*VAR_3, STRIDE_ALIGN<<(VAR_6+3)) / VAR_8;", "VAR_9[1] = avpicture_fill(&picture, NULL, VAR_0->pix_fmt, VAR_3, VAR_4);", "VAR_9[0] = picture.linesize[0] * VAR_4;", "VAR_9[1] -= VAR_9[0];", "if(picture.data[2])\nVAR_9[1]= VAR_9[2]= VAR_9[1]/2;", "else\nVAR_9[2]= 0;", "buf->last_pic_num= -256*256*256*64;", "memset(buf->base, 0, sizeof(buf->base));", "memset(buf->data, 0, sizeof(buf->data));", "for(VAR_2=0; VAR_2<3 && VAR_9[VAR_2]; VAR_2++){", "const int VAR_10= VAR_2==0 ? 0 : VAR_6;", "const int VAR_11= VAR_2==0 ? 0 : VAR_7;", "buf->linesize[VAR_2]= picture.linesize[VAR_2];", "buf->base[VAR_2]= av_malloc(VAR_9[VAR_2]+16);", "if(buf->base[VAR_2]==NULL) return -1;", "memset(buf->base[VAR_2], 128, VAR_9[VAR_2]);", "if((VAR_0->flags&CODEC_FLAG_EMU_EDGE) || (VAR_0->pix_fmt == PIX_FMT_PAL8) || !VAR_9[2])\nbuf->data[VAR_2] = buf->base[VAR_2];", "else\nbuf->data[VAR_2] = buf->base[VAR_2] + ALIGN((buf->linesize[VAR_2]*EDGE_WIDTH>>VAR_11) + (EDGE_WIDTH>>VAR_10), STRIDE_ALIGN);", "}", "VAR_1->age= 256*256*256*64;", "}", "VAR_1->type= FF_BUFFER_TYPE_INTERNAL;", "for(VAR_2=0; VAR_2<4; VAR_2++){", "VAR_1->base[VAR_2]= buf->base[VAR_2];", "VAR_1->data[VAR_2]= buf->data[VAR_2];", "VAR_1->linesize[VAR_2]= buf->linesize[VAR_2];", "}", "VAR_0->internal_buffer_count++;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15, 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20, 21, 22, 23, 24, 25 ], [ 26, 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 45 ], [ 47, 48 ], [ 49, 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54, 55 ], [ 56, 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 69, 70 ], [ 71, 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ] ]
25,824
static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) { TM2Huff huff; int res = 0; huff.val_bits = get_bits(&ctx->gb, 5); huff.max_bits = get_bits(&ctx->gb, 5); huff.min_bits = get_bits(&ctx->gb, 5); huff.nodes = get_bits_long(&ctx->gb, 17); huff.num = 0; /* check for correct codes parameters */ if((huff.val_bits < 1) || (huff.val_bits > 32) || (huff.max_bits < 0) || (huff.max_bits > 32)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n", huff.val_bits, huff.max_bits); return -1; } if((huff.nodes <= 0) || (huff.nodes > 0x10000)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes); return -1; } /* one-node tree */ if(huff.max_bits == 0) huff.max_bits = 1; /* allocate space for codes - it is exactly ceil(nodes / 2) entries */ huff.max_num = (huff.nodes + 1) >> 1; huff.nums = av_mallocz(huff.max_num * sizeof(int)); huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t)); huff.lens = av_mallocz(huff.max_num * sizeof(int)); if(tm2_read_tree(ctx, 0, 0, &huff) == -1) res = -1; if(huff.num != huff.max_num) { av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n", huff.num, huff.max_num); res = -1; } /* convert codes to vlc_table */ if(res != -1) { int i; res = init_vlc(&code->vlc, huff.max_bits, huff.max_num, huff.lens, sizeof(int), sizeof(int), huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0); if(res < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); res = -1; } else res = 0; if(res != -1) { code->bits = huff.max_bits; code->length = huff.max_num; code->recode = av_malloc(code->length * sizeof(int)); for(i = 0; i < code->length; i++) code->recode[i] = huff.nums[i]; } } /* free allocated memory */ av_free(huff.nums); av_free(huff.bits); av_free(huff.lens); return res; }
true
FFmpeg
b7b1509d06d3696d3b944791227fe198ded0654b
static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code) { TM2Huff huff; int res = 0; huff.val_bits = get_bits(&ctx->gb, 5); huff.max_bits = get_bits(&ctx->gb, 5); huff.min_bits = get_bits(&ctx->gb, 5); huff.nodes = get_bits_long(&ctx->gb, 17); huff.num = 0; if((huff.val_bits < 1) || (huff.val_bits > 32) || (huff.max_bits < 0) || (huff.max_bits > 32)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %i, max code length: %i\n", huff.val_bits, huff.max_bits); return -1; } if((huff.nodes <= 0) || (huff.nodes > 0x10000)) { av_log(ctx->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %i\n", huff.nodes); return -1; } if(huff.max_bits == 0) huff.max_bits = 1; huff.max_num = (huff.nodes + 1) >> 1; huff.nums = av_mallocz(huff.max_num * sizeof(int)); huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t)); huff.lens = av_mallocz(huff.max_num * sizeof(int)); if(tm2_read_tree(ctx, 0, 0, &huff) == -1) res = -1; if(huff.num != huff.max_num) { av_log(ctx->avctx, AV_LOG_ERROR, "Got less codes than expected: %i of %i\n", huff.num, huff.max_num); res = -1; } if(res != -1) { int i; res = init_vlc(&code->vlc, huff.max_bits, huff.max_num, huff.lens, sizeof(int), sizeof(int), huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0); if(res < 0) { av_log(ctx->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); res = -1; } else res = 0; if(res != -1) { code->bits = huff.max_bits; code->length = huff.max_num; code->recode = av_malloc(code->length * sizeof(int)); for(i = 0; i < code->length; i++) code->recode[i] = huff.nums[i]; } } av_free(huff.nums); av_free(huff.bits); av_free(huff.lens); return res; }
{ "code": [ " (huff.max_bits < 0) || (huff.max_bits > 32)) {" ], "line_no": [ 27 ] }
static int FUNC_0(TM2Context *VAR_0, TM2Codes *VAR_1) { TM2Huff huff; int VAR_2 = 0; huff.val_bits = get_bits(&VAR_0->gb, 5); huff.max_bits = get_bits(&VAR_0->gb, 5); huff.min_bits = get_bits(&VAR_0->gb, 5); huff.nodes = get_bits_long(&VAR_0->gb, 17); huff.num = 0; if((huff.val_bits < 1) || (huff.val_bits > 32) || (huff.max_bits < 0) || (huff.max_bits > 32)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect tree parameters - literal length: %VAR_3, max VAR_1 length: %VAR_3\n", huff.val_bits, huff.max_bits); return -1; } if((huff.nodes <= 0) || (huff.nodes > 0x10000)) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Incorrect number of Huffman tree nodes: %VAR_3\n", huff.nodes); return -1; } if(huff.max_bits == 0) huff.max_bits = 1; huff.max_num = (huff.nodes + 1) >> 1; huff.nums = av_mallocz(huff.max_num * sizeof(int)); huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t)); huff.lens = av_mallocz(huff.max_num * sizeof(int)); if(tm2_read_tree(VAR_0, 0, 0, &huff) == -1) VAR_2 = -1; if(huff.num != huff.max_num) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Got less codes than expected: %VAR_3 of %VAR_3\n", huff.num, huff.max_num); VAR_2 = -1; } if(VAR_2 != -1) { int VAR_3; VAR_2 = init_vlc(&VAR_1->vlc, huff.max_bits, huff.max_num, huff.lens, sizeof(int), sizeof(int), huff.bits, sizeof(uint32_t), sizeof(uint32_t), 0); if(VAR_2 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); VAR_2 = -1; } else VAR_2 = 0; if(VAR_2 != -1) { VAR_1->bits = huff.max_bits; VAR_1->length = huff.max_num; VAR_1->recode = av_malloc(VAR_1->length * sizeof(int)); for(VAR_3 = 0; VAR_3 < VAR_1->length; VAR_3++) VAR_1->recode[VAR_3] = huff.nums[VAR_3]; } } av_free(huff.nums); av_free(huff.bits); av_free(huff.lens); return VAR_2; }
[ "static int FUNC_0(TM2Context *VAR_0, TM2Codes *VAR_1)\n{", "TM2Huff huff;", "int VAR_2 = 0;", "huff.val_bits = get_bits(&VAR_0->gb, 5);", "huff.max_bits = get_bits(&VAR_0->gb, 5);", "huff.min_bits = get_bits(&VAR_0->gb, 5);", "huff.nodes = get_bits_long(&VAR_0->gb, 17);", "huff.num = 0;", "if((huff.val_bits < 1) || (huff.val_bits > 32) ||\n(huff.max_bits < 0) || (huff.max_bits > 32)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incorrect tree parameters - literal length: %VAR_3, max VAR_1 length: %VAR_3\\n\",\nhuff.val_bits, huff.max_bits);", "return -1;", "}", "if((huff.nodes <= 0) || (huff.nodes > 0x10000)) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Incorrect number of Huffman tree nodes: %VAR_3\\n\", huff.nodes);", "return -1;", "}", "if(huff.max_bits == 0)\nhuff.max_bits = 1;", "huff.max_num = (huff.nodes + 1) >> 1;", "huff.nums = av_mallocz(huff.max_num * sizeof(int));", "huff.bits = av_mallocz(huff.max_num * sizeof(uint32_t));", "huff.lens = av_mallocz(huff.max_num * sizeof(int));", "if(tm2_read_tree(VAR_0, 0, 0, &huff) == -1)\nVAR_2 = -1;", "if(huff.num != huff.max_num) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Got less codes than expected: %VAR_3 of %VAR_3\\n\",\nhuff.num, huff.max_num);", "VAR_2 = -1;", "}", "if(VAR_2 != -1) {", "int VAR_3;", "VAR_2 = init_vlc(&VAR_1->vlc, huff.max_bits, huff.max_num,\nhuff.lens, sizeof(int), sizeof(int),\nhuff.bits, sizeof(uint32_t), sizeof(uint32_t), 0);", "if(VAR_2 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Cannot build VLC table\\n\");", "VAR_2 = -1;", "} else", "VAR_2 = 0;", "if(VAR_2 != -1) {", "VAR_1->bits = huff.max_bits;", "VAR_1->length = huff.max_num;", "VAR_1->recode = av_malloc(VAR_1->length * sizeof(int));", "for(VAR_3 = 0; VAR_3 < VAR_1->length; VAR_3++)", "VAR_1->recode[VAR_3] = huff.nums[VAR_3];", "}", "}", "av_free(huff.nums);", "av_free(huff.bits);", "av_free(huff.lens);", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47, 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 85 ], [ 87 ], [ 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ] ]
25,825
void gen_intermediate_code_internal(XtensaCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUXtensaState *env = &cpu->env; DisasContext dc; int insn_count = 0; int j, lj = -1; uint16_t *gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; int max_insns = tb->cflags & CF_COUNT_MASK; uint32_t pc_start = tb->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.tb = tb; dc.pc = pc_start; dc.ring = tb->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (tb->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = tb->flags & XTENSA_TBFLAG_DEBUG; dc.icount = tb->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (tb->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; init_litbase(&dc); init_sar_tracker(&dc); reset_used_window(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(); if (tb->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc.pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = insn_count; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (insn_count + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int label = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, label); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(label); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++insn_count; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && tcg_ctx.gen_opc_ptr < gen_opc_end); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(tb, insn_count); *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; memset(tcg_ctx.gen_opc_instr_start + lj + 1, 0, (j - lj) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { tb->size = dc.pc - pc_start; tb->icount = insn_count; } }
true
qemu
2db59a76c421cdd1039d10e32a9798952d3ff5ba
void gen_intermediate_code_internal(XtensaCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUXtensaState *env = &cpu->env; DisasContext dc; int insn_count = 0; int j, lj = -1; uint16_t *gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; int max_insns = tb->cflags & CF_COUNT_MASK; uint32_t pc_start = tb->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.tb = tb; dc.pc = pc_start; dc.ring = tb->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (tb->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = tb->flags & XTENSA_TBFLAG_DEBUG; dc.icount = tb->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (tb->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; init_litbase(&dc); init_sar_tracker(&dc); reset_used_window(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(); if (tb->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc.pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = insn_count; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (insn_count + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int label = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, label); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(label); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++insn_count; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && tcg_ctx.gen_opc_ptr < gen_opc_end); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(tb, insn_count); *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; memset(tcg_ctx.gen_opc_instr_start + lj + 1, 0, (j - lj) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { tb->size = dc.pc - pc_start; tb->icount = insn_count; } }
{ "code": [ " break;", " } else {", " reset_used_window(&dc);" ], "line_no": [ 195, 267, 71 ] }
void FUNC_0(XtensaCPU *VAR_0, TranslationBlock *VAR_1, bool VAR_2) { CPUState *cs = CPU(VAR_0); CPUXtensaState *env = &VAR_0->env; DisasContext dc; int VAR_3 = 0; int VAR_4, VAR_5 = -1; uint16_t *gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; int VAR_6 = VAR_1->cflags & CF_COUNT_MASK; uint32_t pc_start = VAR_1->pc; uint32_t next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; if (VAR_6 == 0) { VAR_6 = CF_COUNT_MASK; } dc.config = env->config; dc.singlestep_enabled = cs->singlestep_enabled; dc.VAR_1 = VAR_1; dc.pc = pc_start; dc.ring = VAR_1->flags & XTENSA_TBFLAG_RING_MASK; dc.cring = (VAR_1->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring; dc.lbeg = env->sregs[LBEG]; dc.lend = env->sregs[LEND]; dc.is_jmp = DISAS_NEXT; dc.ccount_delta = 0; dc.debug = VAR_1->flags & XTENSA_TBFLAG_DEBUG; dc.icount = VAR_1->flags & XTENSA_TBFLAG_ICOUNT; dc.cpenable = (VAR_1->flags & XTENSA_TBFLAG_CPENABLE_MASK) >> XTENSA_TBFLAG_CPENABLE_SHIFT; init_litbase(&dc); init_sar_tracker(&dc); reset_used_window(&dc); if (dc.icount) { dc.next_icount = tcg_temp_local_new_i32(); } gen_tb_start(); if (VAR_1->flags & XTENSA_TBFLAG_EXCEPTION) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); } do { check_breakpoint(env, &dc); if (VAR_2) { VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (VAR_5 < VAR_4) { VAR_5++; while (VAR_5 < VAR_4) { tcg_ctx.gen_opc_instr_start[VAR_5++] = 0; } } tcg_ctx.gen_opc_pc[VAR_5] = dc.pc; tcg_ctx.gen_opc_instr_start[VAR_5] = 1; tcg_ctx.gen_opc_icount[VAR_5] = VAR_3; } if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) { tcg_gen_debug_insn_start(dc.pc); } ++dc.ccount_delta; if (VAR_3 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc.icount) { int VAR_7 = gen_new_label(); tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1); tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, VAR_7); tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]); if (dc.debug) { gen_debug_exception(&dc, DEBUGCAUSE_IC); } gen_set_label(VAR_7); } if (dc.debug) { gen_ibreak_check(env, &dc); } disas_xtensa_insn(env, &dc); ++VAR_3; if (dc.icount) { tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount); } if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, dc.pc); gen_exception(&dc, EXCP_DEBUG); break; } } while (dc.is_jmp == DISAS_NEXT && VAR_3 < VAR_6 && dc.pc < next_page_start && dc.pc + xtensa_insn_len(env, &dc) <= next_page_start && tcg_ctx.gen_opc_ptr < gen_opc_end); reset_litbase(&dc); reset_sar_tracker(&dc); if (dc.icount) { tcg_temp_free(dc.next_icount); } if (VAR_1->cflags & CF_LAST_IO) { gen_io_end(); } if (dc.is_jmp == DISAS_NEXT) { gen_jumpi(&dc, dc.pc, 0); } gen_tb_end(VAR_1, VAR_3); *tcg_ctx.gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(env, pc_start, dc.pc - pc_start, 0); qemu_log("\n"); } #endif if (VAR_2) { VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; memset(tcg_ctx.gen_opc_instr_start + VAR_5 + 1, 0, (VAR_4 - VAR_5) * sizeof(tcg_ctx.gen_opc_instr_start[0])); } else { VAR_1->size = dc.pc - pc_start; VAR_1->icount = VAR_3; } }
[ "void FUNC_0(XtensaCPU *VAR_0,\nTranslationBlock *VAR_1, bool VAR_2)\n{", "CPUState *cs = CPU(VAR_0);", "CPUXtensaState *env = &VAR_0->env;", "DisasContext dc;", "int VAR_3 = 0;", "int VAR_4, VAR_5 = -1;", "uint16_t *gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;", "int VAR_6 = VAR_1->cflags & CF_COUNT_MASK;", "uint32_t pc_start = VAR_1->pc;", "uint32_t next_page_start =\n(pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;", "if (VAR_6 == 0) {", "VAR_6 = CF_COUNT_MASK;", "}", "dc.config = env->config;", "dc.singlestep_enabled = cs->singlestep_enabled;", "dc.VAR_1 = VAR_1;", "dc.pc = pc_start;", "dc.ring = VAR_1->flags & XTENSA_TBFLAG_RING_MASK;", "dc.cring = (VAR_1->flags & XTENSA_TBFLAG_EXCM) ? 0 : dc.ring;", "dc.lbeg = env->sregs[LBEG];", "dc.lend = env->sregs[LEND];", "dc.is_jmp = DISAS_NEXT;", "dc.ccount_delta = 0;", "dc.debug = VAR_1->flags & XTENSA_TBFLAG_DEBUG;", "dc.icount = VAR_1->flags & XTENSA_TBFLAG_ICOUNT;", "dc.cpenable = (VAR_1->flags & XTENSA_TBFLAG_CPENABLE_MASK) >>\nXTENSA_TBFLAG_CPENABLE_SHIFT;", "init_litbase(&dc);", "init_sar_tracker(&dc);", "reset_used_window(&dc);", "if (dc.icount) {", "dc.next_icount = tcg_temp_local_new_i32();", "}", "gen_tb_start();", "if (VAR_1->flags & XTENSA_TBFLAG_EXCEPTION) {", "tcg_gen_movi_i32(cpu_pc, dc.pc);", "gen_exception(&dc, EXCP_DEBUG);", "}", "do {", "check_breakpoint(env, &dc);", "if (VAR_2) {", "VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "if (VAR_5 < VAR_4) {", "VAR_5++;", "while (VAR_5 < VAR_4) {", "tcg_ctx.gen_opc_instr_start[VAR_5++] = 0;", "}", "}", "tcg_ctx.gen_opc_pc[VAR_5] = dc.pc;", "tcg_ctx.gen_opc_instr_start[VAR_5] = 1;", "tcg_ctx.gen_opc_icount[VAR_5] = VAR_3;", "}", "if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {", "tcg_gen_debug_insn_start(dc.pc);", "}", "++dc.ccount_delta;", "if (VAR_3 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) {", "gen_io_start();", "}", "if (dc.icount) {", "int VAR_7 = gen_new_label();", "tcg_gen_addi_i32(dc.next_icount, cpu_SR[ICOUNT], 1);", "tcg_gen_brcondi_i32(TCG_COND_NE, dc.next_icount, 0, VAR_7);", "tcg_gen_mov_i32(dc.next_icount, cpu_SR[ICOUNT]);", "if (dc.debug) {", "gen_debug_exception(&dc, DEBUGCAUSE_IC);", "}", "gen_set_label(VAR_7);", "}", "if (dc.debug) {", "gen_ibreak_check(env, &dc);", "}", "disas_xtensa_insn(env, &dc);", "++VAR_3;", "if (dc.icount) {", "tcg_gen_mov_i32(cpu_SR[ICOUNT], dc.next_icount);", "}", "if (cs->singlestep_enabled) {", "tcg_gen_movi_i32(cpu_pc, dc.pc);", "gen_exception(&dc, EXCP_DEBUG);", "break;", "}", "} while (dc.is_jmp == DISAS_NEXT &&", "VAR_3 < VAR_6 &&\ndc.pc < next_page_start &&\ndc.pc + xtensa_insn_len(env, &dc) <= next_page_start &&\ntcg_ctx.gen_opc_ptr < gen_opc_end);", "reset_litbase(&dc);", "reset_sar_tracker(&dc);", "if (dc.icount) {", "tcg_temp_free(dc.next_icount);", "}", "if (VAR_1->cflags & CF_LAST_IO) {", "gen_io_end();", "}", "if (dc.is_jmp == DISAS_NEXT) {", "gen_jumpi(&dc, dc.pc, 0);", "}", "gen_tb_end(VAR_1, VAR_3);", "*tcg_ctx.gen_opc_ptr = INDEX_op_end;", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"----------------\\n\");", "qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));", "log_target_disas(env, pc_start, dc.pc - pc_start, 0);", "qemu_log(\"\\n\");", "}", "#endif\nif (VAR_2) {", "VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "memset(tcg_ctx.gen_opc_instr_start + VAR_5 + 1, 0,\n(VAR_4 - VAR_5) * sizeof(tcg_ctx.gen_opc_instr_start[0]));", "} else {", "VAR_1->size = dc.pc - pc_start;", "VAR_1->icount = VAR_3;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201, 203, 205, 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ] ]
25,826
static void dump_map_entry(OutputFormat output_format, MapEntry *e, MapEntry *next) { switch (output_format) { case OFORMAT_HUMAN: if ((e->flags & BDRV_BLOCK_DATA) && !(e->flags & BDRV_BLOCK_OFFSET_VALID)) { error_report("File contains external, encrypted or compressed clusters."); exit(1); } if ((e->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) { printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n", e->start, e->length, e->offset, e->bs->filename); } /* This format ignores the distinction between 0, ZERO and ZERO|DATA. * Modify the flags here to allow more coalescing. */ if (next && (next->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) { next->flags &= ~BDRV_BLOCK_DATA; next->flags |= BDRV_BLOCK_ZERO; } break; case OFORMAT_JSON: printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64", \"depth\": %d," " \"zero\": %s, \"data\": %s", (e->start == 0 ? "[" : ",\n"), e->start, e->length, e->depth, (e->flags & BDRV_BLOCK_ZERO) ? "true" : "false", (e->flags & BDRV_BLOCK_DATA) ? "true" : "false"); if (e->flags & BDRV_BLOCK_OFFSET_VALID) { printf(", 'offset': %"PRId64"", e->offset); } putchar('}'); if (!next) { printf("]\n"); } break; } }
true
qemu
c745bfb4300206280ce6156b4bafe765f610057c
static void dump_map_entry(OutputFormat output_format, MapEntry *e, MapEntry *next) { switch (output_format) { case OFORMAT_HUMAN: if ((e->flags & BDRV_BLOCK_DATA) && !(e->flags & BDRV_BLOCK_OFFSET_VALID)) { error_report("File contains external, encrypted or compressed clusters."); exit(1); } if ((e->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) { printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n", e->start, e->length, e->offset, e->bs->filename); } if (next && (next->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) { next->flags &= ~BDRV_BLOCK_DATA; next->flags |= BDRV_BLOCK_ZERO; } break; case OFORMAT_JSON: printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64", \"depth\": %d," " \"zero\": %s, \"data\": %s", (e->start == 0 ? "[" : ",\n"), e->start, e->length, e->depth, (e->flags & BDRV_BLOCK_ZERO) ? "true" : "false", (e->flags & BDRV_BLOCK_DATA) ? "true" : "false"); if (e->flags & BDRV_BLOCK_OFFSET_VALID) { printf(", 'offset': %"PRId64"", e->offset); } putchar('}'); if (!next) { printf("]\n"); } break; } }
{ "code": [ " printf(\", 'offset': %\"PRId64\"\", e->offset);" ], "line_no": [ 63 ] }
static void FUNC_0(OutputFormat VAR_0, MapEntry *VAR_1, MapEntry *VAR_2) { switch (VAR_0) { case OFORMAT_HUMAN: if ((VAR_1->flags & BDRV_BLOCK_DATA) && !(VAR_1->flags & BDRV_BLOCK_OFFSET_VALID)) { error_report("File contains external, encrypted or compressed clusters."); exit(1); } if ((VAR_1->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) { printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n", VAR_1->start, VAR_1->length, VAR_1->offset, VAR_1->bs->filename); } if (VAR_2 && (VAR_2->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) { VAR_2->flags &= ~BDRV_BLOCK_DATA; VAR_2->flags |= BDRV_BLOCK_ZERO; } break; case OFORMAT_JSON: printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64", \"depth\": %d," " \"zero\": %s, \"data\": %s", (VAR_1->start == 0 ? "[" : ",\n"), VAR_1->start, VAR_1->length, VAR_1->depth, (VAR_1->flags & BDRV_BLOCK_ZERO) ? "true" : "false", (VAR_1->flags & BDRV_BLOCK_DATA) ? "true" : "false"); if (VAR_1->flags & BDRV_BLOCK_OFFSET_VALID) { printf(", 'offset': %"PRId64"", VAR_1->offset); } putchar('}'); if (!VAR_2) { printf("]\n"); } break; } }
[ "static void FUNC_0(OutputFormat VAR_0, MapEntry *VAR_1,\nMapEntry *VAR_2)\n{", "switch (VAR_0) {", "case OFORMAT_HUMAN:\nif ((VAR_1->flags & BDRV_BLOCK_DATA) &&\n!(VAR_1->flags & BDRV_BLOCK_OFFSET_VALID)) {", "error_report(\"File contains external, encrypted or compressed clusters.\");", "exit(1);", "}", "if ((VAR_1->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) {", "printf(\"%#-16\"PRIx64\"%#-16\"PRIx64\"%#-16\"PRIx64\"%s\\n\",\nVAR_1->start, VAR_1->length, VAR_1->offset, VAR_1->bs->filename);", "}", "if (VAR_2 &&\n(VAR_2->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) {", "VAR_2->flags &= ~BDRV_BLOCK_DATA;", "VAR_2->flags |= BDRV_BLOCK_ZERO;", "}", "break;", "case OFORMAT_JSON:\nprintf(\"%s{ \\\"start\\\": %\"PRId64\", \\\"length\\\": %\"PRId64\", \\\"depth\\\": %d,\"", "\" \\\"zero\\\": %s, \\\"data\\\": %s\",\n(VAR_1->start == 0 ? \"[\" : \",\\n\"),\nVAR_1->start, VAR_1->length, VAR_1->depth,\n(VAR_1->flags & BDRV_BLOCK_ZERO) ? \"true\" : \"false\",\n(VAR_1->flags & BDRV_BLOCK_DATA) ? \"true\" : \"false\");", "if (VAR_1->flags & BDRV_BLOCK_OFFSET_VALID) {", "printf(\", 'offset': %\"PRId64\"\", VAR_1->offset);", "}", "putchar('}');", "if (!VAR_2) {", "printf(\"]\\n\");", "}", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51, 53, 55, 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
25,827
int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, CharDriverState *chrA, CharDriverState *chrB, int clock, int it_shift) { DeviceState *dev; SysBusDevice *s; SerialState *d; dev = qdev_create(NULL, "escc"); qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", clock); qdev_prop_set_uint32(dev, "it_shift", it_shift); qdev_prop_set_chr(dev, "chrB", chrB); qdev_prop_set_chr(dev, "chrA", chrA); qdev_prop_set_uint32(dev, "chnBtype", ser); qdev_prop_set_uint32(dev, "chnAtype", ser); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, irqB); sysbus_connect_irq(s, 1, irqA); if (base) { sysbus_mmio_map(s, 0, base); } d = FROM_SYSBUS(SerialState, s); return d->mmio_index; }
true
qemu
e23a1b33b53d25510320b26d9f154e19c6c99725
int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, CharDriverState *chrA, CharDriverState *chrB, int clock, int it_shift) { DeviceState *dev; SysBusDevice *s; SerialState *d; dev = qdev_create(NULL, "escc"); qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", clock); qdev_prop_set_uint32(dev, "it_shift", it_shift); qdev_prop_set_chr(dev, "chrB", chrB); qdev_prop_set_chr(dev, "chrA", chrA); qdev_prop_set_uint32(dev, "chnBtype", ser); qdev_prop_set_uint32(dev, "chnAtype", ser); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, irqB); sysbus_connect_irq(s, 1, irqA); if (base) { sysbus_mmio_map(s, 0, base); } d = FROM_SYSBUS(SerialState, s); return d->mmio_index; }
{ "code": [ " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);", " qdev_init(dev);" ], "line_no": [ 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 ] }
int FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1, qemu_irq VAR_2, CharDriverState *VAR_3, CharDriverState *VAR_4, int VAR_5, int VAR_6) { DeviceState *dev; SysBusDevice *s; SerialState *d; dev = qdev_create(NULL, "escc"); qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", VAR_5); qdev_prop_set_uint32(dev, "VAR_6", VAR_6); qdev_prop_set_chr(dev, "VAR_4", VAR_4); qdev_prop_set_chr(dev, "VAR_3", VAR_3); qdev_prop_set_uint32(dev, "chnBtype", ser); qdev_prop_set_uint32(dev, "chnAtype", ser); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, VAR_2); sysbus_connect_irq(s, 1, VAR_1); if (VAR_0) { sysbus_mmio_map(s, 0, VAR_0); } d = FROM_SYSBUS(SerialState, s); return d->mmio_index; }
[ "int FUNC_0(target_phys_addr_t VAR_0, qemu_irq VAR_1, qemu_irq VAR_2,\nCharDriverState *VAR_3, CharDriverState *VAR_4,\nint VAR_5, int VAR_6)\n{", "DeviceState *dev;", "SysBusDevice *s;", "SerialState *d;", "dev = qdev_create(NULL, \"escc\");", "qdev_prop_set_uint32(dev, \"disabled\", 0);", "qdev_prop_set_uint32(dev, \"frequency\", VAR_5);", "qdev_prop_set_uint32(dev, \"VAR_6\", VAR_6);", "qdev_prop_set_chr(dev, \"VAR_4\", VAR_4);", "qdev_prop_set_chr(dev, \"VAR_3\", VAR_3);", "qdev_prop_set_uint32(dev, \"chnBtype\", ser);", "qdev_prop_set_uint32(dev, \"chnAtype\", ser);", "qdev_init(dev);", "s = sysbus_from_qdev(dev);", "sysbus_connect_irq(s, 0, VAR_2);", "sysbus_connect_irq(s, 1, VAR_1);", "if (VAR_0) {", "sysbus_mmio_map(s, 0, VAR_0);", "}", "d = FROM_SYSBUS(SerialState, s);", "return d->mmio_index;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ] ]
25,829
static void wmv2_idct_row(short * b) { int s1, s2; int a0, a1, a2, a3, a4, a5, a6, a7; /* step 1 */ a1 = W1 * b[1] + W7 * b[7]; a7 = W7 * b[1] - W1 * b[7]; a5 = W5 * b[5] + W3 * b[3]; a3 = W3 * b[5] - W5 * b[3]; a2 = W2 * b[2] + W6 * b[6]; a6 = W6 * b[2] - W2 * b[6]; a0 = W0 * b[0] + W0 * b[4]; a4 = W0 * b[0] - W0 * b[4]; /* step 2 */ s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; // 1, 3, 5, 7 s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8; /* step 3 */ b[0] = (a0 + a2 + a1 + a5 + (1 << 7)) >> 8; b[1] = (a4 + a6 + s1 + (1 << 7)) >> 8; b[2] = (a4 - a6 + s2 + (1 << 7)) >> 8; b[3] = (a0 - a2 + a7 + a3 + (1 << 7)) >> 8; b[4] = (a0 - a2 - a7 - a3 + (1 << 7)) >> 8; b[5] = (a4 - a6 - s2 + (1 << 7)) >> 8; b[6] = (a4 + a6 - s1 + (1 << 7)) >> 8; b[7] = (a0 + a2 - a1 - a5 + (1 << 7)) >> 8; }
true
FFmpeg
df640dbbc949d0f4deefaf43e86b8bd50ae997cc
static void wmv2_idct_row(short * b) { int s1, s2; int a0, a1, a2, a3, a4, a5, a6, a7; a1 = W1 * b[1] + W7 * b[7]; a7 = W7 * b[1] - W1 * b[7]; a5 = W5 * b[5] + W3 * b[3]; a3 = W3 * b[5] - W5 * b[3]; a2 = W2 * b[2] + W6 * b[6]; a6 = W6 * b[2] - W2 * b[6]; a0 = W0 * b[0] + W0 * b[4]; a4 = W0 * b[0] - W0 * b[4]; s1 = (181 * (a1 - a5 + a7 - a3) + 128) >> 8; s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8; b[0] = (a0 + a2 + a1 + a5 + (1 << 7)) >> 8; b[1] = (a4 + a6 + s1 + (1 << 7)) >> 8; b[2] = (a4 - a6 + s2 + (1 << 7)) >> 8; b[3] = (a0 - a2 + a7 + a3 + (1 << 7)) >> 8; b[4] = (a0 - a2 - a7 - a3 + (1 << 7)) >> 8; b[5] = (a4 - a6 - s2 + (1 << 7)) >> 8; b[6] = (a4 + a6 - s1 + (1 << 7)) >> 8; b[7] = (a0 + a2 - a1 - a5 + (1 << 7)) >> 8; }
{ "code": [ " s2 = (181 * (a1 - a5 - a7 + a3) + 128) >> 8;" ], "line_no": [ 35 ] }
static void FUNC_0(short * VAR_0) { int VAR_1, VAR_2; int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; VAR_4 = W1 * VAR_0[1] + W7 * VAR_0[7]; VAR_10 = W7 * VAR_0[1] - W1 * VAR_0[7]; VAR_8 = W5 * VAR_0[5] + W3 * VAR_0[3]; VAR_6 = W3 * VAR_0[5] - W5 * VAR_0[3]; VAR_5 = W2 * VAR_0[2] + W6 * VAR_0[6]; VAR_9 = W6 * VAR_0[2] - W2 * VAR_0[6]; VAR_3 = W0 * VAR_0[0] + W0 * VAR_0[4]; VAR_7 = W0 * VAR_0[0] - W0 * VAR_0[4]; VAR_1 = (181 * (VAR_4 - VAR_8 + VAR_10 - VAR_6) + 128) >> 8; VAR_2 = (181 * (VAR_4 - VAR_8 - VAR_10 + VAR_6) + 128) >> 8; VAR_0[0] = (VAR_3 + VAR_5 + VAR_4 + VAR_8 + (1 << 7)) >> 8; VAR_0[1] = (VAR_7 + VAR_9 + VAR_1 + (1 << 7)) >> 8; VAR_0[2] = (VAR_7 - VAR_9 + VAR_2 + (1 << 7)) >> 8; VAR_0[3] = (VAR_3 - VAR_5 + VAR_10 + VAR_6 + (1 << 7)) >> 8; VAR_0[4] = (VAR_3 - VAR_5 - VAR_10 - VAR_6 + (1 << 7)) >> 8; VAR_0[5] = (VAR_7 - VAR_9 - VAR_2 + (1 << 7)) >> 8; VAR_0[6] = (VAR_7 + VAR_9 - VAR_1 + (1 << 7)) >> 8; VAR_0[7] = (VAR_3 + VAR_5 - VAR_4 - VAR_8 + (1 << 7)) >> 8; }
[ "static void FUNC_0(short * VAR_0)\n{", "int VAR_1, VAR_2;", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "VAR_4 = W1 * VAR_0[1] + W7 * VAR_0[7];", "VAR_10 = W7 * VAR_0[1] - W1 * VAR_0[7];", "VAR_8 = W5 * VAR_0[5] + W3 * VAR_0[3];", "VAR_6 = W3 * VAR_0[5] - W5 * VAR_0[3];", "VAR_5 = W2 * VAR_0[2] + W6 * VAR_0[6];", "VAR_9 = W6 * VAR_0[2] - W2 * VAR_0[6];", "VAR_3 = W0 * VAR_0[0] + W0 * VAR_0[4];", "VAR_7 = W0 * VAR_0[0] - W0 * VAR_0[4];", "VAR_1 = (181 * (VAR_4 - VAR_8 + VAR_10 - VAR_6) + 128) >> 8;", "VAR_2 = (181 * (VAR_4 - VAR_8 - VAR_10 + VAR_6) + 128) >> 8;", "VAR_0[0] = (VAR_3 + VAR_5 + VAR_4 + VAR_8 + (1 << 7)) >> 8;", "VAR_0[1] = (VAR_7 + VAR_9 + VAR_1 + (1 << 7)) >> 8;", "VAR_0[2] = (VAR_7 - VAR_9 + VAR_2 + (1 << 7)) >> 8;", "VAR_0[3] = (VAR_3 - VAR_5 + VAR_10 + VAR_6 + (1 << 7)) >> 8;", "VAR_0[4] = (VAR_3 - VAR_5 - VAR_10 - VAR_6 + (1 << 7)) >> 8;", "VAR_0[5] = (VAR_7 - VAR_9 - VAR_2 + (1 << 7)) >> 8;", "VAR_0[6] = (VAR_7 + VAR_9 - VAR_1 + (1 << 7)) >> 8;", "VAR_0[7] = (VAR_3 + VAR_5 - VAR_4 - VAR_8 + (1 << 7)) >> 8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
25,830
static void init_dev(tc58128_dev * dev, const char *filename) { int ret, blocks; dev->state = WAIT; dev->flash_contents = g_malloc0(FLASH_SIZE); memset(dev->flash_contents, 0xff, FLASH_SIZE); if (!dev->flash_contents) { fprintf(stderr, "could not alloc memory for flash\n"); exit(1); } if (filename) { /* Load flash image skipping the first block */ ret = load_image(filename, dev->flash_contents + 528 * 32); if (ret < 0) { fprintf(stderr, "ret=%d\n", ret); fprintf(stderr, "qemu: could not load flash image %s\n", filename); exit(1); } else { /* Build first block with number of blocks */ blocks = (ret + 528 * 32 - 1) / (528 * 32); dev->flash_contents[0] = blocks & 0xff; dev->flash_contents[1] = (blocks >> 8) & 0xff; dev->flash_contents[2] = (blocks >> 16) & 0xff; dev->flash_contents[3] = (blocks >> 24) & 0xff; fprintf(stderr, "loaded %d bytes for %s into flash\n", ret, filename); } } }
true
qemu
35914dc7240f7d81e22219217cfa826c2c383e7b
static void init_dev(tc58128_dev * dev, const char *filename) { int ret, blocks; dev->state = WAIT; dev->flash_contents = g_malloc0(FLASH_SIZE); memset(dev->flash_contents, 0xff, FLASH_SIZE); if (!dev->flash_contents) { fprintf(stderr, "could not alloc memory for flash\n"); exit(1); } if (filename) { ret = load_image(filename, dev->flash_contents + 528 * 32); if (ret < 0) { fprintf(stderr, "ret=%d\n", ret); fprintf(stderr, "qemu: could not load flash image %s\n", filename); exit(1); } else { blocks = (ret + 528 * 32 - 1) / (528 * 32); dev->flash_contents[0] = blocks & 0xff; dev->flash_contents[1] = (blocks >> 8) & 0xff; dev->flash_contents[2] = (blocks >> 16) & 0xff; dev->flash_contents[3] = (blocks >> 24) & 0xff; fprintf(stderr, "loaded %d bytes for %s into flash\n", ret, filename); } } }
{ "code": [ " dev->flash_contents = g_malloc0(FLASH_SIZE);", " if (!dev->flash_contents) {", "\tfprintf(stderr, \"could not alloc memory for flash\\n\");", "\texit(1);" ], "line_no": [ 11, 15, 17, 19 ] }
static void FUNC_0(tc58128_dev * VAR_0, const char *VAR_1) { int VAR_2, VAR_3; VAR_0->state = WAIT; VAR_0->flash_contents = g_malloc0(FLASH_SIZE); memset(VAR_0->flash_contents, 0xff, FLASH_SIZE); if (!VAR_0->flash_contents) { fprintf(stderr, "could not alloc memory for flash\n"); exit(1); } if (VAR_1) { VAR_2 = load_image(VAR_1, VAR_0->flash_contents + 528 * 32); if (VAR_2 < 0) { fprintf(stderr, "VAR_2=%d\n", VAR_2); fprintf(stderr, "qemu: could not load flash image %s\n", VAR_1); exit(1); } else { VAR_3 = (VAR_2 + 528 * 32 - 1) / (528 * 32); VAR_0->flash_contents[0] = VAR_3 & 0xff; VAR_0->flash_contents[1] = (VAR_3 >> 8) & 0xff; VAR_0->flash_contents[2] = (VAR_3 >> 16) & 0xff; VAR_0->flash_contents[3] = (VAR_3 >> 24) & 0xff; fprintf(stderr, "loaded %d bytes for %s into flash\n", VAR_2, VAR_1); } } }
[ "static void FUNC_0(tc58128_dev * VAR_0, const char *VAR_1)\n{", "int VAR_2, VAR_3;", "VAR_0->state = WAIT;", "VAR_0->flash_contents = g_malloc0(FLASH_SIZE);", "memset(VAR_0->flash_contents, 0xff, FLASH_SIZE);", "if (!VAR_0->flash_contents) {", "fprintf(stderr, \"could not alloc memory for flash\\n\");", "exit(1);", "}", "if (VAR_1) {", "VAR_2 = load_image(VAR_1, VAR_0->flash_contents + 528 * 32);", "if (VAR_2 < 0) {", "fprintf(stderr, \"VAR_2=%d\\n\", VAR_2);", "fprintf(stderr, \"qemu: could not load flash image %s\\n\",\nVAR_1);", "exit(1);", "} else {", "VAR_3 = (VAR_2 + 528 * 32 - 1) / (528 * 32);", "VAR_0->flash_contents[0] = VAR_3 & 0xff;", "VAR_0->flash_contents[1] = (VAR_3 >> 8) & 0xff;", "VAR_0->flash_contents[2] = (VAR_3 >> 16) & 0xff;", "VAR_0->flash_contents[3] = (VAR_3 >> 24) & 0xff;", "fprintf(stderr, \"loaded %d bytes for %s into flash\\n\", VAR_2,\nVAR_1);", "}", "}", "}" ]
[ 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ] ]
25,832
int ff_h264_decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; /* avoid warning. FIXME: find a solution without slowing down the code */ if(h->slice_type_nos != AV_PICTURE_TYPE_I){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); } h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type_nos == AV_PICTURE_TYPE_B){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type_nos == AV_PICTURE_TYPE_P){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type_nos == AV_PICTURE_TYPE_I); if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_picture_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ unsigned int x; static const uint16_t mb_sizes[4] = {256,384,512,768}; const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3; // We assume these blocks are very rare so we do not optimize it. align_get_bits(&s->gb); // The pixels are stored in the same order as levels in h->mb array. for(x=0; x < mb_size; x++){ ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8); } // In deblocking, the quantizer is 0 s->current_picture.f.qscale_table[mb_xy] = 0; // All coeffs are present memset(h->non_zero_count[mb_xy], 16, 48); s->current_picture.f.mb_type[mb_xy] = mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_decode_neighbors(h, mb_type); fill_decode_caches(h, mb_type); //mb_pred if(IS_INTRA(mb_type)){ int pred_mode; // init_top_left_availability(h); if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } // fill_intra4x4_pred_table(h); for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } if(decode_chroma){ pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb)); if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; } else { h->chroma_pred_mode = DC_128_PRED8x8; } }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type_nos == AV_PICTURE_TYPE_B){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0]|h->sub_mb_type[1]|h->sub_mb_type[2]|h->sub_mb_type[3])) { ff_h264_pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type_nos == AV_PICTURE_TYPE_P); //FIXME SP correct ? for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ unsigned int tmp; if(ref_count == 1){ tmp= 0; }else if(ref_count == 2){ tmp= get_bits1(&s->gb)^1; }else{ tmp= get_ue_golomb_31(&s->gb); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } } ref[list][i]= tmp; }else{ //FIXME ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list)){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ ff_h264_pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; //FIXME we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ if(h->ref_count[list] == 1){ val= 0; }else if(h->ref_count[list] == 2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ //FIXME optimize if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(decode_chroma){ if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp [cbp]; }else{ if(cbp > 15){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp]; else cbp= golomb_to_inter_cbp_gray[cbp]; } } if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb); } h->cbp= h->cbp_table[mb_xy]= cbp; s->current_picture.f.mb_type[mb_xy] = mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i4x4, i8x8, chroma_idx; int dquant; int ret; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8; const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8); if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; } dquant= get_se_golomb(&s->gb); s->qscale += dquant; if(((unsigned)s->qscale) > max_qp){ if(s->qscale<0) s->qscale+= max_qp+1; else s->qscale-= max_qp+1; if(((unsigned)s->qscale) > max_qp){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if( (ret = decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ){ return -1; } h->cbp_table[mb_xy] |= ret << 12; if(CHROMA444){ if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){ return -1; } if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ){ return -1; } } else if (CHROMA422) { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma422_dc_scan, NULL, 8) < 0) { return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; DCTELEM *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift); for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i4x4 = 0; i4x4 < 4; i4x4++) { const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4; if (decode_residual(h, gb, mb, index, scan + 1, qmul, 15) < 0) return -1; mb += 16 << pixel_shift; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else /* yuv420 */ { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 16*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } s->current_picture.f.qscale_table[mb_xy] = s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
true
FFmpeg
45b7bd7c53b41bc5ff6fc2158831f2b1b1256113
int ff_h264_decode_mb_cavlc(H264Context *h){ MpegEncContext * const s = &h->s; int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; mb_xy = h->mb_xy = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); cbp = 0; if(h->slice_type_nos != AV_PICTURE_TYPE_I){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); } decode_mb_skip(h); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = get_bits1(&s->gb); } h->prev_mb_skipped= 0; mb_type= get_ue_golomb(&s->gb); if(h->slice_type_nos == AV_PICTURE_TYPE_B){ if(mb_type < 23){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } }else if(h->slice_type_nos == AV_PICTURE_TYPE_P){ if(mb_type < 5){ partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(h->slice_type_nos == AV_PICTURE_TYPE_I); if(h->slice_type == AV_PICTURE_TYPE_SI && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->s.avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_picture_type_char(h->slice_type), s->mb_x, s->mb_y); return -1; } partition_count=0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)){ unsigned int x; static const uint16_t mb_sizes[4] = {256,384,512,768}; const int mb_size = mb_sizes[h->sps.chroma_format_idc]*h->sps.bit_depth_luma >> 3; align_get_bits(&s->gb); for(x=0; x < mb_size; x++){ ((uint8_t*)h->mb)[x]= get_bits(&s->gb, 8); } s->current_picture.f.qscale_table[mb_xy] = 0; memset(h->non_zero_count[mb_xy], 16, 48); s->current_picture.f.mb_type[mb_xy] = mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_decode_neighbors(h, mb_type); fill_decode_caches(h, mb_type); if(IS_INTRA(mb_type)){ int pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&s->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode= pred_intra_mode(h, i); if(!get_bits1(&s->gb)){ const int rem_mode= get_bits(&s->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); else h->intra4x4_pred_mode_cache[ scan8[i] ] = mode; } write_back_intra_pred_mode(h); if( ff_h264_check_intra4x4_pred_mode(h) < 0) return -1; }else{ h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode); if(h->intra16x16_pred_mode < 0) return -1; } if(decode_chroma){ pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb)); if(pred_mode < 0) return -1; h->chroma_pred_mode= pred_mode; } else { h->chroma_pred_mode = DC_128_PRED8x8; } }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if(h->slice_type_nos == AV_PICTURE_TYPE_B){ for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=13){ av_log(h->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0]|h->sub_mb_type[1]|h->sub_mb_type[2]|h->sub_mb_type[3])) { ff_h264_pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(h->slice_type_nos == AV_PICTURE_TYPE_P); for(i=0; i<4; i++){ h->sub_mb_type[i]= get_ue_golomb_31(&s->gb); if(h->sub_mb_type[i] >=4){ av_log(h->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", h->sub_mb_type[i], s->mb_x, s->mb_y); return -1; } sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for(list=0; list<h->list_count; list++){ int ref_count= IS_REF0(mb_type) ? 1 : h->ref_count[list]; for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ unsigned int tmp; if(ref_count == 1){ tmp= 0; }else if(ref_count == 2){ tmp= get_bits1(&s->gb)^1; }else{ tmp= get_ue_golomb_31(&s->gb); if(tmp>=ref_count){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ if(IS_DIRECT(h->sub_mb_type[i])) { h->ref_cache[list][ scan8[4*i] ] = h->ref_cache[list][ scan8[4*i]+1 ]; continue; } h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(h->sub_mb_type[i], 0, list)){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ ff_h264_pred_direct_motion(h, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ unsigned int val; if(IS_DIR(mb_type, 0, list)){ if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ if(h->ref_count[list] == 1){ val= 0; }else if(h->ref_count[list] == 2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ optimize if(h->ref_count[list]==1){ val= 0; }else if(h->ref_count[list]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= h->ref_count[list]){ av_log(h->s.avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&s->gb); my += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&s->gb); if(decode_chroma){ if(cbp > 47){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp[cbp]; else cbp= golomb_to_inter_cbp [cbp]; }else{ if(cbp > 15){ av_log(h->s.avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp]; else cbp= golomb_to_inter_cbp_gray[cbp]; } } if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ mb_type |= MB_TYPE_8x8DCT*get_bits1(&s->gb); } h->cbp= h->cbp_table[mb_xy]= cbp; s->current_picture.f.mb_type[mb_xy] = mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i4x4, i8x8, chroma_idx; int dquant; int ret; GetBitContext *gb= IS_INTRA(mb_type) ? h->intra_gb_ptr : h->inter_gb_ptr; const uint8_t *scan, *scan8x8; const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8); if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; } dquant= get_se_golomb(&s->gb); s->qscale += dquant; if(((unsigned)s->qscale) > max_qp){ if(s->qscale<0) s->qscale+= max_qp+1; else s->qscale-= max_qp+1; if(((unsigned)s->qscale) > max_qp){ av_log(h->s.avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, s->mb_x, s->mb_y); return -1; } } h->chroma_qp[0]= get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1]= get_chroma_qp(h, 1, s->qscale); if( (ret = decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ){ return -1; } h->cbp_table[mb_xy] |= ret << 12; if(CHROMA444){ if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ){ return -1; } if( decode_luma_residual(h, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ){ return -1; } } else if (CHROMA422) { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if (decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma422_dc_scan, NULL, 8) < 0) { return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; DCTELEM *mb = h->mb + (16*(16 + 16*chroma_idx) << pixel_shift); for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i4x4 = 0; i4x4 < 4; i4x4++) { const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4; if (decode_residual(h, gb, mb, index, scan + 1, qmul, 15) < 0) return -1; mb += 16 << pixel_shift; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if( decode_residual(h, gb, h->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX+chroma_idx, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 16*chroma_idx + i4x4; if( decode_residual(h, gb, h->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } }else{ fill_rectangle(&h->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&h->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } s->current_picture.f.qscale_table[mb_xy] = s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; }
{ "code": [ " h->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(h, h->intra16x16_pred_mode);", " pred_mode= ff_h264_check_intra_pred_mode(h, get_ue_golomb_31(&s->gb));" ], "line_no": [ 263, 273 ] }
int FUNC_0(H264Context *VAR_0){ MpegEncContext * const s = &VAR_0->s; int VAR_1; int VAR_2; unsigned int VAR_3, VAR_4; int VAR_5= VAR_0->pps.transform_8x8_mode; int VAR_6 = VAR_0->sps.chroma_format_idc == 1 || VAR_0->sps.chroma_format_idc == 2; const int VAR_7 = VAR_0->VAR_7; VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride; tprintf(s->avctx, "pic:%d mb:%d/%d\n", VAR_0->frame_num, s->mb_x, s->mb_y); VAR_4 = 0; if(VAR_0->slice_type_nos != AV_PICTURE_TYPE_I){ if(s->mb_skip_run==-1) s->mb_skip_run= get_ue_golomb(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ if(s->mb_skip_run==0) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb); } decode_mb_skip(VAR_0); return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) VAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb); } VAR_0->prev_mb_skipped= 0; VAR_3= get_ue_golomb(&s->gb); if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B){ if(VAR_3 < 23){ VAR_2= b_mb_type_info[VAR_3].VAR_2; VAR_3= b_mb_type_info[VAR_3].type; }else{ VAR_3 -= 23; goto decode_intra_mb; } }else if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_P){ if(VAR_3 < 5){ VAR_2= p_mb_type_info[VAR_3].VAR_2; VAR_3= p_mb_type_info[VAR_3].type; }else{ VAR_3 -= 5; goto decode_intra_mb; } }else{ assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_I); if(VAR_0->slice_type == AV_PICTURE_TYPE_SI && VAR_3) VAR_3--; decode_intra_mb: if(VAR_3 > 25){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_3 %d in %c slice too large at %d %d\n", VAR_3, av_get_picture_type_char(VAR_0->slice_type), s->mb_x, s->mb_y); return -1; } VAR_2=0; VAR_4= i_mb_type_info[VAR_3].VAR_4; VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_3].VAR_11; VAR_3= i_mb_type_info[VAR_3].type; } if(MB_FIELD) VAR_3 |= MB_TYPE_INTERLACED; VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num; if(IS_INTRA_PCM(VAR_3)){ unsigned int VAR_8; static const uint16_t VAR_9[4] = {256,384,512,768}; const int VAR_10 = VAR_9[VAR_0->sps.chroma_format_idc]*VAR_0->sps.bit_depth_luma >> 3; align_get_bits(&s->gb); for(VAR_8=0; VAR_8 < VAR_10; VAR_8++){ ((uint8_t*)VAR_0->mb)[VAR_8]= get_bits(&s->gb, 8); } s->current_picture.f.qscale_table[VAR_1] = 0; memset(VAR_0->non_zero_count[VAR_1], 16, 48); s->current_picture.f.VAR_3[VAR_1] = VAR_3; return 0; } if(MB_MBAFF){ VAR_0->ref_count[0] <<= 1; VAR_0->ref_count[1] <<= 1; } fill_decode_neighbors(VAR_0, VAR_3); fill_decode_caches(VAR_0, VAR_3); if(IS_INTRA(VAR_3)){ int VAR_11; if(IS_INTRA4x4(VAR_3)){ int VAR_22; int VAR_13 = 1; if(VAR_5 && get_bits1(&s->gb)){ VAR_3 |= MB_TYPE_8x8DCT; VAR_13 = 4; } for(VAR_22=0; VAR_22<16; VAR_22+=VAR_13){ int VAR_14= pred_intra_mode(VAR_0, VAR_22); if(!get_bits1(&s->gb)){ const int VAR_15= get_bits(&s->gb, 3); VAR_14 = VAR_15 + (VAR_15 >= VAR_14); } if(VAR_13==4) fill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_22] ], 2, 2, 8, VAR_14, 1 ); else VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_22] ] = VAR_14; } write_back_intra_pred_mode(VAR_0); if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0) return -1; }else{ VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(VAR_0, VAR_0->intra16x16_pred_mode); if(VAR_0->intra16x16_pred_mode < 0) return -1; } if(VAR_6){ VAR_11= ff_h264_check_intra_pred_mode(VAR_0, get_ue_golomb_31(&s->gb)); if(VAR_11 < 0) return -1; VAR_0->chroma_pred_mode= VAR_11; } else { VAR_0->chroma_pred_mode = DC_128_PRED8x8; } }else if(VAR_2==4){ int VAR_22, VAR_16, VAR_17[4], VAR_20, VAR_19[2][4]; if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B){ for(VAR_22=0; VAR_22<4; VAR_22++){ VAR_0->sub_mb_type[VAR_22]= get_ue_golomb_31(&s->gb); if(VAR_0->sub_mb_type[VAR_22] >=13){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", VAR_0->sub_mb_type[VAR_22], s->mb_x, s->mb_y); return -1; } VAR_17[VAR_22]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].VAR_2; VAR_0->sub_mb_type[VAR_22]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].type; } if( IS_DIRECT(VAR_0->sub_mb_type[0]|VAR_0->sub_mb_type[1]|VAR_0->sub_mb_type[2]|VAR_0->sub_mb_type[3])) { ff_h264_pred_direct_motion(VAR_0, &VAR_3); VAR_0->ref_cache[0][scan8[4]] = VAR_0->ref_cache[1][scan8[4]] = VAR_0->ref_cache[0][scan8[12]] = VAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_P); for(VAR_22=0; VAR_22<4; VAR_22++){ VAR_0->sub_mb_type[VAR_22]= get_ue_golomb_31(&s->gb); if(VAR_0->sub_mb_type[VAR_22] >=4){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", VAR_0->sub_mb_type[VAR_22], s->mb_x, s->mb_y); return -1; } VAR_17[VAR_22]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].VAR_2; VAR_0->sub_mb_type[VAR_22]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].type; } } for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ int ref_count= IS_REF0(VAR_3) ? 1 : VAR_0->ref_count[VAR_20]; for(VAR_22=0; VAR_22<4; VAR_22++){ if(IS_DIRECT(VAR_0->sub_mb_type[VAR_22])) continue; if(IS_DIR(VAR_0->sub_mb_type[VAR_22], 0, VAR_20)){ unsigned int tmp; if(ref_count == 1){ tmp= 0; }else if(ref_count == 2){ tmp= get_bits1(&s->gb)^1; }else{ tmp= get_ue_golomb_31(&s->gb); if(tmp>=ref_count){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_19 %u overflow\n", tmp); return -1; } } VAR_19[VAR_20][VAR_22]= tmp; }else{ VAR_19[VAR_20][VAR_22] = -1; } } } if(VAR_5) VAR_5 = get_dct8x8_allowed(VAR_0); for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ for(VAR_22=0; VAR_22<4; VAR_22++){ if(IS_DIRECT(VAR_0->sub_mb_type[VAR_22])) { VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22] ] = VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+1 ]; continue; } VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22] ]=VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+1 ]= VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+8 ]=VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+9 ]= VAR_19[VAR_20][VAR_22]; if(IS_DIR(VAR_0->sub_mb_type[VAR_22], 0, VAR_20)){ const int sub_mb_type= VAR_0->sub_mb_type[VAR_22]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(VAR_16=0; VAR_16<VAR_17[VAR_22]; VAR_16++){ int VAR_20, VAR_21; const int VAR_31= 4*VAR_22 + block_width*VAR_16; int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_20][ scan8[VAR_31] ]; pred_motion(VAR_0, VAR_31, block_width, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[VAR_31] ], &VAR_20, &VAR_21); VAR_20 += get_se_golomb(&s->gb); VAR_21 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_20, VAR_21); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_20; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_21; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= VAR_20; mv_cache[ 1 ][1]= VAR_21; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= VAR_20; mv_cache[ 8 ][1]= VAR_21; } mv_cache[ 0 ][0]= VAR_20; mv_cache[ 0 ][1]= VAR_21; } }else{ uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_20][ scan8[4*VAR_22] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(VAR_3)){ ff_h264_pred_direct_motion(VAR_0, &VAR_3); VAR_5 &= VAR_0->sps.direct_8x8_inference_flag; }else{ int VAR_20, VAR_20, VAR_21, VAR_22; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(VAR_3)){ for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ unsigned int val; if(IS_DIR(VAR_3, 0, VAR_20)){ if(VAR_0->ref_count[VAR_20]==1){ val= 0; }else if(VAR_0->ref_count[VAR_20]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= VAR_0->ref_count[VAR_20]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_19 %u overflow\n", val); return -1; } } fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] ], 4, 4, 8, val, 1); } } for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ if(IS_DIR(VAR_3, 0, VAR_20)){ pred_motion(VAR_0, 0, 4, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[0] ], &VAR_20, &VAR_21); VAR_20 += get_se_golomb(&s->gb); VAR_21 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_20, VAR_21); fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] ], 4, 4, 8, pack16to32(VAR_20,VAR_21), 4); } } } else if(IS_16X8(VAR_3)){ for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ for(VAR_22=0; VAR_22<2; VAR_22++){ unsigned int val; if(IS_DIR(VAR_3, VAR_22, VAR_20)){ if(VAR_0->ref_count[VAR_20] == 1){ val= 0; }else if(VAR_0->ref_count[VAR_20] == 2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= VAR_0->ref_count[VAR_20]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_19 %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] + 16*VAR_22 ], 4, 2, 8, val, 1); } } for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ for(VAR_22=0; VAR_22<2; VAR_22++){ unsigned int val; if(IS_DIR(VAR_3, VAR_22, VAR_20)){ pred_16x8_motion(VAR_0, 8*VAR_22, VAR_20, VAR_0->ref_cache[VAR_20][scan8[0] + 16*VAR_22], &VAR_20, &VAR_21); VAR_20 += get_se_golomb(&s->gb); VAR_21 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_20, VAR_21); val= pack16to32(VAR_20,VAR_21); }else val=0; fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] + 16*VAR_22 ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(VAR_3)); for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ for(VAR_22=0; VAR_22<2; VAR_22++){ unsigned int val; if(IS_DIR(VAR_3, VAR_22, VAR_20)){ optimize if(VAR_0->ref_count[VAR_20]==1){ val= 0; }else if(VAR_0->ref_count[VAR_20]==2){ val= get_bits1(&s->gb)^1; }else{ val= get_ue_golomb_31(&s->gb); if(val >= VAR_0->ref_count[VAR_20]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_19 %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] + 2*VAR_22 ], 2, 4, 8, val, 1); } } for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){ for(VAR_22=0; VAR_22<2; VAR_22++){ unsigned int val; if(IS_DIR(VAR_3, VAR_22, VAR_20)){ pred_8x16_motion(VAR_0, VAR_22*4, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[0] + 2*VAR_22 ], &VAR_20, &VAR_21); VAR_20 += get_se_golomb(&s->gb); VAR_21 += get_se_golomb(&s->gb); tprintf(s->avctx, "final mv:%d %d\n", VAR_20, VAR_21); val= pack16to32(VAR_20,VAR_21); }else val=0; fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] + 2*VAR_22 ], 2, 4, 8, val, 4); } } } } if(IS_INTER(VAR_3)) write_back_motion(VAR_0, VAR_3); if(!IS_INTRA16x16(VAR_3)){ VAR_4= get_ue_golomb(&s->gb); if(VAR_6){ if(VAR_4 > 47){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_4 too large (%u) at %d %d\n", VAR_4, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(VAR_3)) VAR_4= golomb_to_intra4x4_cbp[VAR_4]; else VAR_4= golomb_to_inter_cbp [VAR_4]; }else{ if(VAR_4 > 15){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_4 too large (%u) at %d %d\n", VAR_4, s->mb_x, s->mb_y); return -1; } if(IS_INTRA4x4(VAR_3)) VAR_4= golomb_to_intra4x4_cbp_gray[VAR_4]; else VAR_4= golomb_to_inter_cbp_gray[VAR_4]; } } if(VAR_5 && (VAR_4&15) && !IS_INTRA(VAR_3)){ VAR_3 |= MB_TYPE_8x8DCT*get_bits1(&s->gb); } VAR_0->VAR_4= VAR_0->cbp_table[VAR_1]= VAR_4; s->current_picture.f.VAR_3[VAR_1] = VAR_3; if(VAR_4 || IS_INTRA16x16(VAR_3)){ int VAR_22, VAR_23, VAR_24; int VAR_25; int VAR_26; GetBitContext *gb= IS_INTRA(VAR_3) ? VAR_0->intra_gb_ptr : VAR_0->inter_gb_ptr; const uint8_t *VAR_27, *scan8x8; const int VAR_28 = 51 + 6*(VAR_0->sps.bit_depth_luma-8); if(IS_INTERLACED(VAR_3)){ scan8x8= s->qscale ? VAR_0->field_scan8x8_cavlc : VAR_0->field_scan8x8_cavlc_q0; VAR_27= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0; }else{ scan8x8= s->qscale ? VAR_0->zigzag_scan8x8_cavlc : VAR_0->zigzag_scan8x8_cavlc_q0; VAR_27= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0; } VAR_25= get_se_golomb(&s->gb); s->qscale += VAR_25; if(((unsigned)s->qscale) > VAR_28){ if(s->qscale<0) s->qscale+= VAR_28+1; else s->qscale-= VAR_28+1; if(((unsigned)s->qscale) > VAR_28){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_25 out of range (%d) at %d %d\n", VAR_25, s->mb_x, s->mb_y); return -1; } } VAR_0->chroma_qp[0]= get_chroma_qp(VAR_0, 0, s->qscale); VAR_0->chroma_qp[1]= get_chroma_qp(VAR_0, 1, s->qscale); if( (VAR_26 = decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 0)) < 0 ){ return -1; } VAR_0->cbp_table[VAR_1] |= VAR_26 << 12; if(CHROMA444){ if( decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 1) < 0 ){ return -1; } if( decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 2) < 0 ){ return -1; } } else if (CHROMA422) { if(VAR_4&0x30){ for(VAR_24=0; VAR_24<2; VAR_24++) if (decode_residual(VAR_0, gb, VAR_0->mb + ((256 + 16*16*VAR_24) << VAR_7), CHROMA_DC_BLOCK_INDEX+VAR_24, chroma422_dc_scan, NULL, 8) < 0) { return -1; } } if(VAR_4&0x20){ for(VAR_24=0; VAR_24<2; VAR_24++){ const uint32_t *VAR_31 = VAR_0->dequant4_coeff[VAR_24+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_24]]; DCTELEM *mb = VAR_0->mb + (16*(16 + 16*VAR_24) << VAR_7); for (VAR_23 = 0; VAR_23 < 2; VAR_23++) { for (VAR_22 = 0; VAR_22 < 4; VAR_22++) { const int VAR_31 = 16 + 16*VAR_24 + 8*VAR_23 + VAR_22; if (decode_residual(VAR_0, gb, mb, VAR_31, VAR_27 + 1, VAR_31, 15) < 0) return -1; mb += 16 << VAR_7; } } } }else{ fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else { if(VAR_4&0x30){ for(VAR_24=0; VAR_24<2; VAR_24++) if( decode_residual(VAR_0, gb, VAR_0->mb + ((256 + 16*16*VAR_24) << VAR_7), CHROMA_DC_BLOCK_INDEX+VAR_24, chroma_dc_scan, NULL, 4) < 0){ return -1; } } if(VAR_4&0x20){ for(VAR_24=0; VAR_24<2; VAR_24++){ const uint32_t *VAR_31 = VAR_0->dequant4_coeff[VAR_24+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_24]]; for(VAR_22=0; VAR_22<4; VAR_22++){ const int VAR_31= 16 + 16*VAR_24 + VAR_22; if( decode_residual(VAR_0, gb, VAR_0->mb + (16*VAR_31 << VAR_7), VAR_31, VAR_27 + 1, VAR_31, 15) < 0){ return -1; } } } }else{ fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } }else{ fill_rectangle(&VAR_0->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } s->current_picture.f.qscale_table[VAR_1] = s->qscale; write_back_non_zero_count(VAR_0); if(MB_MBAFF){ VAR_0->ref_count[0] >>= 1; VAR_0->ref_count[1] >>= 1; } return 0; }
[ "int FUNC_0(H264Context *VAR_0){", "MpegEncContext * const s = &VAR_0->s;", "int VAR_1;", "int VAR_2;", "unsigned int VAR_3, VAR_4;", "int VAR_5= VAR_0->pps.transform_8x8_mode;", "int VAR_6 = VAR_0->sps.chroma_format_idc == 1 || VAR_0->sps.chroma_format_idc == 2;", "const int VAR_7 = VAR_0->VAR_7;", "VAR_1 = VAR_0->VAR_1 = s->mb_x + s->mb_y*s->mb_stride;", "tprintf(s->avctx, \"pic:%d mb:%d/%d\\n\", VAR_0->frame_num, s->mb_x, s->mb_y);", "VAR_4 = 0;", "if(VAR_0->slice_type_nos != AV_PICTURE_TYPE_I){", "if(s->mb_skip_run==-1)\ns->mb_skip_run= get_ue_golomb(&s->gb);", "if (s->mb_skip_run--) {", "if(FRAME_MBAFF && (s->mb_y&1) == 0){", "if(s->mb_skip_run==0)\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb);", "}", "decode_mb_skip(VAR_0);", "return 0;", "}", "}", "if(FRAME_MBAFF){", "if( (s->mb_y&1) == 0 )\nVAR_0->mb_mbaff = VAR_0->mb_field_decoding_flag = get_bits1(&s->gb);", "}", "VAR_0->prev_mb_skipped= 0;", "VAR_3= get_ue_golomb(&s->gb);", "if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B){", "if(VAR_3 < 23){", "VAR_2= b_mb_type_info[VAR_3].VAR_2;", "VAR_3= b_mb_type_info[VAR_3].type;", "}else{", "VAR_3 -= 23;", "goto decode_intra_mb;", "}", "}else if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_P){", "if(VAR_3 < 5){", "VAR_2= p_mb_type_info[VAR_3].VAR_2;", "VAR_3= p_mb_type_info[VAR_3].type;", "}else{", "VAR_3 -= 5;", "goto decode_intra_mb;", "}", "}else{", "assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_I);", "if(VAR_0->slice_type == AV_PICTURE_TYPE_SI && VAR_3)\nVAR_3--;", "decode_intra_mb:\nif(VAR_3 > 25){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_3 %d in %c slice too large at %d %d\\n\", VAR_3, av_get_picture_type_char(VAR_0->slice_type), s->mb_x, s->mb_y);", "return -1;", "}", "VAR_2=0;", "VAR_4= i_mb_type_info[VAR_3].VAR_4;", "VAR_0->intra16x16_pred_mode= i_mb_type_info[VAR_3].VAR_11;", "VAR_3= i_mb_type_info[VAR_3].type;", "}", "if(MB_FIELD)\nVAR_3 |= MB_TYPE_INTERLACED;", "VAR_0->slice_table[ VAR_1 ]= VAR_0->slice_num;", "if(IS_INTRA_PCM(VAR_3)){", "unsigned int VAR_8;", "static const uint16_t VAR_9[4] = {256,384,512,768};", "const int VAR_10 = VAR_9[VAR_0->sps.chroma_format_idc]*VAR_0->sps.bit_depth_luma >> 3;", "align_get_bits(&s->gb);", "for(VAR_8=0; VAR_8 < VAR_10; VAR_8++){", "((uint8_t*)VAR_0->mb)[VAR_8]= get_bits(&s->gb, 8);", "}", "s->current_picture.f.qscale_table[VAR_1] = 0;", "memset(VAR_0->non_zero_count[VAR_1], 16, 48);", "s->current_picture.f.VAR_3[VAR_1] = VAR_3;", "return 0;", "}", "if(MB_MBAFF){", "VAR_0->ref_count[0] <<= 1;", "VAR_0->ref_count[1] <<= 1;", "}", "fill_decode_neighbors(VAR_0, VAR_3);", "fill_decode_caches(VAR_0, VAR_3);", "if(IS_INTRA(VAR_3)){", "int VAR_11;", "if(IS_INTRA4x4(VAR_3)){", "int VAR_22;", "int VAR_13 = 1;", "if(VAR_5 && get_bits1(&s->gb)){", "VAR_3 |= MB_TYPE_8x8DCT;", "VAR_13 = 4;", "}", "for(VAR_22=0; VAR_22<16; VAR_22+=VAR_13){", "int VAR_14= pred_intra_mode(VAR_0, VAR_22);", "if(!get_bits1(&s->gb)){", "const int VAR_15= get_bits(&s->gb, 3);", "VAR_14 = VAR_15 + (VAR_15 >= VAR_14);", "}", "if(VAR_13==4)\nfill_rectangle( &VAR_0->intra4x4_pred_mode_cache[ scan8[VAR_22] ], 2, 2, 8, VAR_14, 1 );", "else\nVAR_0->intra4x4_pred_mode_cache[ scan8[VAR_22] ] = VAR_14;", "}", "write_back_intra_pred_mode(VAR_0);", "if( ff_h264_check_intra4x4_pred_mode(VAR_0) < 0)\nreturn -1;", "}else{", "VAR_0->intra16x16_pred_mode= ff_h264_check_intra_pred_mode(VAR_0, VAR_0->intra16x16_pred_mode);", "if(VAR_0->intra16x16_pred_mode < 0)\nreturn -1;", "}", "if(VAR_6){", "VAR_11= ff_h264_check_intra_pred_mode(VAR_0, get_ue_golomb_31(&s->gb));", "if(VAR_11 < 0)\nreturn -1;", "VAR_0->chroma_pred_mode= VAR_11;", "} else {", "VAR_0->chroma_pred_mode = DC_128_PRED8x8;", "}", "}else if(VAR_2==4){", "int VAR_22, VAR_16, VAR_17[4], VAR_20, VAR_19[2][4];", "if(VAR_0->slice_type_nos == AV_PICTURE_TYPE_B){", "for(VAR_22=0; VAR_22<4; VAR_22++){", "VAR_0->sub_mb_type[VAR_22]= get_ue_golomb_31(&s->gb);", "if(VAR_0->sub_mb_type[VAR_22] >=13){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"B sub_mb_type %u out of range at %d %d\\n\", VAR_0->sub_mb_type[VAR_22], s->mb_x, s->mb_y);", "return -1;", "}", "VAR_17[VAR_22]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].VAR_2;", "VAR_0->sub_mb_type[VAR_22]= b_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].type;", "}", "if( IS_DIRECT(VAR_0->sub_mb_type[0]|VAR_0->sub_mb_type[1]|VAR_0->sub_mb_type[2]|VAR_0->sub_mb_type[3])) {", "ff_h264_pred_direct_motion(VAR_0, &VAR_3);", "VAR_0->ref_cache[0][scan8[4]] =\nVAR_0->ref_cache[1][scan8[4]] =\nVAR_0->ref_cache[0][scan8[12]] =\nVAR_0->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE;", "}", "}else{", "assert(VAR_0->slice_type_nos == AV_PICTURE_TYPE_P);", "for(VAR_22=0; VAR_22<4; VAR_22++){", "VAR_0->sub_mb_type[VAR_22]= get_ue_golomb_31(&s->gb);", "if(VAR_0->sub_mb_type[VAR_22] >=4){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"P sub_mb_type %u out of range at %d %d\\n\", VAR_0->sub_mb_type[VAR_22], s->mb_x, s->mb_y);", "return -1;", "}", "VAR_17[VAR_22]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].VAR_2;", "VAR_0->sub_mb_type[VAR_22]= p_sub_mb_type_info[ VAR_0->sub_mb_type[VAR_22] ].type;", "}", "}", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "int ref_count= IS_REF0(VAR_3) ? 1 : VAR_0->ref_count[VAR_20];", "for(VAR_22=0; VAR_22<4; VAR_22++){", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_22])) continue;", "if(IS_DIR(VAR_0->sub_mb_type[VAR_22], 0, VAR_20)){", "unsigned int tmp;", "if(ref_count == 1){", "tmp= 0;", "}else if(ref_count == 2){", "tmp= get_bits1(&s->gb)^1;", "}else{", "tmp= get_ue_golomb_31(&s->gb);", "if(tmp>=ref_count){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_19 %u overflow\\n\", tmp);", "return -1;", "}", "}", "VAR_19[VAR_20][VAR_22]= tmp;", "}else{", "VAR_19[VAR_20][VAR_22] = -1;", "}", "}", "}", "if(VAR_5)\nVAR_5 = get_dct8x8_allowed(VAR_0);", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "for(VAR_22=0; VAR_22<4; VAR_22++){", "if(IS_DIRECT(VAR_0->sub_mb_type[VAR_22])) {", "VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22] ] = VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+1 ];", "continue;", "}", "VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22] ]=VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+1 ]=\nVAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+8 ]=VAR_0->ref_cache[VAR_20][ scan8[4*VAR_22]+9 ]= VAR_19[VAR_20][VAR_22];", "if(IS_DIR(VAR_0->sub_mb_type[VAR_22], 0, VAR_20)){", "const int sub_mb_type= VAR_0->sub_mb_type[VAR_22];", "const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1;", "for(VAR_16=0; VAR_16<VAR_17[VAR_22]; VAR_16++){", "int VAR_20, VAR_21;", "const int VAR_31= 4*VAR_22 + block_width*VAR_16;", "int16_t (* mv_cache)[2]= &VAR_0->mv_cache[VAR_20][ scan8[VAR_31] ];", "pred_motion(VAR_0, VAR_31, block_width, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[VAR_31] ], &VAR_20, &VAR_21);", "VAR_20 += get_se_golomb(&s->gb);", "VAR_21 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_20, VAR_21);", "if(IS_SUB_8X8(sub_mb_type)){", "mv_cache[ 1 ][0]=\nmv_cache[ 8 ][0]= mv_cache[ 9 ][0]= VAR_20;", "mv_cache[ 1 ][1]=\nmv_cache[ 8 ][1]= mv_cache[ 9 ][1]= VAR_21;", "}else if(IS_SUB_8X4(sub_mb_type)){", "mv_cache[ 1 ][0]= VAR_20;", "mv_cache[ 1 ][1]= VAR_21;", "}else if(IS_SUB_4X8(sub_mb_type)){", "mv_cache[ 8 ][0]= VAR_20;", "mv_cache[ 8 ][1]= VAR_21;", "}", "mv_cache[ 0 ][0]= VAR_20;", "mv_cache[ 0 ][1]= VAR_21;", "}", "}else{", "uint32_t *p= (uint32_t *)&VAR_0->mv_cache[VAR_20][ scan8[4*VAR_22] ][0];", "p[0] = p[1]=\np[8] = p[9]= 0;", "}", "}", "}", "}else if(IS_DIRECT(VAR_3)){", "ff_h264_pred_direct_motion(VAR_0, &VAR_3);", "VAR_5 &= VAR_0->sps.direct_8x8_inference_flag;", "}else{", "int VAR_20, VAR_20, VAR_21, VAR_22;", "we should set ref_idx_l? to 0 if we use that later ...\nif(IS_16X16(VAR_3)){", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "unsigned int val;", "if(IS_DIR(VAR_3, 0, VAR_20)){", "if(VAR_0->ref_count[VAR_20]==1){", "val= 0;", "}else if(VAR_0->ref_count[VAR_20]==2){", "val= get_bits1(&s->gb)^1;", "}else{", "val= get_ue_golomb_31(&s->gb);", "if(val >= VAR_0->ref_count[VAR_20]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_19 %u overflow\\n\", val);", "return -1;", "}", "}", "fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] ], 4, 4, 8, val, 1);", "}", "}", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "if(IS_DIR(VAR_3, 0, VAR_20)){", "pred_motion(VAR_0, 0, 4, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[0] ], &VAR_20, &VAR_21);", "VAR_20 += get_se_golomb(&s->gb);", "VAR_21 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_20, VAR_21);", "fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] ], 4, 4, 8, pack16to32(VAR_20,VAR_21), 4);", "}", "}", "}", "else if(IS_16X8(VAR_3)){", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "for(VAR_22=0; VAR_22<2; VAR_22++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_22, VAR_20)){", "if(VAR_0->ref_count[VAR_20] == 1){", "val= 0;", "}else if(VAR_0->ref_count[VAR_20] == 2){", "val= get_bits1(&s->gb)^1;", "}else{", "val= get_ue_golomb_31(&s->gb);", "if(val >= VAR_0->ref_count[VAR_20]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_19 %u overflow\\n\", val);", "return -1;", "}", "}", "}else", "val= LIST_NOT_USED&0xFF;", "fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] + 16*VAR_22 ], 4, 2, 8, val, 1);", "}", "}", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "for(VAR_22=0; VAR_22<2; VAR_22++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_22, VAR_20)){", "pred_16x8_motion(VAR_0, 8*VAR_22, VAR_20, VAR_0->ref_cache[VAR_20][scan8[0] + 16*VAR_22], &VAR_20, &VAR_21);", "VAR_20 += get_se_golomb(&s->gb);", "VAR_21 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_20, VAR_21);", "val= pack16to32(VAR_20,VAR_21);", "}else", "val=0;", "fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] + 16*VAR_22 ], 4, 2, 8, val, 4);", "}", "}", "}else{", "assert(IS_8X16(VAR_3));", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "for(VAR_22=0; VAR_22<2; VAR_22++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_22, VAR_20)){ optimize", "if(VAR_0->ref_count[VAR_20]==1){", "val= 0;", "}else if(VAR_0->ref_count[VAR_20]==2){", "val= get_bits1(&s->gb)^1;", "}else{", "val= get_ue_golomb_31(&s->gb);", "if(val >= VAR_0->ref_count[VAR_20]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_19 %u overflow\\n\", val);", "return -1;", "}", "}", "}else", "val= LIST_NOT_USED&0xFF;", "fill_rectangle(&VAR_0->ref_cache[VAR_20][ scan8[0] + 2*VAR_22 ], 2, 4, 8, val, 1);", "}", "}", "for(VAR_20=0; VAR_20<VAR_0->list_count; VAR_20++){", "for(VAR_22=0; VAR_22<2; VAR_22++){", "unsigned int val;", "if(IS_DIR(VAR_3, VAR_22, VAR_20)){", "pred_8x16_motion(VAR_0, VAR_22*4, VAR_20, VAR_0->ref_cache[VAR_20][ scan8[0] + 2*VAR_22 ], &VAR_20, &VAR_21);", "VAR_20 += get_se_golomb(&s->gb);", "VAR_21 += get_se_golomb(&s->gb);", "tprintf(s->avctx, \"final mv:%d %d\\n\", VAR_20, VAR_21);", "val= pack16to32(VAR_20,VAR_21);", "}else", "val=0;", "fill_rectangle(VAR_0->mv_cache[VAR_20][ scan8[0] + 2*VAR_22 ], 2, 4, 8, val, 4);", "}", "}", "}", "}", "if(IS_INTER(VAR_3))\nwrite_back_motion(VAR_0, VAR_3);", "if(!IS_INTRA16x16(VAR_3)){", "VAR_4= get_ue_golomb(&s->gb);", "if(VAR_6){", "if(VAR_4 > 47){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_4 too large (%u) at %d %d\\n\", VAR_4, s->mb_x, s->mb_y);", "return -1;", "}", "if(IS_INTRA4x4(VAR_3)) VAR_4= golomb_to_intra4x4_cbp[VAR_4];", "else VAR_4= golomb_to_inter_cbp [VAR_4];", "}else{", "if(VAR_4 > 15){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_4 too large (%u) at %d %d\\n\", VAR_4, s->mb_x, s->mb_y);", "return -1;", "}", "if(IS_INTRA4x4(VAR_3)) VAR_4= golomb_to_intra4x4_cbp_gray[VAR_4];", "else VAR_4= golomb_to_inter_cbp_gray[VAR_4];", "}", "}", "if(VAR_5 && (VAR_4&15) && !IS_INTRA(VAR_3)){", "VAR_3 |= MB_TYPE_8x8DCT*get_bits1(&s->gb);", "}", "VAR_0->VAR_4=\nVAR_0->cbp_table[VAR_1]= VAR_4;", "s->current_picture.f.VAR_3[VAR_1] = VAR_3;", "if(VAR_4 || IS_INTRA16x16(VAR_3)){", "int VAR_22, VAR_23, VAR_24;", "int VAR_25;", "int VAR_26;", "GetBitContext *gb= IS_INTRA(VAR_3) ? VAR_0->intra_gb_ptr : VAR_0->inter_gb_ptr;", "const uint8_t *VAR_27, *scan8x8;", "const int VAR_28 = 51 + 6*(VAR_0->sps.bit_depth_luma-8);", "if(IS_INTERLACED(VAR_3)){", "scan8x8= s->qscale ? VAR_0->field_scan8x8_cavlc : VAR_0->field_scan8x8_cavlc_q0;", "VAR_27= s->qscale ? VAR_0->field_scan : VAR_0->field_scan_q0;", "}else{", "scan8x8= s->qscale ? VAR_0->zigzag_scan8x8_cavlc : VAR_0->zigzag_scan8x8_cavlc_q0;", "VAR_27= s->qscale ? VAR_0->zigzag_scan : VAR_0->zigzag_scan_q0;", "}", "VAR_25= get_se_golomb(&s->gb);", "s->qscale += VAR_25;", "if(((unsigned)s->qscale) > VAR_28){", "if(s->qscale<0) s->qscale+= VAR_28+1;", "else s->qscale-= VAR_28+1;", "if(((unsigned)s->qscale) > VAR_28){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_25 out of range (%d) at %d %d\\n\", VAR_25, s->mb_x, s->mb_y);", "return -1;", "}", "}", "VAR_0->chroma_qp[0]= get_chroma_qp(VAR_0, 0, s->qscale);", "VAR_0->chroma_qp[1]= get_chroma_qp(VAR_0, 1, s->qscale);", "if( (VAR_26 = decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 0)) < 0 ){", "return -1;", "}", "VAR_0->cbp_table[VAR_1] |= VAR_26 << 12;", "if(CHROMA444){", "if( decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 1) < 0 ){", "return -1;", "}", "if( decode_luma_residual(VAR_0, gb, VAR_27, scan8x8, VAR_7, VAR_3, VAR_4, 2) < 0 ){", "return -1;", "}", "} else if (CHROMA422) {", "if(VAR_4&0x30){", "for(VAR_24=0; VAR_24<2; VAR_24++)", "if (decode_residual(VAR_0, gb, VAR_0->mb + ((256 + 16*16*VAR_24) << VAR_7),\nCHROMA_DC_BLOCK_INDEX+VAR_24, chroma422_dc_scan,\nNULL, 8) < 0) {", "return -1;", "}", "}", "if(VAR_4&0x20){", "for(VAR_24=0; VAR_24<2; VAR_24++){", "const uint32_t *VAR_31 = VAR_0->dequant4_coeff[VAR_24+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_24]];", "DCTELEM *mb = VAR_0->mb + (16*(16 + 16*VAR_24) << VAR_7);", "for (VAR_23 = 0; VAR_23 < 2; VAR_23++) {", "for (VAR_22 = 0; VAR_22 < 4; VAR_22++) {", "const int VAR_31 = 16 + 16*VAR_24 + 8*VAR_23 + VAR_22;", "if (decode_residual(VAR_0, gb, mb, VAR_31, VAR_27 + 1, VAR_31, 15) < 0)\nreturn -1;", "mb += 16 << VAR_7;", "}", "}", "}", "}else{", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "}", "} else {", "if(VAR_4&0x30){", "for(VAR_24=0; VAR_24<2; VAR_24++)", "if( decode_residual(VAR_0, gb, VAR_0->mb + ((256 + 16*16*VAR_24) << VAR_7), CHROMA_DC_BLOCK_INDEX+VAR_24, chroma_dc_scan, NULL, 4) < 0){", "return -1;", "}", "}", "if(VAR_4&0x20){", "for(VAR_24=0; VAR_24<2; VAR_24++){", "const uint32_t *VAR_31 = VAR_0->dequant4_coeff[VAR_24+1+(IS_INTRA( VAR_3 ) ? 0:3)][VAR_0->chroma_qp[VAR_24]];", "for(VAR_22=0; VAR_22<4; VAR_22++){", "const int VAR_31= 16 + 16*VAR_24 + VAR_22;", "if( decode_residual(VAR_0, gb, VAR_0->mb + (16*VAR_31 << VAR_7), VAR_31, VAR_27 + 1, VAR_31, 15) < 0){", "return -1;", "}", "}", "}", "}else{", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "}", "}", "}else{", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1);", "fill_rectangle(&VAR_0->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1);", "}", "s->current_picture.f.qscale_table[VAR_1] = s->qscale;", "write_back_non_zero_count(VAR_0);", "if(MB_MBAFF){", "VAR_0->ref_count[0] >>= 1;", "VAR_0->ref_count[1] >>= 1;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 205 ], [ 207 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 245, 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317, 319, 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 403, 405 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421, 423 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 451 ], [ 453, 455 ], [ 457, 459 ], [ 461 ], [ 463 ], [ 465 ], [ 467 ], [ 469 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485, 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505, 507 ], [ 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 553 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617 ], [ 619 ], [ 621 ], [ 625 ], [ 627 ], [ 629 ], [ 631 ], [ 633 ], [ 635 ], [ 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 647 ], [ 649 ], [ 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 669 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683 ], [ 685 ], [ 687 ], [ 689 ], [ 691 ], [ 693 ], [ 695 ], [ 699 ], [ 701 ], [ 703 ], [ 705 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 717, 719 ], [ 723 ], [ 725 ], [ 729 ], [ 731 ], [ 733 ], [ 735 ], [ 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 749 ], [ 751 ], [ 753 ], [ 755 ], [ 757 ], [ 759 ], [ 763 ], [ 765 ], [ 767 ], [ 769, 771 ], [ 773 ], [ 777 ], [ 779 ], [ 781 ], [ 783 ], [ 785 ], [ 787 ], [ 789 ], [ 793 ], [ 795 ], [ 797 ], [ 799 ], [ 801 ], [ 803 ], [ 805 ], [ 809 ], [ 813 ], [ 817 ], [ 819 ], [ 821 ], [ 823 ], [ 825 ], [ 827 ], [ 829 ], [ 831 ], [ 835 ], [ 837 ], [ 841 ], [ 843 ], [ 845 ], [ 847 ], [ 849 ], [ 851 ], [ 853 ], [ 855 ], [ 857 ], [ 859 ], [ 861 ], [ 863 ], [ 865 ], [ 867 ], [ 869, 871, 873 ], [ 875 ], [ 877 ], [ 879 ], [ 883 ], [ 885 ], [ 887 ], [ 889 ], [ 891 ], [ 893 ], [ 895 ], [ 897, 899 ], [ 901 ], [ 903 ], [ 905 ], [ 907 ], [ 909 ], [ 911 ], [ 913 ], [ 915 ], [ 917 ], [ 919 ], [ 921 ], [ 923 ], [ 925 ], [ 927 ], [ 929 ], [ 933 ], [ 935 ], [ 937 ], [ 939 ], [ 941 ], [ 943 ], [ 945 ], [ 947 ], [ 949 ], [ 951 ], [ 953 ], [ 955 ], [ 957 ], [ 959 ], [ 961 ], [ 963 ], [ 965 ], [ 967 ], [ 969 ], [ 971 ], [ 973 ], [ 975 ], [ 979 ], [ 981 ], [ 983 ], [ 985 ], [ 989 ], [ 991 ] ]
25,833
static void d3d11va_frames_uninit(AVHWFramesContext *ctx) { AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; D3D11VAFramesContext *s = ctx->internal->priv; if (frames_hwctx->texture) ID3D11Texture2D_Release(frames_hwctx->texture); if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); }
true
FFmpeg
1509d739a036b9838e12f28dac9f09ac37bc3928
static void d3d11va_frames_uninit(AVHWFramesContext *ctx) { AVD3D11VAFramesContext *frames_hwctx = ctx->hwctx; D3D11VAFramesContext *s = ctx->internal->priv; if (frames_hwctx->texture) ID3D11Texture2D_Release(frames_hwctx->texture); if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVHWFramesContext *VAR_0) { AVD3D11VAFramesContext *frames_hwctx = VAR_0->hwctx; D3D11VAFramesContext *s = VAR_0->internal->priv; if (frames_hwctx->texture) ID3D11Texture2D_Release(frames_hwctx->texture); if (s->staging_texture) ID3D11Texture2D_Release(s->staging_texture); }
[ "static void FUNC_0(AVHWFramesContext *VAR_0)\n{", "AVD3D11VAFramesContext *frames_hwctx = VAR_0->hwctx;", "D3D11VAFramesContext *s = VAR_0->internal->priv;", "if (frames_hwctx->texture)\nID3D11Texture2D_Release(frames_hwctx->texture);", "if (s->staging_texture)\nID3D11Texture2D_Release(s->staging_texture);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 18, 20 ], [ 23 ] ]
25,834
static void mov_read_chapters(AVFormatContext *s) { MOVContext *mov = s->priv_data; AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; int i; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { st = s->streams[i]; break; } if (!st) { av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); return; } st->discard = AVDISCARD_ALL; sc = st->priv_data; cur_pos = avio_tell(sc->pb); for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; uint8_t *title; uint16_t ch; int len, title_len; if (end < sample->timestamp) { av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); end = AV_NOPTS_VALUE; } if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } // the first two bytes are the length of the title len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; if (!(title = av_mallocz(title_len))) goto finish; // The samples could theoretically be in any encoding if there's an encd // atom following, but in practice are only utf-8 or utf-16, distinguished // instead by the presence of a BOM if (!len) { title[0] = 0; } else { ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); if (len == 1 || len == 2) title[len] = 0; else avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); } } avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } finish: avio_seek(sc->pb, cur_pos, SEEK_SET); }
false
FFmpeg
697400eac07c0614f6b9f2e7615563982dbcbe4a
static void mov_read_chapters(AVFormatContext *s) { MOVContext *mov = s->priv_data; AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; int i; for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->id == mov->chapter_track) { st = s->streams[i]; break; } if (!st) { av_log(s, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); return; } st->discard = AVDISCARD_ALL; sc = st->priv_data; cur_pos = avio_tell(sc->pb); for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; uint8_t *title; uint16_t ch; int len, title_len; if (end < sample->timestamp) { av_log(s, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); end = AV_NOPTS_VALUE; } if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; if (!(title = av_mallocz(title_len))) goto finish; if (!len) { title[0] = 0; } else { ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); if (len == 1 || len == 2) title[len] = 0; else avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); } } avpriv_new_chapter(s, i, st->time_base, sample->timestamp, end, title); av_freep(&title); } finish: avio_seek(sc->pb, cur_pos, SEEK_SET); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0) { MOVContext *mov = VAR_0->priv_data; AVStream *st = NULL; MOVStreamContext *sc; int64_t cur_pos; int VAR_1; for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++) if (VAR_0->streams[VAR_1]->id == mov->chapter_track) { st = VAR_0->streams[VAR_1]; break; } if (!st) { av_log(VAR_0, AV_LOG_ERROR, "Referenced QT chapter track not found\n"); return; } st->discard = AVDISCARD_ALL; sc = st->priv_data; cur_pos = avio_tell(sc->pb); for (VAR_1 = 0; VAR_1 < st->nb_index_entries; VAR_1++) { AVIndexEntry *sample = &st->index_entries[VAR_1]; int64_t end = VAR_1+1 < st->nb_index_entries ? st->index_entries[VAR_1+1].timestamp : st->duration; uint8_t *title; uint16_t ch; int len, title_len; if (end < sample->timestamp) { av_log(VAR_0, AV_LOG_WARNING, "ignoring stream duration which is shorter than chapters\n"); end = AV_NOPTS_VALUE; } if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(VAR_0, AV_LOG_ERROR, "Chapter %d not found in file\n", VAR_1); goto finish; } len = avio_rb16(sc->pb); if (len > sample->size-2) continue; title_len = 2*len + 1; if (!(title = av_mallocz(title_len))) goto finish; if (!len) { title[0] = 0; } else { ch = avio_rb16(sc->pb); if (ch == 0xfeff) avio_get_str16be(sc->pb, len, title, title_len); else if (ch == 0xfffe) avio_get_str16le(sc->pb, len, title, title_len); else { AV_WB16(title, ch); if (len == 1 || len == 2) title[len] = 0; else avio_get_str(sc->pb, INT_MAX, title + 2, len - 1); } } avpriv_new_chapter(VAR_0, VAR_1, st->time_base, sample->timestamp, end, title); av_freep(&title); } finish: avio_seek(sc->pb, cur_pos, SEEK_SET); }
[ "static void FUNC_0(AVFormatContext *VAR_0)\n{", "MOVContext *mov = VAR_0->priv_data;", "AVStream *st = NULL;", "MOVStreamContext *sc;", "int64_t cur_pos;", "int VAR_1;", "for (VAR_1 = 0; VAR_1 < VAR_0->nb_streams; VAR_1++)", "if (VAR_0->streams[VAR_1]->id == mov->chapter_track) {", "st = VAR_0->streams[VAR_1];", "break;", "}", "if (!st) {", "av_log(VAR_0, AV_LOG_ERROR, \"Referenced QT chapter track not found\\n\");", "return;", "}", "st->discard = AVDISCARD_ALL;", "sc = st->priv_data;", "cur_pos = avio_tell(sc->pb);", "for (VAR_1 = 0; VAR_1 < st->nb_index_entries; VAR_1++) {", "AVIndexEntry *sample = &st->index_entries[VAR_1];", "int64_t end = VAR_1+1 < st->nb_index_entries ? st->index_entries[VAR_1+1].timestamp : st->duration;", "uint8_t *title;", "uint16_t ch;", "int len, title_len;", "if (end < sample->timestamp) {", "av_log(VAR_0, AV_LOG_WARNING, \"ignoring stream duration which is shorter than chapters\\n\");", "end = AV_NOPTS_VALUE;", "}", "if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {", "av_log(VAR_0, AV_LOG_ERROR, \"Chapter %d not found in file\\n\", VAR_1);", "goto finish;", "}", "len = avio_rb16(sc->pb);", "if (len > sample->size-2)\ncontinue;", "title_len = 2*len + 1;", "if (!(title = av_mallocz(title_len)))\ngoto finish;", "if (!len) {", "title[0] = 0;", "} else {", "ch = avio_rb16(sc->pb);", "if (ch == 0xfeff)\navio_get_str16be(sc->pb, len, title, title_len);", "else if (ch == 0xfffe)\navio_get_str16le(sc->pb, len, title, title_len);", "else {", "AV_WB16(title, ch);", "if (len == 1 || len == 2)\ntitle[len] = 0;", "else\navio_get_str(sc->pb, INT_MAX, title + 2, len - 1);", "}", "}", "avpriv_new_chapter(VAR_0, VAR_1, st->time_base, sample->timestamp, end, title);", "av_freep(&title);", "}", "finish:\navio_seek(sc->pb, cur_pos, SEEK_SET);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ] ]
25,835
static int msrle_decode_pal4(AVCodecContext *avctx, AVFrame *pic, GetByteContext *gb) { unsigned char rle_code; unsigned char extra_byte, odd_pixel; unsigned char stream_byte; int pixel_ptr = 0; int line = avctx->height - 1; int i; while (line >= 0 && pixel_ptr <= avctx->width) { if (bytestream2_get_bytes_left(gb) <= 0) { av_log(avctx, AV_LOG_ERROR, "MS RLE: bytestream overrun, %dx%d left\n", avctx->width - pixel_ptr, line); return AVERROR_INVALIDDATA; } rle_code = stream_byte = bytestream2_get_byteu(gb); if (rle_code == 0) { /* fetch the next byte to see how to handle escape code */ stream_byte = bytestream2_get_byte(gb); if (stream_byte == 0) { /* line is done, goto the next one */ line--; pixel_ptr = 0; } else if (stream_byte == 1) { /* decode is done */ return 0; } else if (stream_byte == 2) { /* reposition frame decode coordinates */ stream_byte = bytestream2_get_byte(gb); pixel_ptr += stream_byte; stream_byte = bytestream2_get_byte(gb); avpriv_request_sample(avctx, "Unused stream byte %X", stream_byte); } else { // copy pixels from encoded stream odd_pixel = stream_byte & 1; rle_code = (stream_byte + 1) / 2; extra_byte = rle_code & 0x01; if (pixel_ptr + 2*rle_code - odd_pixel > avctx->width || bytestream2_get_bytes_left(gb) < rle_code) { av_log(avctx, AV_LOG_ERROR, "MS RLE: frame/stream ptr just went out of bounds (copy)\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; stream_byte = bytestream2_get_byteu(gb); pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4; pixel_ptr++; if (i + 1 == rle_code && odd_pixel) break; if (pixel_ptr >= avctx->width) break; pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } // if the RLE code is odd, skip a byte in the stream if (extra_byte) bytestream2_skip(gb, 1); } } else { // decode a run of data if (pixel_ptr + rle_code > avctx->width + 1) { av_log(avctx, AV_LOG_ERROR, "MS RLE: frame ptr just went out of bounds (run) %d %d %d\n", pixel_ptr, rle_code, avctx->width); return AVERROR_INVALIDDATA; } stream_byte = bytestream2_get_byte(gb); for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; if ((i & 1) == 0) pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4; else pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } } } /* one last sanity check on the way out */ if (bytestream2_get_bytes_left(gb)) { av_log(avctx, AV_LOG_ERROR, "MS RLE: ended frame decode with %d bytes left over\n", bytestream2_get_bytes_left(gb)); return AVERROR_INVALIDDATA; } return 0; }
false
FFmpeg
e856ac23732822ac04fe5dd959cff94c7249c17e
static int msrle_decode_pal4(AVCodecContext *avctx, AVFrame *pic, GetByteContext *gb) { unsigned char rle_code; unsigned char extra_byte, odd_pixel; unsigned char stream_byte; int pixel_ptr = 0; int line = avctx->height - 1; int i; while (line >= 0 && pixel_ptr <= avctx->width) { if (bytestream2_get_bytes_left(gb) <= 0) { av_log(avctx, AV_LOG_ERROR, "MS RLE: bytestream overrun, %dx%d left\n", avctx->width - pixel_ptr, line); return AVERROR_INVALIDDATA; } rle_code = stream_byte = bytestream2_get_byteu(gb); if (rle_code == 0) { stream_byte = bytestream2_get_byte(gb); if (stream_byte == 0) { line--; pixel_ptr = 0; } else if (stream_byte == 1) { return 0; } else if (stream_byte == 2) { stream_byte = bytestream2_get_byte(gb); pixel_ptr += stream_byte; stream_byte = bytestream2_get_byte(gb); avpriv_request_sample(avctx, "Unused stream byte %X", stream_byte); } else { odd_pixel = stream_byte & 1; rle_code = (stream_byte + 1) / 2; extra_byte = rle_code & 0x01; if (pixel_ptr + 2*rle_code - odd_pixel > avctx->width || bytestream2_get_bytes_left(gb) < rle_code) { av_log(avctx, AV_LOG_ERROR, "MS RLE: frame/stream ptr just went out of bounds (copy)\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; stream_byte = bytestream2_get_byteu(gb); pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4; pixel_ptr++; if (i + 1 == rle_code && odd_pixel) break; if (pixel_ptr >= avctx->width) break; pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } if (extra_byte) bytestream2_skip(gb, 1); } } else { if (pixel_ptr + rle_code > avctx->width + 1) { av_log(avctx, AV_LOG_ERROR, "MS RLE: frame ptr just went out of bounds (run) %d %d %d\n", pixel_ptr, rle_code, avctx->width); return AVERROR_INVALIDDATA; } stream_byte = bytestream2_get_byte(gb); for (i = 0; i < rle_code; i++) { if (pixel_ptr >= avctx->width) break; if ((i & 1) == 0) pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte >> 4; else pic->data[0][line * pic->linesize[0] + pixel_ptr] = stream_byte & 0x0F; pixel_ptr++; } } } if (bytestream2_get_bytes_left(gb)) { av_log(avctx, AV_LOG_ERROR, "MS RLE: ended frame decode with %d bytes left over\n", bytestream2_get_bytes_left(gb)); return AVERROR_INVALIDDATA; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, GetByteContext *VAR_2) { unsigned char VAR_3; unsigned char VAR_4, VAR_5; unsigned char VAR_6; int VAR_7 = 0; int VAR_8 = VAR_0->height - 1; int VAR_9; while (VAR_8 >= 0 && VAR_7 <= VAR_0->width) { if (bytestream2_get_bytes_left(VAR_2) <= 0) { av_log(VAR_0, AV_LOG_ERROR, "MS RLE: bytestream overrun, %dx%d left\n", VAR_0->width - VAR_7, VAR_8); return AVERROR_INVALIDDATA; } VAR_3 = VAR_6 = bytestream2_get_byteu(VAR_2); if (VAR_3 == 0) { VAR_6 = bytestream2_get_byte(VAR_2); if (VAR_6 == 0) { VAR_8--; VAR_7 = 0; } else if (VAR_6 == 1) { return 0; } else if (VAR_6 == 2) { VAR_6 = bytestream2_get_byte(VAR_2); VAR_7 += VAR_6; VAR_6 = bytestream2_get_byte(VAR_2); avpriv_request_sample(VAR_0, "Unused stream byte %X", VAR_6); } else { VAR_5 = VAR_6 & 1; VAR_3 = (VAR_6 + 1) / 2; VAR_4 = VAR_3 & 0x01; if (VAR_7 + 2*VAR_3 - VAR_5 > VAR_0->width || bytestream2_get_bytes_left(VAR_2) < VAR_3) { av_log(VAR_0, AV_LOG_ERROR, "MS RLE: frame/stream ptr just went out of bounds (copy)\n"); return AVERROR_INVALIDDATA; } for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) { if (VAR_7 >= VAR_0->width) break; VAR_6 = bytestream2_get_byteu(VAR_2); VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 >> 4; VAR_7++; if (VAR_9 + 1 == VAR_3 && VAR_5) break; if (VAR_7 >= VAR_0->width) break; VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 & 0x0F; VAR_7++; } if (VAR_4) bytestream2_skip(VAR_2, 1); } } else { if (VAR_7 + VAR_3 > VAR_0->width + 1) { av_log(VAR_0, AV_LOG_ERROR, "MS RLE: frame ptr just went out of bounds (run) %d %d %d\n", VAR_7, VAR_3, VAR_0->width); return AVERROR_INVALIDDATA; } VAR_6 = bytestream2_get_byte(VAR_2); for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) { if (VAR_7 >= VAR_0->width) break; if ((VAR_9 & 1) == 0) VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 >> 4; else VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 & 0x0F; VAR_7++; } } } if (bytestream2_get_bytes_left(VAR_2)) { av_log(VAR_0, AV_LOG_ERROR, "MS RLE: ended frame decode with %d bytes left over\n", bytestream2_get_bytes_left(VAR_2)); return AVERROR_INVALIDDATA; } return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nGetByteContext *VAR_2)\n{", "unsigned char VAR_3;", "unsigned char VAR_4, VAR_5;", "unsigned char VAR_6;", "int VAR_7 = 0;", "int VAR_8 = VAR_0->height - 1;", "int VAR_9;", "while (VAR_8 >= 0 && VAR_7 <= VAR_0->width) {", "if (bytestream2_get_bytes_left(VAR_2) <= 0) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"MS RLE: bytestream overrun, %dx%d left\\n\",\nVAR_0->width - VAR_7, VAR_8);", "return AVERROR_INVALIDDATA;", "}", "VAR_3 = VAR_6 = bytestream2_get_byteu(VAR_2);", "if (VAR_3 == 0) {", "VAR_6 = bytestream2_get_byte(VAR_2);", "if (VAR_6 == 0) {", "VAR_8--;", "VAR_7 = 0;", "} else if (VAR_6 == 1) {", "return 0;", "} else if (VAR_6 == 2) {", "VAR_6 = bytestream2_get_byte(VAR_2);", "VAR_7 += VAR_6;", "VAR_6 = bytestream2_get_byte(VAR_2);", "avpriv_request_sample(VAR_0, \"Unused stream byte %X\", VAR_6);", "} else {", "VAR_5 = VAR_6 & 1;", "VAR_3 = (VAR_6 + 1) / 2;", "VAR_4 = VAR_3 & 0x01;", "if (VAR_7 + 2*VAR_3 - VAR_5 > VAR_0->width ||\nbytestream2_get_bytes_left(VAR_2) < VAR_3) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"MS RLE: frame/stream ptr just went out of bounds (copy)\\n\");", "return AVERROR_INVALIDDATA;", "}", "for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) {", "if (VAR_7 >= VAR_0->width)\nbreak;", "VAR_6 = bytestream2_get_byteu(VAR_2);", "VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 >> 4;", "VAR_7++;", "if (VAR_9 + 1 == VAR_3 && VAR_5)\nbreak;", "if (VAR_7 >= VAR_0->width)\nbreak;", "VAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 & 0x0F;", "VAR_7++;", "}", "if (VAR_4)\nbytestream2_skip(VAR_2, 1);", "}", "} else {", "if (VAR_7 + VAR_3 > VAR_0->width + 1) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"MS RLE: frame ptr just went out of bounds (run) %d %d %d\\n\", VAR_7, VAR_3, VAR_0->width);", "return AVERROR_INVALIDDATA;", "}", "VAR_6 = bytestream2_get_byte(VAR_2);", "for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9++) {", "if (VAR_7 >= VAR_0->width)\nbreak;", "if ((VAR_9 & 1) == 0)\nVAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 >> 4;", "else\nVAR_1->data[0][VAR_8 * VAR_1->linesize[0] + VAR_7] = VAR_6 & 0x0F;", "VAR_7++;", "}", "}", "}", "if (bytestream2_get_bytes_left(VAR_2)) {", "av_log(VAR_0, AV_LOG_ERROR,\n\"MS RLE: ended frame decode with %d bytes left over\\n\",\nbytestream2_get_bytes_left(VAR_2));", "return AVERROR_INVALIDDATA;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151, 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 173, 175, 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ] ]
25,836
static void update_initial_durations(AVFormatContext *s, AVStream *st, int stream_index, int duration) { AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue; int64_t cur_dts = RELATIVE_TS_BASE; if (st->first_dts != AV_NOPTS_VALUE) { if (st->update_initial_durations_done) return; st->update_initial_durations_done = 1; cur_dts = st->first_dts; for (; pktl; pktl = get_next_pkt(s, st, pktl)) { if (pktl->pkt.stream_index == stream_index) { if (pktl->pkt.pts != pktl->pkt.dts || pktl->pkt.dts != AV_NOPTS_VALUE || pktl->pkt.duration) break; cur_dts -= duration; } } if (pktl && pktl->pkt.dts != st->first_dts) { av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %"PRId64") in the queue\n", av_ts2str(st->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.duration); return; } if (!pktl) { av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(st->first_dts)); return; } pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue; st->first_dts = cur_dts; } else if (st->cur_dts != RELATIVE_TS_BASE) return; for (; pktl; pktl = get_next_pkt(s, st, pktl)) { if (pktl->pkt.stream_index != stream_index) continue; if (pktl->pkt.pts == pktl->pkt.dts && (pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == st->first_dts) && !pktl->pkt.duration) { pktl->pkt.dts = cur_dts; if (!st->internal->avctx->has_b_frames) pktl->pkt.pts = cur_dts; // if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) pktl->pkt.duration = duration; } else break; cur_dts = pktl->pkt.dts + pktl->pkt.duration; } if (!pktl) st->cur_dts = cur_dts; }
false
FFmpeg
3206ea4ba31ebf446a3c4f1220adb895b3272c15
static void update_initial_durations(AVFormatContext *s, AVStream *st, int stream_index, int duration) { AVPacketList *pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue; int64_t cur_dts = RELATIVE_TS_BASE; if (st->first_dts != AV_NOPTS_VALUE) { if (st->update_initial_durations_done) return; st->update_initial_durations_done = 1; cur_dts = st->first_dts; for (; pktl; pktl = get_next_pkt(s, st, pktl)) { if (pktl->pkt.stream_index == stream_index) { if (pktl->pkt.pts != pktl->pkt.dts || pktl->pkt.dts != AV_NOPTS_VALUE || pktl->pkt.duration) break; cur_dts -= duration; } } if (pktl && pktl->pkt.dts != st->first_dts) { av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %"PRId64") in the queue\n", av_ts2str(st->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.duration); return; } if (!pktl) { av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(st->first_dts)); return; } pktl = s->internal->packet_buffer ? s->internal->packet_buffer : s->internal->parse_queue; st->first_dts = cur_dts; } else if (st->cur_dts != RELATIVE_TS_BASE) return; for (; pktl; pktl = get_next_pkt(s, st, pktl)) { if (pktl->pkt.stream_index != stream_index) continue; if (pktl->pkt.pts == pktl->pkt.dts && (pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == st->first_dts) && !pktl->pkt.duration) { pktl->pkt.dts = cur_dts; if (!st->internal->avctx->has_b_frames) pktl->pkt.pts = cur_dts; pktl->pkt.duration = duration; } else break; cur_dts = pktl->pkt.dts + pktl->pkt.duration; } if (!pktl) st->cur_dts = cur_dts; }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, int VAR_2, int VAR_3) { AVPacketList *pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue; int64_t cur_dts = RELATIVE_TS_BASE; if (VAR_1->first_dts != AV_NOPTS_VALUE) { if (VAR_1->update_initial_durations_done) return; VAR_1->update_initial_durations_done = 1; cur_dts = VAR_1->first_dts; for (; pktl; pktl = get_next_pkt(VAR_0, VAR_1, pktl)) { if (pktl->pkt.VAR_2 == VAR_2) { if (pktl->pkt.pts != pktl->pkt.dts || pktl->pkt.dts != AV_NOPTS_VALUE || pktl->pkt.VAR_3) break; cur_dts -= VAR_3; } } if (pktl && pktl->pkt.dts != VAR_1->first_dts) { av_log(VAR_0, AV_LOG_DEBUG, "first_dts %VAR_0 not matching first dts %VAR_0 (pts %VAR_0, VAR_3 %"PRId64") in the queue\n", av_ts2str(VAR_1->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.VAR_3); return; } if (!pktl) { av_log(VAR_0, AV_LOG_DEBUG, "first_dts %VAR_0 but no packet with dts in the queue\n", av_ts2str(VAR_1->first_dts)); return; } pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue; VAR_1->first_dts = cur_dts; } else if (VAR_1->cur_dts != RELATIVE_TS_BASE) return; for (; pktl; pktl = get_next_pkt(VAR_0, VAR_1, pktl)) { if (pktl->pkt.VAR_2 != VAR_2) continue; if (pktl->pkt.pts == pktl->pkt.dts && (pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == VAR_1->first_dts) && !pktl->pkt.VAR_3) { pktl->pkt.dts = cur_dts; if (!VAR_1->internal->avctx->has_b_frames) pktl->pkt.pts = cur_dts; pktl->pkt.VAR_3 = VAR_3; } else break; cur_dts = pktl->pkt.dts + pktl->pkt.VAR_3; } if (!pktl) VAR_1->cur_dts = cur_dts; }
[ "static void FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1,\nint VAR_2, int VAR_3)\n{", "AVPacketList *pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue;", "int64_t cur_dts = RELATIVE_TS_BASE;", "if (VAR_1->first_dts != AV_NOPTS_VALUE) {", "if (VAR_1->update_initial_durations_done)\nreturn;", "VAR_1->update_initial_durations_done = 1;", "cur_dts = VAR_1->first_dts;", "for (; pktl; pktl = get_next_pkt(VAR_0, VAR_1, pktl)) {", "if (pktl->pkt.VAR_2 == VAR_2) {", "if (pktl->pkt.pts != pktl->pkt.dts ||\npktl->pkt.dts != AV_NOPTS_VALUE ||\npktl->pkt.VAR_3)\nbreak;", "cur_dts -= VAR_3;", "}", "}", "if (pktl && pktl->pkt.dts != VAR_1->first_dts) {", "av_log(VAR_0, AV_LOG_DEBUG, \"first_dts %VAR_0 not matching first dts %VAR_0 (pts %VAR_0, VAR_3 %\"PRId64\") in the queue\\n\",\nav_ts2str(VAR_1->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.VAR_3);", "return;", "}", "if (!pktl) {", "av_log(VAR_0, AV_LOG_DEBUG, \"first_dts %VAR_0 but no packet with dts in the queue\\n\", av_ts2str(VAR_1->first_dts));", "return;", "}", "pktl = VAR_0->internal->packet_buffer ? VAR_0->internal->packet_buffer : VAR_0->internal->parse_queue;", "VAR_1->first_dts = cur_dts;", "} else if (VAR_1->cur_dts != RELATIVE_TS_BASE)", "return;", "for (; pktl; pktl = get_next_pkt(VAR_0, VAR_1, pktl)) {", "if (pktl->pkt.VAR_2 != VAR_2)\ncontinue;", "if (pktl->pkt.pts == pktl->pkt.dts &&\n(pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == VAR_1->first_dts) &&\n!pktl->pkt.VAR_3) {", "pktl->pkt.dts = cur_dts;", "if (!VAR_1->internal->avctx->has_b_frames)\npktl->pkt.pts = cur_dts;", "pktl->pkt.VAR_3 = VAR_3;", "} else", "break;", "cur_dts = pktl->pkt.dts + pktl->pkt.VAR_3;", "}", "if (!pktl)\nVAR_1->cur_dts = cur_dts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71, 73 ], [ 75, 77, 79 ], [ 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ] ]
25,837
int poll(struct pollfd *fds, nfds_t numfds, int timeout) { fd_set read_set; fd_set write_set; fd_set exception_set; nfds_t i; int n; int rc; #ifdef __MINGW32__ if (numfds >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif FD_ZERO(&read_set); FD_ZERO(&write_set); FD_ZERO(&exception_set); n = -1; for(i = 0; i < numfds; i++) { if (fds[i].fd < 0) continue; #ifndef __MINGW32__ if (fds[i].fd >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set); if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set); if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set); if (fds[i].fd > n) n = fds[i].fd; }; if (n == -1) /* Hey!? Nothing to poll, in fact!!! */ return 0; if (timeout < 0) rc = select(n+1, &read_set, &write_set, &exception_set, NULL); else { struct timeval tv; tv.tv_sec = timeout / 1000; tv.tv_usec = 1000 * (timeout % 1000); rc = select(n+1, &read_set, &write_set, &exception_set, &tv); }; if (rc < 0) return rc; for(i = 0; i < (nfds_t) n; i++) { fds[i].revents = 0; if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN; if (FD_ISSET(fds[i].fd, &write_set)) fds[i].revents |= POLLOUT; if (FD_ISSET(fds[i].fd, &exception_set)) fds[i].revents |= POLLERR; }; return rc; }
false
FFmpeg
6ff3f3e7cec7cd78a01d0bf76cbccfbe68dc0894
int poll(struct pollfd *fds, nfds_t numfds, int timeout) { fd_set read_set; fd_set write_set; fd_set exception_set; nfds_t i; int n; int rc; #ifdef __MINGW32__ if (numfds >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif FD_ZERO(&read_set); FD_ZERO(&write_set); FD_ZERO(&exception_set); n = -1; for(i = 0; i < numfds; i++) { if (fds[i].fd < 0) continue; #ifndef __MINGW32__ if (fds[i].fd >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set); if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set); if (fds[i].events & POLLERR) FD_SET(fds[i].fd, &exception_set); if (fds[i].fd > n) n = fds[i].fd; }; if (n == -1) return 0; if (timeout < 0) rc = select(n+1, &read_set, &write_set, &exception_set, NULL); else { struct timeval tv; tv.tv_sec = timeout / 1000; tv.tv_usec = 1000 * (timeout % 1000); rc = select(n+1, &read_set, &write_set, &exception_set, &tv); }; if (rc < 0) return rc; for(i = 0; i < (nfds_t) n; i++) { fds[i].revents = 0; if (FD_ISSET(fds[i].fd, &read_set)) fds[i].revents |= POLLIN; if (FD_ISSET(fds[i].fd, &write_set)) fds[i].revents |= POLLOUT; if (FD_ISSET(fds[i].fd, &exception_set)) fds[i].revents |= POLLERR; }; return rc; }
{ "code": [], "line_no": [] }
int FUNC_0(struct pollfd *VAR_0, nfds_t VAR_1, int VAR_2) { fd_set read_set; fd_set write_set; fd_set exception_set; nfds_t i; int VAR_3; int VAR_4; #ifdef __MINGW32__ if (VAR_1 >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif FD_ZERO(&read_set); FD_ZERO(&write_set); FD_ZERO(&exception_set); VAR_3 = -1; for(i = 0; i < VAR_1; i++) { if (VAR_0[i].fd < 0) continue; #ifndef __MINGW32__ if (VAR_0[i].fd >= FD_SETSIZE) { errno = EINVAL; return -1; } #endif if (VAR_0[i].events & POLLIN) FD_SET(VAR_0[i].fd, &read_set); if (VAR_0[i].events & POLLOUT) FD_SET(VAR_0[i].fd, &write_set); if (VAR_0[i].events & POLLERR) FD_SET(VAR_0[i].fd, &exception_set); if (VAR_0[i].fd > VAR_3) VAR_3 = VAR_0[i].fd; }; if (VAR_3 == -1) return 0; if (VAR_2 < 0) VAR_4 = select(VAR_3+1, &read_set, &write_set, &exception_set, NULL); else { struct timeval VAR_5; VAR_5.tv_sec = VAR_2 / 1000; VAR_5.tv_usec = 1000 * (VAR_2 % 1000); VAR_4 = select(VAR_3+1, &read_set, &write_set, &exception_set, &VAR_5); }; if (VAR_4 < 0) return VAR_4; for(i = 0; i < (nfds_t) VAR_3; i++) { VAR_0[i].revents = 0; if (FD_ISSET(VAR_0[i].fd, &read_set)) VAR_0[i].revents |= POLLIN; if (FD_ISSET(VAR_0[i].fd, &write_set)) VAR_0[i].revents |= POLLOUT; if (FD_ISSET(VAR_0[i].fd, &exception_set)) VAR_0[i].revents |= POLLERR; }; return VAR_4; }
[ "int FUNC_0(struct pollfd *VAR_0, nfds_t VAR_1, int VAR_2)\n{", "fd_set read_set;", "fd_set write_set;", "fd_set exception_set;", "nfds_t i;", "int VAR_3;", "int VAR_4;", "#ifdef __MINGW32__\nif (VAR_1 >= FD_SETSIZE) {", "errno = EINVAL;", "return -1;", "}", "#endif\nFD_ZERO(&read_set);", "FD_ZERO(&write_set);", "FD_ZERO(&exception_set);", "VAR_3 = -1;", "for(i = 0; i < VAR_1; i++) {", "if (VAR_0[i].fd < 0)\ncontinue;", "#ifndef __MINGW32__\nif (VAR_0[i].fd >= FD_SETSIZE) {", "errno = EINVAL;", "return -1;", "}", "#endif\nif (VAR_0[i].events & POLLIN) FD_SET(VAR_0[i].fd, &read_set);", "if (VAR_0[i].events & POLLOUT) FD_SET(VAR_0[i].fd, &write_set);", "if (VAR_0[i].events & POLLERR) FD_SET(VAR_0[i].fd, &exception_set);", "if (VAR_0[i].fd > VAR_3)\nVAR_3 = VAR_0[i].fd;", "};", "if (VAR_3 == -1)\nreturn 0;", "if (VAR_2 < 0)\nVAR_4 = select(VAR_3+1, &read_set, &write_set, &exception_set, NULL);", "else {", "struct timeval VAR_5;", "VAR_5.tv_sec = VAR_2 / 1000;", "VAR_5.tv_usec = 1000 * (VAR_2 % 1000);", "VAR_4 = select(VAR_3+1, &read_set, &write_set, &exception_set, &VAR_5);", "};", "if (VAR_4 < 0)\nreturn VAR_4;", "for(i = 0; i < (nfds_t) VAR_3; i++) {", "VAR_0[i].revents = 0;", "if (FD_ISSET(VAR_0[i].fd, &read_set)) VAR_0[i].revents |= POLLIN;", "if (FD_ISSET(VAR_0[i].fd, &write_set)) VAR_0[i].revents |= POLLOUT;", "if (FD_ISSET(VAR_0[i].fd, &exception_set)) VAR_0[i].revents |= POLLERR;", "};", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 79, 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 107, 109 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
25,838
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags) { int i, nb_streams = ic->nb_streams; int ret = AVERROR_STREAM_NOT_FOUND, best_count = -1, best_bitrate = -1, best_multiframe = -1, count, bitrate, multiframe; unsigned *program = NULL; const AVCodec *decoder = NULL, *best_decoder = NULL; if (related_stream >= 0 && wanted_stream_nb < 0) { AVProgram *p = av_find_program_from_stream(ic, NULL, related_stream); if (p) { program = p->stream_index; nb_streams = p->nb_stream_indexes; } } for (i = 0; i < nb_streams; i++) { int real_stream_index = program ? program[i] : i; AVStream *st = ic->streams[real_stream_index]; AVCodecContext *avctx = st->codec; if (avctx->codec_type != type) continue; if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb) continue; if (wanted_stream_nb != real_stream_index && st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED | AV_DISPOSITION_VISUAL_IMPAIRED)) continue; if (type == AVMEDIA_TYPE_AUDIO && !avctx->channels) continue; if (decoder_ret) { decoder = find_decoder(ic, st, st->codec->codec_id); if (!decoder) { if (ret < 0) ret = AVERROR_DECODER_NOT_FOUND; continue; } } count = st->codec_info_nb_frames; bitrate = avctx->bit_rate; if (!bitrate) bitrate = avctx->rc_max_rate; multiframe = FFMIN(5, count); if ((best_multiframe > multiframe) || (best_multiframe == multiframe && best_bitrate > bitrate) || (best_multiframe == multiframe && best_bitrate == bitrate && best_count >= count)) continue; best_count = count; best_bitrate = bitrate; best_multiframe = multiframe; ret = real_stream_index; best_decoder = decoder; if (program && i == nb_streams - 1 && ret < 0) { program = NULL; nb_streams = ic->nb_streams; /* no related stream found, try again with everything */ i = 0; } } if (decoder_ret) *decoder_ret = (AVCodec*)best_decoder; return ret; }
false
FFmpeg
42c41e96ff6dc4fa24d98e1913aff925b8122776
int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, int wanted_stream_nb, int related_stream, AVCodec **decoder_ret, int flags) { int i, nb_streams = ic->nb_streams; int ret = AVERROR_STREAM_NOT_FOUND, best_count = -1, best_bitrate = -1, best_multiframe = -1, count, bitrate, multiframe; unsigned *program = NULL; const AVCodec *decoder = NULL, *best_decoder = NULL; if (related_stream >= 0 && wanted_stream_nb < 0) { AVProgram *p = av_find_program_from_stream(ic, NULL, related_stream); if (p) { program = p->stream_index; nb_streams = p->nb_stream_indexes; } } for (i = 0; i < nb_streams; i++) { int real_stream_index = program ? program[i] : i; AVStream *st = ic->streams[real_stream_index]; AVCodecContext *avctx = st->codec; if (avctx->codec_type != type) continue; if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb) continue; if (wanted_stream_nb != real_stream_index && st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED | AV_DISPOSITION_VISUAL_IMPAIRED)) continue; if (type == AVMEDIA_TYPE_AUDIO && !avctx->channels) continue; if (decoder_ret) { decoder = find_decoder(ic, st, st->codec->codec_id); if (!decoder) { if (ret < 0) ret = AVERROR_DECODER_NOT_FOUND; continue; } } count = st->codec_info_nb_frames; bitrate = avctx->bit_rate; if (!bitrate) bitrate = avctx->rc_max_rate; multiframe = FFMIN(5, count); if ((best_multiframe > multiframe) || (best_multiframe == multiframe && best_bitrate > bitrate) || (best_multiframe == multiframe && best_bitrate == bitrate && best_count >= count)) continue; best_count = count; best_bitrate = bitrate; best_multiframe = multiframe; ret = real_stream_index; best_decoder = decoder; if (program && i == nb_streams - 1 && ret < 0) { program = NULL; nb_streams = ic->nb_streams; i = 0; } } if (decoder_ret) *decoder_ret = (AVCodec*)best_decoder; return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0, enum AVMediaType VAR_1, int VAR_2, int VAR_3, AVCodec **VAR_4, int VAR_5) { int VAR_6, VAR_7 = VAR_0->VAR_7; int VAR_8 = AVERROR_STREAM_NOT_FOUND, VAR_9 = -1, VAR_10 = -1, VAR_11 = -1, VAR_12, VAR_13, VAR_14; unsigned *VAR_15 = NULL; const AVCodec *VAR_16 = NULL, *best_decoder = NULL; if (VAR_3 >= 0 && VAR_2 < 0) { AVProgram *p = av_find_program_from_stream(VAR_0, NULL, VAR_3); if (p) { VAR_15 = p->stream_index; VAR_7 = p->nb_stream_indexes; } } for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) { int VAR_17 = VAR_15 ? VAR_15[VAR_6] : VAR_6; AVStream *st = VAR_0->streams[VAR_17]; AVCodecContext *avctx = st->codec; if (avctx->codec_type != VAR_1) continue; if (VAR_2 >= 0 && VAR_17 != VAR_2) continue; if (VAR_2 != VAR_17 && st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED | AV_DISPOSITION_VISUAL_IMPAIRED)) continue; if (VAR_1 == AVMEDIA_TYPE_AUDIO && !avctx->channels) continue; if (VAR_4) { VAR_16 = find_decoder(VAR_0, st, st->codec->codec_id); if (!VAR_16) { if (VAR_8 < 0) VAR_8 = AVERROR_DECODER_NOT_FOUND; continue; } } VAR_12 = st->codec_info_nb_frames; VAR_13 = avctx->bit_rate; if (!VAR_13) VAR_13 = avctx->rc_max_rate; VAR_14 = FFMIN(5, VAR_12); if ((VAR_11 > VAR_14) || (VAR_11 == VAR_14 && VAR_10 > VAR_13) || (VAR_11 == VAR_14 && VAR_10 == VAR_13 && VAR_9 >= VAR_12)) continue; VAR_9 = VAR_12; VAR_10 = VAR_13; VAR_11 = VAR_14; VAR_8 = VAR_17; best_decoder = VAR_16; if (VAR_15 && VAR_6 == VAR_7 - 1 && VAR_8 < 0) { VAR_15 = NULL; VAR_7 = VAR_0->VAR_7; VAR_6 = 0; } } if (VAR_4) *VAR_4 = (AVCodec*)best_decoder; return VAR_8; }
[ "int FUNC_0(AVFormatContext *VAR_0, enum AVMediaType VAR_1,\nint VAR_2, int VAR_3,\nAVCodec **VAR_4, int VAR_5)\n{", "int VAR_6, VAR_7 = VAR_0->VAR_7;", "int VAR_8 = AVERROR_STREAM_NOT_FOUND, VAR_9 = -1, VAR_10 = -1, VAR_11 = -1, VAR_12, VAR_13, VAR_14;", "unsigned *VAR_15 = NULL;", "const AVCodec *VAR_16 = NULL, *best_decoder = NULL;", "if (VAR_3 >= 0 && VAR_2 < 0) {", "AVProgram *p = av_find_program_from_stream(VAR_0, NULL, VAR_3);", "if (p) {", "VAR_15 = p->stream_index;", "VAR_7 = p->nb_stream_indexes;", "}", "}", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {", "int VAR_17 = VAR_15 ? VAR_15[VAR_6] : VAR_6;", "AVStream *st = VAR_0->streams[VAR_17];", "AVCodecContext *avctx = st->codec;", "if (avctx->codec_type != VAR_1)\ncontinue;", "if (VAR_2 >= 0 && VAR_17 != VAR_2)\ncontinue;", "if (VAR_2 != VAR_17 &&\nst->disposition & (AV_DISPOSITION_HEARING_IMPAIRED |\nAV_DISPOSITION_VISUAL_IMPAIRED))\ncontinue;", "if (VAR_1 == AVMEDIA_TYPE_AUDIO && !avctx->channels)\ncontinue;", "if (VAR_4) {", "VAR_16 = find_decoder(VAR_0, st, st->codec->codec_id);", "if (!VAR_16) {", "if (VAR_8 < 0)\nVAR_8 = AVERROR_DECODER_NOT_FOUND;", "continue;", "}", "}", "VAR_12 = st->codec_info_nb_frames;", "VAR_13 = avctx->bit_rate;", "if (!VAR_13)\nVAR_13 = avctx->rc_max_rate;", "VAR_14 = FFMIN(5, VAR_12);", "if ((VAR_11 > VAR_14) ||\n(VAR_11 == VAR_14 && VAR_10 > VAR_13) ||\n(VAR_11 == VAR_14 && VAR_10 == VAR_13 && VAR_9 >= VAR_12))\ncontinue;", "VAR_9 = VAR_12;", "VAR_10 = VAR_13;", "VAR_11 = VAR_14;", "VAR_8 = VAR_17;", "best_decoder = VAR_16;", "if (VAR_15 && VAR_6 == VAR_7 - 1 && VAR_8 < 0) {", "VAR_15 = NULL;", "VAR_7 = VAR_0->VAR_7;", "VAR_6 = 0;", "}", "}", "if (VAR_4)\n*VAR_4 = (AVCodec*)best_decoder;", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49, 51, 53, 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ] ]
25,840
static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) { MpegTSContext *ts = filter->u.section_filter.opaque; SectionHeader h1, *h = &h1; PESContext *pes; AVStream *st; const uint8_t *p, *p_end, *desc_list_end, *desc_end; int program_info_length, pcr_pid, pid, stream_type; int desc_list_len, desc_len, desc_tag; int comp_page = 0, anc_page = 0; /* initialize to kill warnings */ char language[4] = {0}; /* initialize to kill warnings */ #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len); #endif p_end = section + section_len - 4; p = section; if (parse_section_header(h, &p, p_end) < 0) return; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "sid=0x%x sec_num=%d/%d\n", h->id, h->sec_num, h->last_sec_num); #endif if (h->tid != PMT_TID) return; clear_program(ts, h->id); pcr_pid = get16(&p, p_end) & 0x1fff; if (pcr_pid < 0) return; add_pid_to_pmt(ts, h->id, pcr_pid); #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "pcr_pid=0x%x\n", pcr_pid); #endif program_info_length = get16(&p, p_end) & 0xfff; if (program_info_length < 0) return; p += program_info_length; if (p >= p_end) return; for(;;) { language[0] = 0; st = 0; stream_type = get8(&p, p_end); if (stream_type < 0) break; pid = get16(&p, p_end) & 0x1fff; if (pid < 0) break; desc_list_len = get16(&p, p_end) & 0xfff; if (desc_list_len < 0) break; desc_list_end = p + desc_list_len; if (desc_list_end > p_end) break; for(;;) { desc_tag = get8(&p, desc_list_end); if (desc_tag < 0) break; if (stream_type == STREAM_TYPE_PRIVATE_DATA) { if((desc_tag == 0x6A) || (desc_tag == 0x7A)) { /*assume DVB AC-3 Audio*/ stream_type = STREAM_TYPE_AUDIO_AC3; } else if(desc_tag == 0x7B) { /* DVB DTS audio */ stream_type = STREAM_TYPE_AUDIO_DTS; } } desc_len = get8(&p, desc_list_end); desc_end = p + desc_len; if (desc_end > desc_list_end) break; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "tag: 0x%02x len=%d\n", desc_tag, desc_len); #endif switch(desc_tag) { case DVB_SUBT_DESCID: if (stream_type == STREAM_TYPE_PRIVATE_DATA) stream_type = STREAM_TYPE_SUBTITLE_DVB; language[0] = get8(&p, desc_end); language[1] = get8(&p, desc_end); language[2] = get8(&p, desc_end); language[3] = 0; get8(&p, desc_end); comp_page = get16(&p, desc_end); anc_page = get16(&p, desc_end); break; case 0x0a: /* ISO 639 language descriptor */ language[0] = get8(&p, desc_end); language[1] = get8(&p, desc_end); language[2] = get8(&p, desc_end); language[3] = 0; break; default: break; } p = desc_end; } p = desc_list_end; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "stream_type=%d pid=0x%x\n", stream_type, pid); #endif /* now create ffmpeg stream */ switch(stream_type) { case STREAM_TYPE_AUDIO_MPEG1: case STREAM_TYPE_AUDIO_MPEG2: case STREAM_TYPE_VIDEO_MPEG1: case STREAM_TYPE_VIDEO_MPEG2: case STREAM_TYPE_VIDEO_MPEG4: case STREAM_TYPE_VIDEO_H264: case STREAM_TYPE_VIDEO_VC1: case STREAM_TYPE_AUDIO_AAC: case STREAM_TYPE_AUDIO_AC3: case STREAM_TYPE_AUDIO_DTS: case STREAM_TYPE_SUBTITLE_DVB: if(ts->pids[pid]){ assert(ts->pids[pid]->type == MPEGTS_PES); pes= ts->pids[pid]->u.pes_filter.opaque; st= pes->st; }else{ pes = add_pes_stream(ts, pid, pcr_pid, stream_type); if (pes) st = new_pes_av_stream(pes, 0); } add_pid_to_pmt(ts, h->id, pid); if(st) av_program_add_stream_index(ts->stream, h->id, st->index); break; default: /* we ignore the other streams */ break; } if (st) { if (language[0] != 0) { memcpy(st->language, language, 4); } if (stream_type == STREAM_TYPE_SUBTITLE_DVB) { st->codec->sub_id = (anc_page << 16) | comp_page; } } } /* all parameters are there */ ts->stop_parse++; mpegts_close_filter(ts, filter); }
true
FFmpeg
28af284cfb44cb198c1b1c01e61c90b10fd9e395
static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) { MpegTSContext *ts = filter->u.section_filter.opaque; SectionHeader h1, *h = &h1; PESContext *pes; AVStream *st; const uint8_t *p, *p_end, *desc_list_end, *desc_end; int program_info_length, pcr_pid, pid, stream_type; int desc_list_len, desc_len, desc_tag; int comp_page = 0, anc_page = 0; char language[4] = {0}; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", section_len); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)section, section_len); #endif p_end = section + section_len - 4; p = section; if (parse_section_header(h, &p, p_end) < 0) return; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "sid=0x%x sec_num=%d/%d\n", h->id, h->sec_num, h->last_sec_num); #endif if (h->tid != PMT_TID) return; clear_program(ts, h->id); pcr_pid = get16(&p, p_end) & 0x1fff; if (pcr_pid < 0) return; add_pid_to_pmt(ts, h->id, pcr_pid); #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "pcr_pid=0x%x\n", pcr_pid); #endif program_info_length = get16(&p, p_end) & 0xfff; if (program_info_length < 0) return; p += program_info_length; if (p >= p_end) return; for(;;) { language[0] = 0; st = 0; stream_type = get8(&p, p_end); if (stream_type < 0) break; pid = get16(&p, p_end) & 0x1fff; if (pid < 0) break; desc_list_len = get16(&p, p_end) & 0xfff; if (desc_list_len < 0) break; desc_list_end = p + desc_list_len; if (desc_list_end > p_end) break; for(;;) { desc_tag = get8(&p, desc_list_end); if (desc_tag < 0) break; if (stream_type == STREAM_TYPE_PRIVATE_DATA) { if((desc_tag == 0x6A) || (desc_tag == 0x7A)) { stream_type = STREAM_TYPE_AUDIO_AC3; } else if(desc_tag == 0x7B) { stream_type = STREAM_TYPE_AUDIO_DTS; } } desc_len = get8(&p, desc_list_end); desc_end = p + desc_len; if (desc_end > desc_list_end) break; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "tag: 0x%02x len=%d\n", desc_tag, desc_len); #endif switch(desc_tag) { case DVB_SUBT_DESCID: if (stream_type == STREAM_TYPE_PRIVATE_DATA) stream_type = STREAM_TYPE_SUBTITLE_DVB; language[0] = get8(&p, desc_end); language[1] = get8(&p, desc_end); language[2] = get8(&p, desc_end); language[3] = 0; get8(&p, desc_end); comp_page = get16(&p, desc_end); anc_page = get16(&p, desc_end); break; case 0x0a: language[0] = get8(&p, desc_end); language[1] = get8(&p, desc_end); language[2] = get8(&p, desc_end); language[3] = 0; break; default: break; } p = desc_end; } p = desc_list_end; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "stream_type=%d pid=0x%x\n", stream_type, pid); #endif switch(stream_type) { case STREAM_TYPE_AUDIO_MPEG1: case STREAM_TYPE_AUDIO_MPEG2: case STREAM_TYPE_VIDEO_MPEG1: case STREAM_TYPE_VIDEO_MPEG2: case STREAM_TYPE_VIDEO_MPEG4: case STREAM_TYPE_VIDEO_H264: case STREAM_TYPE_VIDEO_VC1: case STREAM_TYPE_AUDIO_AAC: case STREAM_TYPE_AUDIO_AC3: case STREAM_TYPE_AUDIO_DTS: case STREAM_TYPE_SUBTITLE_DVB: if(ts->pids[pid]){ assert(ts->pids[pid]->type == MPEGTS_PES); pes= ts->pids[pid]->u.pes_filter.opaque; st= pes->st; }else{ pes = add_pes_stream(ts, pid, pcr_pid, stream_type); if (pes) st = new_pes_av_stream(pes, 0); } add_pid_to_pmt(ts, h->id, pid); if(st) av_program_add_stream_index(ts->stream, h->id, st->index); break; default: break; } if (st) { if (language[0] != 0) { memcpy(st->language, language, 4); } if (stream_type == STREAM_TYPE_SUBTITLE_DVB) { st->codec->sub_id = (anc_page << 16) | comp_page; } } } ts->stop_parse++; mpegts_close_filter(ts, filter); }
{ "code": [ " if(ts->pids[pid]){", " assert(ts->pids[pid]->type == MPEGTS_PES);" ], "line_no": [ 245, 247 ] }
static void FUNC_0(MpegTSFilter *VAR_0, const uint8_t *VAR_1, int VAR_2) { MpegTSContext *ts = VAR_0->u.section_filter.opaque; SectionHeader h1, *h = &h1; PESContext *pes; AVStream *st; const uint8_t *VAR_3, *p_end, *desc_list_end, *desc_end; int VAR_4, VAR_5, VAR_6, VAR_7; int VAR_8, VAR_9, VAR_10; int VAR_11 = 0, VAR_12 = 0; char VAR_13[4] = {0}; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "PMT: len %i\n", VAR_2); av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)VAR_1, VAR_2); #endif p_end = VAR_1 + VAR_2 - 4; VAR_3 = VAR_1; if (parse_section_header(h, &VAR_3, p_end) < 0) return; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "sid=0x%x sec_num=%d/%d\n", h->id, h->sec_num, h->last_sec_num); #endif if (h->tid != PMT_TID) return; clear_program(ts, h->id); VAR_5 = get16(&VAR_3, p_end) & 0x1fff; if (VAR_5 < 0) return; add_pid_to_pmt(ts, h->id, VAR_5); #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "VAR_5=0x%x\n", VAR_5); #endif VAR_4 = get16(&VAR_3, p_end) & 0xfff; if (VAR_4 < 0) return; VAR_3 += VAR_4; if (VAR_3 >= p_end) return; for(;;) { VAR_13[0] = 0; st = 0; VAR_7 = get8(&VAR_3, p_end); if (VAR_7 < 0) break; VAR_6 = get16(&VAR_3, p_end) & 0x1fff; if (VAR_6 < 0) break; VAR_8 = get16(&VAR_3, p_end) & 0xfff; if (VAR_8 < 0) break; desc_list_end = VAR_3 + VAR_8; if (desc_list_end > p_end) break; for(;;) { VAR_10 = get8(&VAR_3, desc_list_end); if (VAR_10 < 0) break; if (VAR_7 == STREAM_TYPE_PRIVATE_DATA) { if((VAR_10 == 0x6A) || (VAR_10 == 0x7A)) { VAR_7 = STREAM_TYPE_AUDIO_AC3; } else if(VAR_10 == 0x7B) { VAR_7 = STREAM_TYPE_AUDIO_DTS; } } VAR_9 = get8(&VAR_3, desc_list_end); desc_end = VAR_3 + VAR_9; if (desc_end > desc_list_end) break; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "tag: 0x%02x len=%d\n", VAR_10, VAR_9); #endif switch(VAR_10) { case DVB_SUBT_DESCID: if (VAR_7 == STREAM_TYPE_PRIVATE_DATA) VAR_7 = STREAM_TYPE_SUBTITLE_DVB; VAR_13[0] = get8(&VAR_3, desc_end); VAR_13[1] = get8(&VAR_3, desc_end); VAR_13[2] = get8(&VAR_3, desc_end); VAR_13[3] = 0; get8(&VAR_3, desc_end); VAR_11 = get16(&VAR_3, desc_end); VAR_12 = get16(&VAR_3, desc_end); break; case 0x0a: VAR_13[0] = get8(&VAR_3, desc_end); VAR_13[1] = get8(&VAR_3, desc_end); VAR_13[2] = get8(&VAR_3, desc_end); VAR_13[3] = 0; break; default: break; } VAR_3 = desc_end; } VAR_3 = desc_list_end; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "VAR_7=%d VAR_6=0x%x\n", VAR_7, VAR_6); #endif switch(VAR_7) { case STREAM_TYPE_AUDIO_MPEG1: case STREAM_TYPE_AUDIO_MPEG2: case STREAM_TYPE_VIDEO_MPEG1: case STREAM_TYPE_VIDEO_MPEG2: case STREAM_TYPE_VIDEO_MPEG4: case STREAM_TYPE_VIDEO_H264: case STREAM_TYPE_VIDEO_VC1: case STREAM_TYPE_AUDIO_AAC: case STREAM_TYPE_AUDIO_AC3: case STREAM_TYPE_AUDIO_DTS: case STREAM_TYPE_SUBTITLE_DVB: if(ts->pids[VAR_6]){ assert(ts->pids[VAR_6]->type == MPEGTS_PES); pes= ts->pids[VAR_6]->u.pes_filter.opaque; st= pes->st; }else{ pes = add_pes_stream(ts, VAR_6, VAR_5, VAR_7); if (pes) st = new_pes_av_stream(pes, 0); } add_pid_to_pmt(ts, h->id, VAR_6); if(st) av_program_add_stream_index(ts->stream, h->id, st->index); break; default: break; } if (st) { if (VAR_13[0] != 0) { memcpy(st->VAR_13, VAR_13, 4); } if (VAR_7 == STREAM_TYPE_SUBTITLE_DVB) { st->codec->sub_id = (VAR_12 << 16) | VAR_11; } } } ts->stop_parse++; mpegts_close_filter(ts, VAR_0); }
[ "static void FUNC_0(MpegTSFilter *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "MpegTSContext *ts = VAR_0->u.section_filter.opaque;", "SectionHeader h1, *h = &h1;", "PESContext *pes;", "AVStream *st;", "const uint8_t *VAR_3, *p_end, *desc_list_end, *desc_end;", "int VAR_4, VAR_5, VAR_6, VAR_7;", "int VAR_8, VAR_9, VAR_10;", "int VAR_11 = 0, VAR_12 = 0;", "char VAR_13[4] = {0};", "#ifdef DEBUG_SI\nav_log(ts->stream, AV_LOG_DEBUG, \"PMT: len %i\\n\", VAR_2);", "av_hex_dump_log(ts->stream, AV_LOG_DEBUG, (uint8_t *)VAR_1, VAR_2);", "#endif\np_end = VAR_1 + VAR_2 - 4;", "VAR_3 = VAR_1;", "if (parse_section_header(h, &VAR_3, p_end) < 0)\nreturn;", "#ifdef DEBUG_SI\nav_log(ts->stream, AV_LOG_DEBUG, \"sid=0x%x sec_num=%d/%d\\n\",\nh->id, h->sec_num, h->last_sec_num);", "#endif\nif (h->tid != PMT_TID)\nreturn;", "clear_program(ts, h->id);", "VAR_5 = get16(&VAR_3, p_end) & 0x1fff;", "if (VAR_5 < 0)\nreturn;", "add_pid_to_pmt(ts, h->id, VAR_5);", "#ifdef DEBUG_SI\nav_log(ts->stream, AV_LOG_DEBUG, \"VAR_5=0x%x\\n\", VAR_5);", "#endif\nVAR_4 = get16(&VAR_3, p_end) & 0xfff;", "if (VAR_4 < 0)\nreturn;", "VAR_3 += VAR_4;", "if (VAR_3 >= p_end)\nreturn;", "for(;;) {", "VAR_13[0] = 0;", "st = 0;", "VAR_7 = get8(&VAR_3, p_end);", "if (VAR_7 < 0)\nbreak;", "VAR_6 = get16(&VAR_3, p_end) & 0x1fff;", "if (VAR_6 < 0)\nbreak;", "VAR_8 = get16(&VAR_3, p_end) & 0xfff;", "if (VAR_8 < 0)\nbreak;", "desc_list_end = VAR_3 + VAR_8;", "if (desc_list_end > p_end)\nbreak;", "for(;;) {", "VAR_10 = get8(&VAR_3, desc_list_end);", "if (VAR_10 < 0)\nbreak;", "if (VAR_7 == STREAM_TYPE_PRIVATE_DATA) {", "if((VAR_10 == 0x6A) || (VAR_10 == 0x7A)) {", "VAR_7 = STREAM_TYPE_AUDIO_AC3;", "} else if(VAR_10 == 0x7B) {", "VAR_7 = STREAM_TYPE_AUDIO_DTS;", "}", "}", "VAR_9 = get8(&VAR_3, desc_list_end);", "desc_end = VAR_3 + VAR_9;", "if (desc_end > desc_list_end)\nbreak;", "#ifdef DEBUG_SI\nav_log(ts->stream, AV_LOG_DEBUG, \"tag: 0x%02x len=%d\\n\",\nVAR_10, VAR_9);", "#endif\nswitch(VAR_10) {", "case DVB_SUBT_DESCID:\nif (VAR_7 == STREAM_TYPE_PRIVATE_DATA)\nVAR_7 = STREAM_TYPE_SUBTITLE_DVB;", "VAR_13[0] = get8(&VAR_3, desc_end);", "VAR_13[1] = get8(&VAR_3, desc_end);", "VAR_13[2] = get8(&VAR_3, desc_end);", "VAR_13[3] = 0;", "get8(&VAR_3, desc_end);", "VAR_11 = get16(&VAR_3, desc_end);", "VAR_12 = get16(&VAR_3, desc_end);", "break;", "case 0x0a:\nVAR_13[0] = get8(&VAR_3, desc_end);", "VAR_13[1] = get8(&VAR_3, desc_end);", "VAR_13[2] = get8(&VAR_3, desc_end);", "VAR_13[3] = 0;", "break;", "default:\nbreak;", "}", "VAR_3 = desc_end;", "}", "VAR_3 = desc_list_end;", "#ifdef DEBUG_SI\nav_log(ts->stream, AV_LOG_DEBUG, \"VAR_7=%d VAR_6=0x%x\\n\",\nVAR_7, VAR_6);", "#endif\nswitch(VAR_7) {", "case STREAM_TYPE_AUDIO_MPEG1:\ncase STREAM_TYPE_AUDIO_MPEG2:\ncase STREAM_TYPE_VIDEO_MPEG1:\ncase STREAM_TYPE_VIDEO_MPEG2:\ncase STREAM_TYPE_VIDEO_MPEG4:\ncase STREAM_TYPE_VIDEO_H264:\ncase STREAM_TYPE_VIDEO_VC1:\ncase STREAM_TYPE_AUDIO_AAC:\ncase STREAM_TYPE_AUDIO_AC3:\ncase STREAM_TYPE_AUDIO_DTS:\ncase STREAM_TYPE_SUBTITLE_DVB:\nif(ts->pids[VAR_6]){", "assert(ts->pids[VAR_6]->type == MPEGTS_PES);", "pes= ts->pids[VAR_6]->u.pes_filter.opaque;", "st= pes->st;", "}else{", "pes = add_pes_stream(ts, VAR_6, VAR_5, VAR_7);", "if (pes)\nst = new_pes_av_stream(pes, 0);", "}", "add_pid_to_pmt(ts, h->id, VAR_6);", "if(st)\nav_program_add_stream_index(ts->stream, h->id, st->index);", "break;", "default:\nbreak;", "}", "if (st) {", "if (VAR_13[0] != 0) {", "memcpy(st->VAR_13, VAR_13, 4);", "}", "if (VAR_7 == STREAM_TYPE_SUBTITLE_DVB) {", "st->codec->sub_id = (VAR_12 << 16) | VAR_11;", "}", "}", "}", "ts->stop_parse++;", "mpegts_close_filter(ts, VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41, 43, 45 ], [ 47, 49, 51 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69, 71 ], [ 73, 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147, 149, 151 ], [ 153, 155 ], [ 157, 159, 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209, 211, 213 ], [ 215, 221 ], [ 223, 225, 227, 229, 231, 233, 235, 237, 239, 241, 243, 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 265, 267 ], [ 269 ], [ 271, 275 ], [ 277 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 303 ], [ 305 ], [ 307 ] ]
25,841
static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { #if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { if (uDest) { YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } else { if (uDest) { YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } return; } #endif #if COMPILE_TEMPLATE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else //COMPILE_TEMPLATE_ALTIVEC yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); #endif //!COMPILE_TEMPLATE_ALTIVEC }
true
FFmpeg
c3ab0004ae4dffc32494ae84dd15cfaa909a7884
static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { #if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { if (uDest) { YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } else { if (uDest) { YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } return; } #endif #if COMPILE_TEMPLATE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); #endif }
{ "code": [ " uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)", " uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)" ], "line_no": [ 5, 5 ] }
static inline void FUNC_0(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { #if COMPILE_TEMPLATE_MMX if(!(c->flags & SWS_BITEXACT)) { if (c->flags & SWS_ACCURATE_RND) { if (uDest) { YSCALEYUV2YV12X_ACCURATE( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X_ACCURATE( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } else { if (uDest) { YSCALEYUV2YV12X( "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW) YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW) } if (CONFIG_SWSCALE_ALPHA && aDest) { YSCALEYUV2YV12X( "0", ALP_MMX_FILTER_OFFSET, aDest, dstW) } YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW) } return; } #endif #if COMPILE_TEMPLATE_ALTIVEC yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, uDest, vDest, dstW, chrDstW); #else yuv2yuvXinC(lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, alpSrc, dest, uDest, vDest, aDest, dstW, chrDstW); #endif }
[ "static inline void FUNC_0(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,\nconst int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, const int16_t **alpSrc,\nuint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW)\n{", "#if COMPILE_TEMPLATE_MMX\nif(!(c->flags & SWS_BITEXACT)) {", "if (c->flags & SWS_ACCURATE_RND) {", "if (uDest) {", "YSCALEYUV2YV12X_ACCURATE( \"0\", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)\nYSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)\n}", "if (CONFIG_SWSCALE_ALPHA && aDest) {", "YSCALEYUV2YV12X_ACCURATE( \"0\", ALP_MMX_FILTER_OFFSET, aDest, dstW)\n}", "YSCALEYUV2YV12X_ACCURATE(\"0\", LUM_MMX_FILTER_OFFSET, dest, dstW)\n} else {", "if (uDest) {", "YSCALEYUV2YV12X( \"0\", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)\nYSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)\n}", "if (CONFIG_SWSCALE_ALPHA && aDest) {", "YSCALEYUV2YV12X( \"0\", ALP_MMX_FILTER_OFFSET, aDest, dstW)\n}", "YSCALEYUV2YV12X(\"0\", LUM_MMX_FILTER_OFFSET, dest, dstW)\n}", "return;", "}", "#endif\n#if COMPILE_TEMPLATE_ALTIVEC\nyuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\ndest, uDest, vDest, dstW, chrDstW);", "#else\nyuv2yuvXinC(lumFilter, lumSrc, lumFilterSize,\nchrFilter, chrSrc, chrFilterSize,\nalpSrc, dest, uDest, vDest, aDest, dstW, chrDstW);", "#endif\n}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25, 27 ], [ 31, 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45, 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59, 61, 63, 65, 67 ], [ 69, 71, 73, 75 ], [ 77, 79 ] ]
25,842
static int qcow_make_empty(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; uint32_t l1_length = s->l1_size * sizeof(uint64_t); int ret; memset(s->l1_table, 0, l1_length); if (bdrv_pwrite(bs->file, s->l1_table_offset, s->l1_table, l1_length) < 0) return -1; ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length); if (ret < 0) return ret; memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t)); return 0; }
true
qemu
5e5557d97026d1d3325e0e7b0ba593366da2f3dc
static int qcow_make_empty(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; uint32_t l1_length = s->l1_size * sizeof(uint64_t); int ret; memset(s->l1_table, 0, l1_length); if (bdrv_pwrite(bs->file, s->l1_table_offset, s->l1_table, l1_length) < 0) return -1; ret = bdrv_truncate(bs->file, s->l1_table_offset + l1_length); if (ret < 0) return ret; memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t)); return 0; }
{ "code": [ " if (bdrv_pwrite(bs->file, s->l1_table_offset, s->l1_table, l1_length) < 0)", "\treturn -1;" ], "line_no": [ 15, 17 ] }
static int FUNC_0(BlockDriverState *VAR_0) { BDRVQcowState *s = VAR_0->opaque; uint32_t l1_length = s->l1_size * sizeof(uint64_t); int VAR_1; memset(s->l1_table, 0, l1_length); if (bdrv_pwrite(VAR_0->file, s->l1_table_offset, s->l1_table, l1_length) < 0) return -1; VAR_1 = bdrv_truncate(VAR_0->file, s->l1_table_offset + l1_length); if (VAR_1 < 0) return VAR_1; memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t)); memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t)); return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVQcowState *s = VAR_0->opaque;", "uint32_t l1_length = s->l1_size * sizeof(uint64_t);", "int VAR_1;", "memset(s->l1_table, 0, l1_length);", "if (bdrv_pwrite(VAR_0->file, s->l1_table_offset, s->l1_table, l1_length) < 0)\nreturn -1;", "VAR_1 = bdrv_truncate(VAR_0->file, s->l1_table_offset + l1_length);", "if (VAR_1 < 0)\nreturn VAR_1;", "memset(s->l2_cache, 0, s->l2_size * L2_CACHE_SIZE * sizeof(uint64_t));", "memset(s->l2_cache_offsets, 0, L2_CACHE_SIZE * sizeof(uint64_t));", "memset(s->l2_cache_counts, 0, L2_CACHE_SIZE * sizeof(uint32_t));", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
25,843
static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, uint8_t* is_intra, int dir) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; int A[2], B[2], C[2]; int px, py; int a_valid = 0, b_valid = 0, c_valid = 0; int field_a, field_b, field_c; // 0: same, 1: opposit int total_valid, num_samefield, num_oppfield; int pos_c, pos_b, n_adj; wrap = s->b8_stride; xy = s->block_index[n]; if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; s->current_picture.motion_val[1][xy][0] = 0; s->current_picture.motion_val[1][xy][1] = 0; if (mvn == 1) { /* duplicate motion data for 1-MV block */ s->current_picture.motion_val[0][xy + 1][0] = 0; s->current_picture.motion_val[0][xy + 1][1] = 0; s->current_picture.motion_val[0][xy + wrap][0] = 0; s->current_picture.motion_val[0][xy + wrap][1] = 0; s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; s->current_picture.motion_val[1][xy + 1][0] = 0; s->current_picture.motion_val[1][xy + 1][1] = 0; s->current_picture.motion_val[1][xy + wrap][0] = 0; s->current_picture.motion_val[1][xy + wrap][1] = 0; s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; } return; } off = ((n == 0) || (n == 1)) ? 1 : -1; /* predict A */ if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) // current block (MB) has a field MV || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV A[0] = s->current_picture.motion_val[dir][xy - 1][0]; A[1] = s->current_picture.motion_val[dir][xy - 1][1]; a_valid = 1; } else { // current block has frame mv and cand. has field MV (so average) A[0] = (s->current_picture.motion_val[dir][xy - 1][0] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; A[1] = (s->current_picture.motion_val[dir][xy - 1][1] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { a_valid = 0; A[0] = A[1] = 0; } } else A[0] = A[1] = 0; /* Predict B and C */ B[0] = B[1] = C[0] = C[1] = 0; if (n == 0 || n == 1 || v->blk_mv_type[xy]) { if (!s->first_slice_line) { if (!v->is_intra[s->mb_x - s->mb_stride]) { b_valid = 1; n_adj = n | 2; pos_b = s->block_index[n_adj] - 2 * wrap; if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!v->is_intra[s->mb_x - s->mb_stride + 1]) { c_valid = 1; n_adj = 2; pos_c = s->block_index[2] - 2 * wrap + 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { c_valid = 1; n_adj = 3; pos_c = s->block_index[3] - 2 * wrap - 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } } else c_valid = 0; } } } } } else { pos_b = s->block_index[1]; b_valid = 1; B[0] = s->current_picture.motion_val[dir][pos_b][0]; B[1] = s->current_picture.motion_val[dir][pos_b][1]; pos_c = s->block_index[0]; c_valid = 1; C[0] = s->current_picture.motion_val[dir][pos_c][0]; C[1] = s->current_picture.motion_val[dir][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; // check if predictor A is out of bounds if (!s->mb_x && !(n == 1 || n == 3)) { A[0] = A[1] = 0; } // check if predictor B is out of bounds if ((s->first_slice_line && v->blk_mv_type[xy]) || (s->first_slice_line && !(n & 2))) { B[0] = B[1] = C[0] = C[1] = 0; } if (!v->blk_mv_type[xy]) { if (s->mb_width == 1) { px = B[0]; py = B[1]; } else { if (total_valid >= 2) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (total_valid) { if (a_valid) { px = A[0]; py = A[1]; } else if (b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else av_assert2(0); } else px = py = 0; } } else { if (a_valid) field_a = (A[1] & 4) ? 1 : 0; else field_a = 0; if (b_valid) field_b = (B[1] & 4) ? 1 : 0; else field_b = 0; if (c_valid) field_c = (C[1] & 4) ? 1 : 0; else field_c = 0; num_oppfield = field_a + field_b + field_c; num_samefield = total_valid - num_oppfield; if (total_valid == 3) { if ((num_samefield == 3) || (num_oppfield == 3)) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (num_samefield >= num_oppfield) { /* take one MV from same field set depending on priority the check for B may not be necessary */ px = !field_a ? A[0] : B[0]; py = !field_a ? A[1] : B[1]; } else { px = field_a ? A[0] : B[0]; py = field_a ? A[1] : B[1]; } } else if (total_valid == 2) { if (num_samefield >= num_oppfield) { if (!field_a && a_valid) { px = A[0]; py = A[1]; } else if (!field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } else { if (field_a && a_valid) { px = A[0]; py = A[1]; } else if (field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } } else if (total_valid == 1) { px = (a_valid) ? A[0] : ((b_valid) ? B[0] : C[0]); py = (a_valid) ? A[1] : ((b_valid) ? B[1] : C[1]); } else px = py = 0; } /* store MV using signed modulus of MV range defined in 4.11 */ s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; if (mvn == 1) { /* duplicate motion data for 1-MV block */ s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; s->mv[dir][n + 1][0] = s->mv[dir][n][0]; s->mv[dir][n + 1][1] = s->mv[dir][n][1]; } }
true
FFmpeg
6c5bd7d785ffb796b8cfbae677ab54755b26a22b
static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, uint8_t* is_intra, int dir) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; int A[2], B[2], C[2]; int px, py; int a_valid = 0, b_valid = 0, c_valid = 0; int field_a, field_b, field_c; int total_valid, num_samefield, num_oppfield; int pos_c, pos_b, n_adj; wrap = s->b8_stride; xy = s->block_index[n]; if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; s->current_picture.motion_val[1][xy][0] = 0; s->current_picture.motion_val[1][xy][1] = 0; if (mvn == 1) { s->current_picture.motion_val[0][xy + 1][0] = 0; s->current_picture.motion_val[0][xy + 1][1] = 0; s->current_picture.motion_val[0][xy + wrap][0] = 0; s->current_picture.motion_val[0][xy + wrap][1] = 0; s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; s->current_picture.motion_val[1][xy + 1][0] = 0; s->current_picture.motion_val[1][xy + 1][1] = 0; s->current_picture.motion_val[1][xy + wrap][0] = 0; s->current_picture.motion_val[1][xy + wrap][1] = 0; s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; } return; } off = ((n == 0) || (n == 1)) ? 1 : -1; if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { A[0] = s->current_picture.motion_val[dir][xy - 1][0]; A[1] = s->current_picture.motion_val[dir][xy - 1][1]; a_valid = 1; } else { A[0] = (s->current_picture.motion_val[dir][xy - 1][0] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; A[1] = (s->current_picture.motion_val[dir][xy - 1][1] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { a_valid = 0; A[0] = A[1] = 0; } } else A[0] = A[1] = 0; B[0] = B[1] = C[0] = C[1] = 0; if (n == 0 || n == 1 || v->blk_mv_type[xy]) { if (!s->first_slice_line) { if (!v->is_intra[s->mb_x - s->mb_stride]) { b_valid = 1; n_adj = n | 2; pos_b = s->block_index[n_adj] - 2 * wrap; if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!v->is_intra[s->mb_x - s->mb_stride + 1]) { c_valid = 1; n_adj = 2; pos_c = s->block_index[2] - 2 * wrap + 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { c_valid = 1; n_adj = 3; pos_c = s->block_index[3] - 2 * wrap - 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } } else c_valid = 0; } } } } } else { pos_b = s->block_index[1]; b_valid = 1; B[0] = s->current_picture.motion_val[dir][pos_b][0]; B[1] = s->current_picture.motion_val[dir][pos_b][1]; pos_c = s->block_index[0]; c_valid = 1; C[0] = s->current_picture.motion_val[dir][pos_c][0]; C[1] = s->current_picture.motion_val[dir][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; if (!s->mb_x && !(n == 1 || n == 3)) { A[0] = A[1] = 0; } if ((s->first_slice_line && v->blk_mv_type[xy]) || (s->first_slice_line && !(n & 2))) { B[0] = B[1] = C[0] = C[1] = 0; } if (!v->blk_mv_type[xy]) { if (s->mb_width == 1) { px = B[0]; py = B[1]; } else { if (total_valid >= 2) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (total_valid) { if (a_valid) { px = A[0]; py = A[1]; } else if (b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else av_assert2(0); } else px = py = 0; } } else { if (a_valid) field_a = (A[1] & 4) ? 1 : 0; else field_a = 0; if (b_valid) field_b = (B[1] & 4) ? 1 : 0; else field_b = 0; if (c_valid) field_c = (C[1] & 4) ? 1 : 0; else field_c = 0; num_oppfield = field_a + field_b + field_c; num_samefield = total_valid - num_oppfield; if (total_valid == 3) { if ((num_samefield == 3) || (num_oppfield == 3)) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (num_samefield >= num_oppfield) { px = !field_a ? A[0] : B[0]; py = !field_a ? A[1] : B[1]; } else { px = field_a ? A[0] : B[0]; py = field_a ? A[1] : B[1]; } } else if (total_valid == 2) { if (num_samefield >= num_oppfield) { if (!field_a && a_valid) { px = A[0]; py = A[1]; } else if (!field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } else { if (field_a && a_valid) { px = A[0]; py = A[1]; } else if (field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } } else if (total_valid == 1) { px = (a_valid) ? A[0] : ((b_valid) ? B[0] : C[0]); py = (a_valid) ? A[1] : ((b_valid) ? B[1] : C[1]); } else px = py = 0; } s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; if (mvn == 1) { s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; } else if (mvn == 2) { s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; s->mv[dir][n + 1][0] = s->mv[dir][n][0]; s->mv[dir][n + 1][1] = s->mv[dir][n][1]; } }
{ "code": [ " int px, py;", " } else", " px = py = 0;", " } else px = py = 0;", " } else", " px = py = 0;" ], "line_no": [ 13, 289, 291, 375, 407, 409 ] }
static inline void FUNC_0(VC1Context *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5, int VAR_6, uint8_t* VAR_7, int VAR_8) { MpegEncContext *s = &VAR_0->s; int VAR_9, VAR_10, VAR_11 = 0; int VAR_12[2], VAR_13[2], VAR_14[2]; int VAR_15, VAR_16; int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0; int VAR_20, VAR_21, VAR_22; int VAR_23, VAR_24, VAR_25; int VAR_26, VAR_27, VAR_28; VAR_10 = s->b8_stride; VAR_9 = s->block_index[VAR_1]; if (s->mb_intra) { s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][VAR_9][0] = 0; s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][VAR_9][1] = 0; s->current_picture.motion_val[1][VAR_9][0] = 0; s->current_picture.motion_val[1][VAR_9][1] = 0; if (VAR_4 == 1) { s->current_picture.motion_val[0][VAR_9 + 1][0] = 0; s->current_picture.motion_val[0][VAR_9 + 1][1] = 0; s->current_picture.motion_val[0][VAR_9 + VAR_10][0] = 0; s->current_picture.motion_val[0][VAR_9 + VAR_10][1] = 0; s->current_picture.motion_val[0][VAR_9 + VAR_10 + 1][0] = 0; s->current_picture.motion_val[0][VAR_9 + VAR_10 + 1][1] = 0; VAR_0->luma_mv[s->mb_x][0] = VAR_0->luma_mv[s->mb_x][1] = 0; s->current_picture.motion_val[1][VAR_9 + 1][0] = 0; s->current_picture.motion_val[1][VAR_9 + 1][1] = 0; s->current_picture.motion_val[1][VAR_9 + VAR_10][0] = 0; s->current_picture.motion_val[1][VAR_9 + VAR_10][1] = 0; s->current_picture.motion_val[1][VAR_9 + VAR_10 + 1][0] = 0; s->current_picture.motion_val[1][VAR_9 + VAR_10 + 1][1] = 0; } return; } VAR_11 = ((VAR_1 == 0) || (VAR_1 == 1)) ? 1 : -1; if (s->mb_x || (VAR_1 == 1) || (VAR_1 == 3)) { if ((VAR_0->blk_mv_type[VAR_9]) || (!VAR_0->blk_mv_type[VAR_9] && !VAR_0->blk_mv_type[VAR_9 - 1])) { VAR_12[0] = s->current_picture.motion_val[VAR_8][VAR_9 - 1][0]; VAR_12[1] = s->current_picture.motion_val[VAR_8][VAR_9 - 1][1]; VAR_17 = 1; } else { VAR_12[0] = (s->current_picture.motion_val[VAR_8][VAR_9 - 1][0] + s->current_picture.motion_val[VAR_8][VAR_9 - 1 + VAR_11 * VAR_10][0] + 1) >> 1; VAR_12[1] = (s->current_picture.motion_val[VAR_8][VAR_9 - 1][1] + s->current_picture.motion_val[VAR_8][VAR_9 - 1 + VAR_11 * VAR_10][1] + 1) >> 1; VAR_17 = 1; } if (!(VAR_1 & 1) && VAR_0->VAR_7[s->mb_x - 1]) { VAR_17 = 0; VAR_12[0] = VAR_12[1] = 0; } } else VAR_12[0] = VAR_12[1] = 0; VAR_13[0] = VAR_13[1] = VAR_14[0] = VAR_14[1] = 0; if (VAR_1 == 0 || VAR_1 == 1 || VAR_0->blk_mv_type[VAR_9]) { if (!s->first_slice_line) { if (!VAR_0->VAR_7[s->mb_x - s->mb_stride]) { VAR_18 = 1; VAR_28 = VAR_1 | 2; VAR_27 = s->block_index[VAR_28] - 2 * VAR_10; if (VAR_0->blk_mv_type[VAR_27] && VAR_0->blk_mv_type[VAR_9]) { VAR_28 = (VAR_1 & 2) | (VAR_1 & 1); } VAR_13[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10][0]; VAR_13[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10][1]; if (VAR_0->blk_mv_type[VAR_27] && !VAR_0->blk_mv_type[VAR_9]) { VAR_13[0] = (VAR_13[0] + s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10][0] + 1) >> 1; VAR_13[1] = (VAR_13[1] + s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!VAR_0->VAR_7[s->mb_x - s->mb_stride + 1]) { VAR_19 = 1; VAR_28 = 2; VAR_26 = s->block_index[2] - 2 * VAR_10 + 2; if (VAR_0->blk_mv_type[VAR_26] && VAR_0->blk_mv_type[VAR_9]) { VAR_28 = VAR_1 & 2; } VAR_14[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 + 2][0]; VAR_14[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 + 2][1]; if (VAR_0->blk_mv_type[VAR_26] && !VAR_0->blk_mv_type[VAR_9]) { VAR_14[0] = (1 + VAR_14[0] + (s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10 + 2][0])) >> 1; VAR_14[1] = (1 + VAR_14[1] + (s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10 + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!VAR_0->VAR_7[s->mb_x - s->mb_stride - 1]) { VAR_19 = 1; VAR_28 = 3; VAR_26 = s->block_index[3] - 2 * VAR_10 - 2; if (VAR_0->blk_mv_type[VAR_26] && VAR_0->blk_mv_type[VAR_9]) { VAR_28 = VAR_1 | 1; } VAR_14[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 - 2][0]; VAR_14[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 - 2][1]; if (VAR_0->blk_mv_type[VAR_26] && !VAR_0->blk_mv_type[VAR_9]) { VAR_14[0] = (1 + VAR_14[0] + s->current_picture.motion_val[VAR_8][s->block_index[1] - 2 * VAR_10 - 2][0]) >> 1; VAR_14[1] = (1 + VAR_14[1] + s->current_picture.motion_val[VAR_8][s->block_index[1] - 2 * VAR_10 - 2][1]) >> 1; } } else VAR_19 = 0; } } } } } else { VAR_27 = s->block_index[1]; VAR_18 = 1; VAR_13[0] = s->current_picture.motion_val[VAR_8][VAR_27][0]; VAR_13[1] = s->current_picture.motion_val[VAR_8][VAR_27][1]; VAR_26 = s->block_index[0]; VAR_19 = 1; VAR_14[0] = s->current_picture.motion_val[VAR_8][VAR_26][0]; VAR_14[1] = s->current_picture.motion_val[VAR_8][VAR_26][1]; } VAR_23 = VAR_17 + VAR_18 + VAR_19; if (!s->mb_x && !(VAR_1 == 1 || VAR_1 == 3)) { VAR_12[0] = VAR_12[1] = 0; } if ((s->first_slice_line && VAR_0->blk_mv_type[VAR_9]) || (s->first_slice_line && !(VAR_1 & 2))) { VAR_13[0] = VAR_13[1] = VAR_14[0] = VAR_14[1] = 0; } if (!VAR_0->blk_mv_type[VAR_9]) { if (s->mb_width == 1) { VAR_15 = VAR_13[0]; VAR_16 = VAR_13[1]; } else { if (VAR_23 >= 2) { VAR_15 = mid_pred(VAR_12[0], VAR_13[0], VAR_14[0]); VAR_16 = mid_pred(VAR_12[1], VAR_13[1], VAR_14[1]); } else if (VAR_23) { if (VAR_17) { VAR_15 = VAR_12[0]; VAR_16 = VAR_12[1]; } else if (VAR_18) { VAR_15 = VAR_13[0]; VAR_16 = VAR_13[1]; } else if (VAR_19) { VAR_15 = VAR_14[0]; VAR_16 = VAR_14[1]; } else av_assert2(0); } else VAR_15 = VAR_16 = 0; } } else { if (VAR_17) VAR_20 = (VAR_12[1] & 4) ? 1 : 0; else VAR_20 = 0; if (VAR_18) VAR_21 = (VAR_13[1] & 4) ? 1 : 0; else VAR_21 = 0; if (VAR_19) VAR_22 = (VAR_14[1] & 4) ? 1 : 0; else VAR_22 = 0; VAR_25 = VAR_20 + VAR_21 + VAR_22; VAR_24 = VAR_23 - VAR_25; if (VAR_23 == 3) { if ((VAR_24 == 3) || (VAR_25 == 3)) { VAR_15 = mid_pred(VAR_12[0], VAR_13[0], VAR_14[0]); VAR_16 = mid_pred(VAR_12[1], VAR_13[1], VAR_14[1]); } else if (VAR_24 >= VAR_25) { VAR_15 = !VAR_20 ? VAR_12[0] : VAR_13[0]; VAR_16 = !VAR_20 ? VAR_12[1] : VAR_13[1]; } else { VAR_15 = VAR_20 ? VAR_12[0] : VAR_13[0]; VAR_16 = VAR_20 ? VAR_12[1] : VAR_13[1]; } } else if (VAR_23 == 2) { if (VAR_24 >= VAR_25) { if (!VAR_20 && VAR_17) { VAR_15 = VAR_12[0]; VAR_16 = VAR_12[1]; } else if (!VAR_21 && VAR_18) { VAR_15 = VAR_13[0]; VAR_16 = VAR_13[1]; } else if (VAR_19) { VAR_15 = VAR_14[0]; VAR_16 = VAR_14[1]; } else VAR_15 = VAR_16 = 0; } else { if (VAR_20 && VAR_17) { VAR_15 = VAR_12[0]; VAR_16 = VAR_12[1]; } else if (VAR_21 && VAR_18) { VAR_15 = VAR_13[0]; VAR_16 = VAR_13[1]; } else if (VAR_19) { VAR_15 = VAR_14[0]; VAR_16 = VAR_14[1]; } else VAR_15 = VAR_16 = 0; } } else if (VAR_23 == 1) { VAR_15 = (VAR_17) ? VAR_12[0] : ((VAR_18) ? VAR_13[0] : VAR_14[0]); VAR_16 = (VAR_17) ? VAR_12[1] : ((VAR_18) ? VAR_13[1] : VAR_14[1]); } else VAR_15 = VAR_16 = 0; } s->mv[VAR_8][VAR_1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0] = ((VAR_15 + VAR_2 + VAR_5) & ((VAR_5 << 1) - 1)) - VAR_5; s->mv[VAR_8][VAR_1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1] = ((VAR_16 + VAR_3 + VAR_6) & ((VAR_6 << 1) - 1)) - VAR_6; if (VAR_4 == 1) { s->current_picture.motion_val[VAR_8][VAR_9 + 1 ][0] = s->current_picture.motion_val[VAR_8][VAR_9][0]; s->current_picture.motion_val[VAR_8][VAR_9 + 1 ][1] = s->current_picture.motion_val[VAR_8][VAR_9][1]; s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 ][0] = s->current_picture.motion_val[VAR_8][VAR_9][0]; s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 ][1] = s->current_picture.motion_val[VAR_8][VAR_9][1]; s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 + 1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0]; s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 + 1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1]; } else if (VAR_4 == 2) { s->current_picture.motion_val[VAR_8][VAR_9 + 1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0]; s->current_picture.motion_val[VAR_8][VAR_9 + 1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1]; s->mv[VAR_8][VAR_1 + 1][0] = s->mv[VAR_8][VAR_1][0]; s->mv[VAR_8][VAR_1 + 1][1] = s->mv[VAR_8][VAR_1][1]; } }
[ "static inline void FUNC_0(VC1Context *VAR_0, int VAR_1, int VAR_2, int VAR_3,\nint VAR_4, int VAR_5, int VAR_6, uint8_t* VAR_7, int VAR_8)\n{", "MpegEncContext *s = &VAR_0->s;", "int VAR_9, VAR_10, VAR_11 = 0;", "int VAR_12[2], VAR_13[2], VAR_14[2];", "int VAR_15, VAR_16;", "int VAR_17 = 0, VAR_18 = 0, VAR_19 = 0;", "int VAR_20, VAR_21, VAR_22;", "int VAR_23, VAR_24, VAR_25;", "int VAR_26, VAR_27, VAR_28;", "VAR_10 = s->b8_stride;", "VAR_9 = s->block_index[VAR_1];", "if (s->mb_intra) {", "s->mv[0][VAR_1][0] = s->current_picture.motion_val[0][VAR_9][0] = 0;", "s->mv[0][VAR_1][1] = s->current_picture.motion_val[0][VAR_9][1] = 0;", "s->current_picture.motion_val[1][VAR_9][0] = 0;", "s->current_picture.motion_val[1][VAR_9][1] = 0;", "if (VAR_4 == 1) {", "s->current_picture.motion_val[0][VAR_9 + 1][0] = 0;", "s->current_picture.motion_val[0][VAR_9 + 1][1] = 0;", "s->current_picture.motion_val[0][VAR_9 + VAR_10][0] = 0;", "s->current_picture.motion_val[0][VAR_9 + VAR_10][1] = 0;", "s->current_picture.motion_val[0][VAR_9 + VAR_10 + 1][0] = 0;", "s->current_picture.motion_val[0][VAR_9 + VAR_10 + 1][1] = 0;", "VAR_0->luma_mv[s->mb_x][0] = VAR_0->luma_mv[s->mb_x][1] = 0;", "s->current_picture.motion_val[1][VAR_9 + 1][0] = 0;", "s->current_picture.motion_val[1][VAR_9 + 1][1] = 0;", "s->current_picture.motion_val[1][VAR_9 + VAR_10][0] = 0;", "s->current_picture.motion_val[1][VAR_9 + VAR_10][1] = 0;", "s->current_picture.motion_val[1][VAR_9 + VAR_10 + 1][0] = 0;", "s->current_picture.motion_val[1][VAR_9 + VAR_10 + 1][1] = 0;", "}", "return;", "}", "VAR_11 = ((VAR_1 == 0) || (VAR_1 == 1)) ? 1 : -1;", "if (s->mb_x || (VAR_1 == 1) || (VAR_1 == 3)) {", "if ((VAR_0->blk_mv_type[VAR_9])\n|| (!VAR_0->blk_mv_type[VAR_9] && !VAR_0->blk_mv_type[VAR_9 - 1])) {", "VAR_12[0] = s->current_picture.motion_val[VAR_8][VAR_9 - 1][0];", "VAR_12[1] = s->current_picture.motion_val[VAR_8][VAR_9 - 1][1];", "VAR_17 = 1;", "} else {", "VAR_12[0] = (s->current_picture.motion_val[VAR_8][VAR_9 - 1][0]\n+ s->current_picture.motion_val[VAR_8][VAR_9 - 1 + VAR_11 * VAR_10][0] + 1) >> 1;", "VAR_12[1] = (s->current_picture.motion_val[VAR_8][VAR_9 - 1][1]\n+ s->current_picture.motion_val[VAR_8][VAR_9 - 1 + VAR_11 * VAR_10][1] + 1) >> 1;", "VAR_17 = 1;", "}", "if (!(VAR_1 & 1) && VAR_0->VAR_7[s->mb_x - 1]) {", "VAR_17 = 0;", "VAR_12[0] = VAR_12[1] = 0;", "}", "} else", "VAR_12[0] = VAR_12[1] = 0;", "VAR_13[0] = VAR_13[1] = VAR_14[0] = VAR_14[1] = 0;", "if (VAR_1 == 0 || VAR_1 == 1 || VAR_0->blk_mv_type[VAR_9]) {", "if (!s->first_slice_line) {", "if (!VAR_0->VAR_7[s->mb_x - s->mb_stride]) {", "VAR_18 = 1;", "VAR_28 = VAR_1 | 2;", "VAR_27 = s->block_index[VAR_28] - 2 * VAR_10;", "if (VAR_0->blk_mv_type[VAR_27] && VAR_0->blk_mv_type[VAR_9]) {", "VAR_28 = (VAR_1 & 2) | (VAR_1 & 1);", "}", "VAR_13[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10][0];", "VAR_13[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10][1];", "if (VAR_0->blk_mv_type[VAR_27] && !VAR_0->blk_mv_type[VAR_9]) {", "VAR_13[0] = (VAR_13[0] + s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10][0] + 1) >> 1;", "VAR_13[1] = (VAR_13[1] + s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10][1] + 1) >> 1;", "}", "}", "if (s->mb_width > 1) {", "if (!VAR_0->VAR_7[s->mb_x - s->mb_stride + 1]) {", "VAR_19 = 1;", "VAR_28 = 2;", "VAR_26 = s->block_index[2] - 2 * VAR_10 + 2;", "if (VAR_0->blk_mv_type[VAR_26] && VAR_0->blk_mv_type[VAR_9]) {", "VAR_28 = VAR_1 & 2;", "}", "VAR_14[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 + 2][0];", "VAR_14[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 + 2][1];", "if (VAR_0->blk_mv_type[VAR_26] && !VAR_0->blk_mv_type[VAR_9]) {", "VAR_14[0] = (1 + VAR_14[0] + (s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10 + 2][0])) >> 1;", "VAR_14[1] = (1 + VAR_14[1] + (s->current_picture.motion_val[VAR_8][s->block_index[VAR_28 ^ 2] - 2 * VAR_10 + 2][1])) >> 1;", "}", "if (s->mb_x == s->mb_width - 1) {", "if (!VAR_0->VAR_7[s->mb_x - s->mb_stride - 1]) {", "VAR_19 = 1;", "VAR_28 = 3;", "VAR_26 = s->block_index[3] - 2 * VAR_10 - 2;", "if (VAR_0->blk_mv_type[VAR_26] && VAR_0->blk_mv_type[VAR_9]) {", "VAR_28 = VAR_1 | 1;", "}", "VAR_14[0] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 - 2][0];", "VAR_14[1] = s->current_picture.motion_val[VAR_8][s->block_index[VAR_28] - 2 * VAR_10 - 2][1];", "if (VAR_0->blk_mv_type[VAR_26] && !VAR_0->blk_mv_type[VAR_9]) {", "VAR_14[0] = (1 + VAR_14[0] + s->current_picture.motion_val[VAR_8][s->block_index[1] - 2 * VAR_10 - 2][0]) >> 1;", "VAR_14[1] = (1 + VAR_14[1] + s->current_picture.motion_val[VAR_8][s->block_index[1] - 2 * VAR_10 - 2][1]) >> 1;", "}", "} else", "VAR_19 = 0;", "}", "}", "}", "}", "} else {", "VAR_27 = s->block_index[1];", "VAR_18 = 1;", "VAR_13[0] = s->current_picture.motion_val[VAR_8][VAR_27][0];", "VAR_13[1] = s->current_picture.motion_val[VAR_8][VAR_27][1];", "VAR_26 = s->block_index[0];", "VAR_19 = 1;", "VAR_14[0] = s->current_picture.motion_val[VAR_8][VAR_26][0];", "VAR_14[1] = s->current_picture.motion_val[VAR_8][VAR_26][1];", "}", "VAR_23 = VAR_17 + VAR_18 + VAR_19;", "if (!s->mb_x && !(VAR_1 == 1 || VAR_1 == 3)) {", "VAR_12[0] = VAR_12[1] = 0;", "}", "if ((s->first_slice_line && VAR_0->blk_mv_type[VAR_9]) || (s->first_slice_line && !(VAR_1 & 2))) {", "VAR_13[0] = VAR_13[1] = VAR_14[0] = VAR_14[1] = 0;", "}", "if (!VAR_0->blk_mv_type[VAR_9]) {", "if (s->mb_width == 1) {", "VAR_15 = VAR_13[0];", "VAR_16 = VAR_13[1];", "} else {", "if (VAR_23 >= 2) {", "VAR_15 = mid_pred(VAR_12[0], VAR_13[0], VAR_14[0]);", "VAR_16 = mid_pred(VAR_12[1], VAR_13[1], VAR_14[1]);", "} else if (VAR_23) {", "if (VAR_17) { VAR_15 = VAR_12[0]; VAR_16 = VAR_12[1]; }", "else if (VAR_18) { VAR_15 = VAR_13[0]; VAR_16 = VAR_13[1]; }", "else if (VAR_19) { VAR_15 = VAR_14[0]; VAR_16 = VAR_14[1]; }", "else av_assert2(0);", "} else", "VAR_15 = VAR_16 = 0;", "}", "} else {", "if (VAR_17)\nVAR_20 = (VAR_12[1] & 4) ? 1 : 0;", "else\nVAR_20 = 0;", "if (VAR_18)\nVAR_21 = (VAR_13[1] & 4) ? 1 : 0;", "else\nVAR_21 = 0;", "if (VAR_19)\nVAR_22 = (VAR_14[1] & 4) ? 1 : 0;", "else\nVAR_22 = 0;", "VAR_25 = VAR_20 + VAR_21 + VAR_22;", "VAR_24 = VAR_23 - VAR_25;", "if (VAR_23 == 3) {", "if ((VAR_24 == 3) || (VAR_25 == 3)) {", "VAR_15 = mid_pred(VAR_12[0], VAR_13[0], VAR_14[0]);", "VAR_16 = mid_pred(VAR_12[1], VAR_13[1], VAR_14[1]);", "} else if (VAR_24 >= VAR_25) {", "VAR_15 = !VAR_20 ? VAR_12[0] : VAR_13[0];", "VAR_16 = !VAR_20 ? VAR_12[1] : VAR_13[1];", "} else {", "VAR_15 = VAR_20 ? VAR_12[0] : VAR_13[0];", "VAR_16 = VAR_20 ? VAR_12[1] : VAR_13[1];", "}", "} else if (VAR_23 == 2) {", "if (VAR_24 >= VAR_25) {", "if (!VAR_20 && VAR_17) {", "VAR_15 = VAR_12[0];", "VAR_16 = VAR_12[1];", "} else if (!VAR_21 && VAR_18) {", "VAR_15 = VAR_13[0];", "VAR_16 = VAR_13[1];", "} else if (VAR_19) {", "VAR_15 = VAR_14[0];", "VAR_16 = VAR_14[1];", "} else VAR_15 = VAR_16 = 0;", "} else {", "if (VAR_20 && VAR_17) {", "VAR_15 = VAR_12[0];", "VAR_16 = VAR_12[1];", "} else if (VAR_21 && VAR_18) {", "VAR_15 = VAR_13[0];", "VAR_16 = VAR_13[1];", "} else if (VAR_19) {", "VAR_15 = VAR_14[0];", "VAR_16 = VAR_14[1];", "} else VAR_15 = VAR_16 = 0;", "}", "} else if (VAR_23 == 1) {", "VAR_15 = (VAR_17) ? VAR_12[0] : ((VAR_18) ? VAR_13[0] : VAR_14[0]);", "VAR_16 = (VAR_17) ? VAR_12[1] : ((VAR_18) ? VAR_13[1] : VAR_14[1]);", "} else", "VAR_15 = VAR_16 = 0;", "}", "s->mv[VAR_8][VAR_1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0] = ((VAR_15 + VAR_2 + VAR_5) & ((VAR_5 << 1) - 1)) - VAR_5;", "s->mv[VAR_8][VAR_1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1] = ((VAR_16 + VAR_3 + VAR_6) & ((VAR_6 << 1) - 1)) - VAR_6;", "if (VAR_4 == 1) {", "s->current_picture.motion_val[VAR_8][VAR_9 + 1 ][0] = s->current_picture.motion_val[VAR_8][VAR_9][0];", "s->current_picture.motion_val[VAR_8][VAR_9 + 1 ][1] = s->current_picture.motion_val[VAR_8][VAR_9][1];", "s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 ][0] = s->current_picture.motion_val[VAR_8][VAR_9][0];", "s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 ][1] = s->current_picture.motion_val[VAR_8][VAR_9][1];", "s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 + 1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0];", "s->current_picture.motion_val[VAR_8][VAR_9 + VAR_10 + 1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1];", "} else if (VAR_4 == 2) {", "s->current_picture.motion_val[VAR_8][VAR_9 + 1][0] = s->current_picture.motion_val[VAR_8][VAR_9][0];", "s->current_picture.motion_val[VAR_8][VAR_9 + 1][1] = s->current_picture.motion_val[VAR_8][VAR_9][1];", "s->mv[VAR_8][VAR_1 + 1][0] = s->mv[VAR_8][VAR_1][0];", "s->mv[VAR_8][VAR_1 + 1][1] = s->mv[VAR_8][VAR_1][1];", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 245 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297, 299 ], [ 301, 303 ], [ 305, 307 ], [ 309, 311 ], [ 313, 315 ], [ 317, 319 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ] ]
25,844
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp) { /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */ char tmp_filename[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int ret; /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ /* Get the required size from the image */ total_size = bdrv_getlength(bs); if (total_size < 0) { error_setg_errno(errp, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; /* Create the temporary image */ ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err); free_option_parameters(create_options); if (ret < 0) { error_setg_errno(errp, -ret, "Could not create temporary overlay " "'%s': %s", tmp_filename, error_get_pretty(local_err)); error_free(local_err); return; } /* Prepare a new options QDict for the temporary file */ snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(tmp_filename)); bs_snapshot = bdrv_new("", &error_abort); bs_snapshot->is_temporary = 1; ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } bdrv_append(bs_snapshot, bs); }
true
qemu
1ba4b6a553ad9ff4645af7fab8adfc6e810fcc69
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp) { char tmp_filename[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int ret; total_size = bdrv_getlength(bs); if (total_size < 0) { error_setg_errno(errp, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { error_setg_errno(errp, -ret, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err); free_option_parameters(create_options); if (ret < 0) { error_setg_errno(errp, -ret, "Could not create temporary overlay " "'%s': %s", tmp_filename, error_get_pretty(local_err)); error_free(local_err); return; } snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(tmp_filename)); bs_snapshot = bdrv_new("", &error_abort); bs_snapshot->is_temporary = 1; ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (ret < 0) { error_propagate(errp, local_err); return; } bdrv_append(bs_snapshot, bs); }
{ "code": [ " char tmp_filename[PATH_MAX + 1];", " ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));" ], "line_no": [ 7, 51 ] }
void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1) { char VAR_2[PATH_MAX + 1]; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; QDict *snapshot_options; BlockDriverState *bs_snapshot; Error *local_err; int VAR_3; total_size = bdrv_getlength(VAR_0); if (total_size < 0) { error_setg_errno(VAR_1, -total_size, "Could not get image size"); return; } total_size &= BDRV_SECTOR_MASK; VAR_3 = get_tmp_filename(VAR_2, sizeof(VAR_2)); if (VAR_3 < 0) { error_setg_errno(VAR_1, -VAR_3, "Could not get temporary filename"); return; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); VAR_3 = bdrv_create(bdrv_qcow2, VAR_2, create_options, &local_err); free_option_parameters(create_options); if (VAR_3 < 0) { error_setg_errno(VAR_1, -VAR_3, "Could not create temporary overlay " "'%s': %s", VAR_2, error_get_pretty(local_err)); error_free(local_err); return; } snapshot_options = qdict_new(); qdict_put(snapshot_options, "file.driver", qstring_from_str("file")); qdict_put(snapshot_options, "file.filename", qstring_from_str(VAR_2)); bs_snapshot = bdrv_new("", &error_abort); bs_snapshot->is_temporary = 1; VAR_3 = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options, VAR_0->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err); if (VAR_3 < 0) { error_propagate(VAR_1, local_err); return; } bdrv_append(bs_snapshot, VAR_0); }
[ "void FUNC_0(BlockDriverState *VAR_0, Error **VAR_1)\n{", "char VAR_2[PATH_MAX + 1];", "int64_t total_size;", "BlockDriver *bdrv_qcow2;", "QEMUOptionParameter *create_options;", "QDict *snapshot_options;", "BlockDriverState *bs_snapshot;", "Error *local_err;", "int VAR_3;", "total_size = bdrv_getlength(VAR_0);", "if (total_size < 0) {", "error_setg_errno(VAR_1, -total_size, \"Could not get image size\");", "return;", "}", "total_size &= BDRV_SECTOR_MASK;", "VAR_3 = get_tmp_filename(VAR_2, sizeof(VAR_2));", "if (VAR_3 < 0) {", "error_setg_errno(VAR_1, -VAR_3, \"Could not get temporary filename\");", "return;", "}", "bdrv_qcow2 = bdrv_find_format(\"qcow2\");", "create_options = parse_option_parameters(\"\", bdrv_qcow2->create_options,\nNULL);", "set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);", "VAR_3 = bdrv_create(bdrv_qcow2, VAR_2, create_options, &local_err);", "free_option_parameters(create_options);", "if (VAR_3 < 0) {", "error_setg_errno(VAR_1, -VAR_3, \"Could not create temporary overlay \"\n\"'%s': %s\", VAR_2,\nerror_get_pretty(local_err));", "error_free(local_err);", "return;", "}", "snapshot_options = qdict_new();", "qdict_put(snapshot_options, \"file.driver\",\nqstring_from_str(\"file\"));", "qdict_put(snapshot_options, \"file.filename\",\nqstring_from_str(VAR_2));", "bs_snapshot = bdrv_new(\"\", &error_abort);", "bs_snapshot->is_temporary = 1;", "VAR_3 = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,\nVAR_0->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);", "if (VAR_3 < 0) {", "error_propagate(VAR_1, local_err);", "return;", "}", "bdrv_append(bs_snapshot, VAR_0);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 97 ], [ 99, 101 ], [ 103, 105 ], [ 109 ], [ 111 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ] ]
25,845
int nbd_client_co_flush(BlockDriverState *bs) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_FLUSH }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) { return 0; } request.from = 0; request.len = 0; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
true
qemu
6bdcc018a6ed760b9dfe43539124e420aed83092
int nbd_client_co_flush(BlockDriverState *bs) { NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_FLUSH }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) { return 0; } request.from = 0; request.len = 0; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
{ "code": [ " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);" ], "line_no": [ 29, 29, 29, 29, 29 ] }
int FUNC_0(BlockDriverState *VAR_0) { NBDClientSession *client = nbd_get_client_session(VAR_0); NBDRequest request = { .type = NBD_CMD_FLUSH }; NBDReply reply; ssize_t ret; if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) { return 0; } request.from = 0; request.len = 0; nbd_coroutine_start(client, &request); ret = nbd_co_send_request(VAR_0, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(VAR_0, &request); return -reply.error; }
[ "int FUNC_0(BlockDriverState *VAR_0)\n{", "NBDClientSession *client = nbd_get_client_session(VAR_0);", "NBDRequest request = { .type = NBD_CMD_FLUSH };", "NBDReply reply;", "ssize_t ret;", "if (!(client->nbdflags & NBD_FLAG_SEND_FLUSH)) {", "return 0;", "}", "request.from = 0;", "request.len = 0;", "nbd_coroutine_start(client, &request);", "ret = nbd_co_send_request(VAR_0, &request, NULL);", "if (ret < 0) {", "reply.error = -ret;", "} else {", "nbd_co_receive_reply(client, &request, &reply, NULL);", "}", "nbd_coroutine_end(VAR_0, &request);", "return -reply.error;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
25,846
int do_sigaction(int sig, const struct target_sigaction *act, struct target_sigaction *oact) { struct emulated_sigaction *k; if (sig < 1 || sig > TARGET_NSIG) return -EINVAL; k = &sigact_table[sig - 1]; #if defined(DEBUG_SIGNAL) && 0 fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n", sig, (int)act, (int)oact); #endif if (oact) { oact->_sa_handler = tswapl(k->sa._sa_handler); oact->sa_flags = tswapl(k->sa.sa_flags); oact->sa_restorer = tswapl(k->sa.sa_restorer); oact->sa_mask = k->sa.sa_mask; } if (act) { k->sa._sa_handler = tswapl(act->_sa_handler); k->sa.sa_flags = tswapl(act->sa_flags); k->sa.sa_restorer = tswapl(act->sa_restorer); k->sa.sa_mask = act->sa_mask; } return 0; }
true
qemu
773b93ee0684a9b9d1f0029a936a251411289027
int do_sigaction(int sig, const struct target_sigaction *act, struct target_sigaction *oact) { struct emulated_sigaction *k; if (sig < 1 || sig > TARGET_NSIG) return -EINVAL; k = &sigact_table[sig - 1]; #if defined(DEBUG_SIGNAL) && 0 fprintf(stderr, "sigaction sig=%d act=0x%08x, oact=0x%08x\n", sig, (int)act, (int)oact); #endif if (oact) { oact->_sa_handler = tswapl(k->sa._sa_handler); oact->sa_flags = tswapl(k->sa.sa_flags); oact->sa_restorer = tswapl(k->sa.sa_restorer); oact->sa_mask = k->sa.sa_mask; } if (act) { k->sa._sa_handler = tswapl(act->_sa_handler); k->sa.sa_flags = tswapl(act->sa_flags); k->sa.sa_restorer = tswapl(act->sa_restorer); k->sa.sa_mask = act->sa_mask; } return 0; }
{ "code": [ "#endif", "#endif", "#if defined(DEBUG_SIGNAL) && 0" ], "line_no": [ 23, 23, 17 ] }
int FUNC_0(int VAR_0, const struct target_sigaction *VAR_1, struct target_sigaction *VAR_2) { struct emulated_sigaction *VAR_3; if (VAR_0 < 1 || VAR_0 > TARGET_NSIG) return -EINVAL; VAR_3 = &sigact_table[VAR_0 - 1]; #if defined(DEBUG_SIGNAL) && 0 fprintf(stderr, "sigaction VAR_0=%d VAR_1=0x%08x, VAR_2=0x%08x\n", VAR_0, (int)VAR_1, (int)VAR_2); #endif if (VAR_2) { VAR_2->_sa_handler = tswapl(VAR_3->sa._sa_handler); VAR_2->sa_flags = tswapl(VAR_3->sa.sa_flags); VAR_2->sa_restorer = tswapl(VAR_3->sa.sa_restorer); VAR_2->sa_mask = VAR_3->sa.sa_mask; } if (VAR_1) { VAR_3->sa._sa_handler = tswapl(VAR_1->_sa_handler); VAR_3->sa.sa_flags = tswapl(VAR_1->sa_flags); VAR_3->sa.sa_restorer = tswapl(VAR_1->sa_restorer); VAR_3->sa.sa_mask = VAR_1->sa_mask; } return 0; }
[ "int FUNC_0(int VAR_0, const struct target_sigaction *VAR_1,\nstruct target_sigaction *VAR_2)\n{", "struct emulated_sigaction *VAR_3;", "if (VAR_0 < 1 || VAR_0 > TARGET_NSIG)\nreturn -EINVAL;", "VAR_3 = &sigact_table[VAR_0 - 1];", "#if defined(DEBUG_SIGNAL) && 0\nfprintf(stderr, \"sigaction VAR_0=%d VAR_1=0x%08x, VAR_2=0x%08x\\n\",\nVAR_0, (int)VAR_1, (int)VAR_2);", "#endif\nif (VAR_2) {", "VAR_2->_sa_handler = tswapl(VAR_3->sa._sa_handler);", "VAR_2->sa_flags = tswapl(VAR_3->sa.sa_flags);", "VAR_2->sa_restorer = tswapl(VAR_3->sa.sa_restorer);", "VAR_2->sa_mask = VAR_3->sa.sa_mask;", "}", "if (VAR_1) {", "VAR_3->sa._sa_handler = tswapl(VAR_1->_sa_handler);", "VAR_3->sa.sa_flags = tswapl(VAR_1->sa_flags);", "VAR_3->sa.sa_restorer = tswapl(VAR_1->sa_restorer);", "VAR_3->sa.sa_mask = VAR_1->sa_mask;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17, 19, 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
25,847
DeviceState *qdev_try_create(BusState *bus, const char *name) { DeviceState *dev; dev = DEVICE(object_new(name)); if (!dev) { if (!bus) { bus = sysbus_get_default(); qdev_set_parent_bus(dev, bus); qdev_prop_set_globals(dev); return dev;
true
qemu
4ed658ca925249021789d6a51fd6f99f68213f28
DeviceState *qdev_try_create(BusState *bus, const char *name) { DeviceState *dev; dev = DEVICE(object_new(name)); if (!dev) { if (!bus) { bus = sysbus_get_default(); qdev_set_parent_bus(dev, bus); qdev_prop_set_globals(dev); return dev;
{ "code": [], "line_no": [] }
DeviceState *FUNC_0(BusState *bus, const char *name) { DeviceState *dev; dev = DEVICE(object_new(name)); if (!dev) { if (!bus) { bus = sysbus_get_default(); qdev_set_parent_bus(dev, bus); qdev_prop_set_globals(dev); return dev;
[ "DeviceState *FUNC_0(BusState *bus, const char *name)\n{", "DeviceState *dev;", "dev = DEVICE(object_new(name));", "if (!dev) {", "if (!bus) {", "bus = sysbus_get_default();", "qdev_set_parent_bus(dev, bus);", "qdev_prop_set_globals(dev);", "return dev;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 12 ], [ 14 ], [ 20 ], [ 22 ], [ 27 ], [ 29 ], [ 33 ] ]
25,848
const AVOption *av_set_string(void *obj, const char *name, const char *val){ const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ return set_all_opt(obj, o->unit, o->default_val); } if(!o || !val || o->offset<=0) return NULL; if(o->type != FF_OPT_TYPE_STRING){ for(;;){ int i; char buf[256]; int cmd=0; double d; char *error = NULL; if(*val == '+' || *val == '-') cmd= *(val++); for(i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++) buf[i]= val[i]; buf[i]=0; val+= i; d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error); if(isnan(d)) { const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0); if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; else if(!strcmp(buf, "default")) d= o->default_val; else if(!strcmp(buf, "max" )) d= o->max; else if(!strcmp(buf, "min" )) d= o->min; else if(!strcmp(buf, "none" )) d= 0; else if(!strcmp(buf, "all" )) d= ~0; else { if (!error) av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error); return NULL; } } if(o->type == FF_OPT_TYPE_FLAGS){ if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; }else if(cmd=='-') d= -d; av_set_number(obj, name, d, 1, 1); if(!*val) return o; } return NULL; } memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val)); return o; }
true
FFmpeg
24cdc39e9dfd2b98e96c96387903bd41313bd0dd
const AVOption *av_set_string(void *obj, const char *name, const char *val){ const AVOption *o= av_find_opt(obj, name, NULL, 0, 0); if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){ return set_all_opt(obj, o->unit, o->default_val); } if(!o || !val || o->offset<=0) return NULL; if(o->type != FF_OPT_TYPE_STRING){ for(;;){ int i; char buf[256]; int cmd=0; double d; char *error = NULL; if(*val == '+' || *val == '-') cmd= *(val++); for(i=0; i<sizeof(buf)-1 && val[i] && val[i]!='+' && val[i]!='-'; i++) buf[i]= val[i]; buf[i]=0; val+= i; d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error); if(isnan(d)) { const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0); if(o_named && o_named->type == FF_OPT_TYPE_CONST) d= o_named->default_val; else if(!strcmp(buf, "default")) d= o->default_val; else if(!strcmp(buf, "max" )) d= o->max; else if(!strcmp(buf, "min" )) d= o->min; else if(!strcmp(buf, "none" )) d= 0; else if(!strcmp(buf, "all" )) d= ~0; else { if (!error) av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, error); return NULL; } } if(o->type == FF_OPT_TYPE_FLAGS){ if (cmd=='+') d= av_get_int(obj, name, NULL) | (int64_t)d; else if(cmd=='-') d= av_get_int(obj, name, NULL) &~(int64_t)d; }else if(cmd=='-') d= -d; av_set_number(obj, name, d, 1, 1); if(!*val) return o; } return NULL; } memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val)); return o; }
{ "code": [ " memcpy(((uint8_t*)obj) + o->offset, val, sizeof(val));" ], "line_no": [ 105 ] }
const AVOption *FUNC_0(void *obj, const char *name, const char *val){ const AVOption *VAR_0= av_find_opt(obj, name, NULL, 0, 0); if(VAR_0 && VAR_0->offset==0 && VAR_0->type == FF_OPT_TYPE_CONST && VAR_0->unit){ return set_all_opt(obj, VAR_0->unit, VAR_0->default_val); } if(!VAR_0 || !val || VAR_0->offset<=0) return NULL; if(VAR_0->type != FF_OPT_TYPE_STRING){ for(;;){ int VAR_1; char VAR_2[256]; int VAR_3=0; double VAR_4; char *VAR_5 = NULL; if(*val == '+' || *val == '-') VAR_3= *(val++); for(VAR_1=0; VAR_1<sizeof(VAR_2)-1 && val[VAR_1] && val[VAR_1]!='+' && val[VAR_1]!='-'; VAR_1++) VAR_2[VAR_1]= val[VAR_1]; VAR_2[VAR_1]=0; val+= VAR_1; VAR_4 = ff_eval2(VAR_2, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &VAR_5); if(isnan(VAR_4)) { const AVOption *VAR_6= av_find_opt(obj, VAR_2, VAR_0->unit, 0, 0); if(VAR_6 && VAR_6->type == FF_OPT_TYPE_CONST) VAR_4= VAR_6->default_val; else if(!strcmp(VAR_2, "default")) VAR_4= VAR_0->default_val; else if(!strcmp(VAR_2, "max" )) VAR_4= VAR_0->max; else if(!strcmp(VAR_2, "min" )) VAR_4= VAR_0->min; else if(!strcmp(VAR_2, "none" )) VAR_4= 0; else if(!strcmp(VAR_2, "all" )) VAR_4= ~0; else { if (!VAR_5) av_log(NULL, AV_LOG_ERROR, "Unable to parse option value \"%s\": %s\n", val, VAR_5); return NULL; } } if(VAR_0->type == FF_OPT_TYPE_FLAGS){ if (VAR_3=='+') VAR_4= av_get_int(obj, name, NULL) | (int64_t)VAR_4; else if(VAR_3=='-') VAR_4= av_get_int(obj, name, NULL) &~(int64_t)VAR_4; }else if(VAR_3=='-') VAR_4= -VAR_4; av_set_number(obj, name, VAR_4, 1, 1); if(!*val) return VAR_0; } return NULL; } memcpy(((uint8_t*)obj) + VAR_0->offset, val, sizeof(val)); return VAR_0; }
[ "const AVOption *FUNC_0(void *obj, const char *name, const char *val){", "const AVOption *VAR_0= av_find_opt(obj, name, NULL, 0, 0);", "if(VAR_0 && VAR_0->offset==0 && VAR_0->type == FF_OPT_TYPE_CONST && VAR_0->unit){", "return set_all_opt(obj, VAR_0->unit, VAR_0->default_val);", "}", "if(!VAR_0 || !val || VAR_0->offset<=0)\nreturn NULL;", "if(VAR_0->type != FF_OPT_TYPE_STRING){", "for(;;){", "int VAR_1;", "char VAR_2[256];", "int VAR_3=0;", "double VAR_4;", "char *VAR_5 = NULL;", "if(*val == '+' || *val == '-')\nVAR_3= *(val++);", "for(VAR_1=0; VAR_1<sizeof(VAR_2)-1 && val[VAR_1] && val[VAR_1]!='+' && val[VAR_1]!='-'; VAR_1++)", "VAR_2[VAR_1]= val[VAR_1];", "VAR_2[VAR_1]=0;", "val+= VAR_1;", "VAR_4 = ff_eval2(VAR_2, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &VAR_5);", "if(isnan(VAR_4)) {", "const AVOption *VAR_6= av_find_opt(obj, VAR_2, VAR_0->unit, 0, 0);", "if(VAR_6 && VAR_6->type == FF_OPT_TYPE_CONST)\nVAR_4= VAR_6->default_val;", "else if(!strcmp(VAR_2, \"default\")) VAR_4= VAR_0->default_val;", "else if(!strcmp(VAR_2, \"max\" )) VAR_4= VAR_0->max;", "else if(!strcmp(VAR_2, \"min\" )) VAR_4= VAR_0->min;", "else if(!strcmp(VAR_2, \"none\" )) VAR_4= 0;", "else if(!strcmp(VAR_2, \"all\" )) VAR_4= ~0;", "else {", "if (!VAR_5)\nav_log(NULL, AV_LOG_ERROR, \"Unable to parse option value \\\"%s\\\": %s\\n\", val, VAR_5);", "return NULL;", "}", "}", "if(VAR_0->type == FF_OPT_TYPE_FLAGS){", "if (VAR_3=='+') VAR_4= av_get_int(obj, name, NULL) | (int64_t)VAR_4;", "else if(VAR_3=='-') VAR_4= av_get_int(obj, name, NULL) &~(int64_t)VAR_4;", "}else if(VAR_3=='-')", "VAR_4= -VAR_4;", "av_set_number(obj, name, VAR_4, 1, 1);", "if(!*val)\nreturn VAR_0;", "}", "return NULL;", "}", "memcpy(((uint8_t*)obj) + VAR_0->offset, val, sizeof(val));", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ] ]
25,849
int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645NAL *nal, int small_padding) { int i, si, di; uint8_t *dst; int64_t padding = small_padding ? AV_INPUT_BUFFER_PADDING_SIZE : MAX_MBPAIR_SIZE; nal->skipped_bytes = 0; #define STARTCODE_TEST \ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ if (src[i + 2] != 3 && src[i + 2] != 0) { \ /* startcode, so we must be past the end */ \ length = i; \ } \ break; \ } #if HAVE_FAST_UNALIGNED #define FIND_FIRST_ZERO \ if (i > 0 && !src[i]) \ i--; \ while (src[i]) \ i++ #if HAVE_FAST_64BIT for (i = 0; i + 1 < length; i += 9) { if (!((~AV_RN64A(src + i) & (AV_RN64A(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 7; } #else for (i = 0; i + 1 < length; i += 5) { if (!((~AV_RN32A(src + i) & (AV_RN32A(src + i) - 0x01000101U)) & 0x80008080U)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 3; } #endif /* HAVE_FAST_64BIT */ #else for (i = 0; i + 1 < length; i += 2) { if (src[i]) continue; if (i > 0 && src[i - 1] == 0) i--; STARTCODE_TEST; } #endif /* HAVE_FAST_UNALIGNED */ if (i >= length - 1 && small_padding) { // no escaped 0 nal->data = nal->raw_data = src; nal->size = nal->raw_size = length; return length; } av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size, length + padding); if (!nal->rbsp_buffer) return AVERROR(ENOMEM); dst = nal->rbsp_buffer; memcpy(dst, src, i); si = di = i; while (si + 2 < length) { // remove escapes (very rare 1:2^22) if (src[si + 2] > 3) { dst[di++] = src[si++]; dst[di++] = src[si++]; } else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) { if (src[si + 2] == 3) { // escape dst[di++] = 0; dst[di++] = 0; si += 3; if (nal->skipped_bytes_pos) { nal->skipped_bytes++; if (nal->skipped_bytes_pos_size < nal->skipped_bytes) { nal->skipped_bytes_pos_size *= 2; av_assert0(nal->skipped_bytes_pos_size >= nal->skipped_bytes); av_reallocp_array(&nal->skipped_bytes_pos, nal->skipped_bytes_pos_size, sizeof(*nal->skipped_bytes_pos)); if (!nal->skipped_bytes_pos) { nal->skipped_bytes_pos_size = 0; return AVERROR(ENOMEM); } } if (nal->skipped_bytes_pos) nal->skipped_bytes_pos[nal->skipped_bytes-1] = di - 1; } continue; } else // next start code goto nsc; } dst[di++] = src[si++]; } while (si < length) dst[di++] = src[si++]; nsc: memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE); nal->data = dst; nal->size = di; nal->raw_data = src; nal->raw_size = si; return si; }
true
FFmpeg
382a68b0088b06b8df20d0133d767d53d8f161ef
int ff_h2645_extract_rbsp(const uint8_t *src, int length, H2645NAL *nal, int small_padding) { int i, si, di; uint8_t *dst; int64_t padding = small_padding ? AV_INPUT_BUFFER_PADDING_SIZE : MAX_MBPAIR_SIZE; nal->skipped_bytes = 0; #define STARTCODE_TEST \ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ if (src[i + 2] != 3 && src[i + 2] != 0) { \ \ length = i; \ } \ break; \ } #if HAVE_FAST_UNALIGNED #define FIND_FIRST_ZERO \ if (i > 0 && !src[i]) \ i--; \ while (src[i]) \ i++ #if HAVE_FAST_64BIT for (i = 0; i + 1 < length; i += 9) { if (!((~AV_RN64A(src + i) & (AV_RN64A(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 7; } #else for (i = 0; i + 1 < length; i += 5) { if (!((~AV_RN32A(src + i) & (AV_RN32A(src + i) - 0x01000101U)) & 0x80008080U)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 3; } #endif #else for (i = 0; i + 1 < length; i += 2) { if (src[i]) continue; if (i > 0 && src[i - 1] == 0) i--; STARTCODE_TEST; } #endif if (i >= length - 1 && small_padding) { nal->data = nal->raw_data = src; nal->size = nal->raw_size = length; return length; } av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size, length + padding); if (!nal->rbsp_buffer) return AVERROR(ENOMEM); dst = nal->rbsp_buffer; memcpy(dst, src, i); si = di = i; while (si + 2 < length) { if (src[si + 2] > 3) { dst[di++] = src[si++]; dst[di++] = src[si++]; } else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) { if (src[si + 2] == 3) { dst[di++] = 0; dst[di++] = 0; si += 3; if (nal->skipped_bytes_pos) { nal->skipped_bytes++; if (nal->skipped_bytes_pos_size < nal->skipped_bytes) { nal->skipped_bytes_pos_size *= 2; av_assert0(nal->skipped_bytes_pos_size >= nal->skipped_bytes); av_reallocp_array(&nal->skipped_bytes_pos, nal->skipped_bytes_pos_size, sizeof(*nal->skipped_bytes_pos)); if (!nal->skipped_bytes_pos) { nal->skipped_bytes_pos_size = 0; return AVERROR(ENOMEM); } } if (nal->skipped_bytes_pos) nal->skipped_bytes_pos[nal->skipped_bytes-1] = di - 1; } continue; } else goto nsc; } dst[di++] = src[si++]; } while (si < length) dst[di++] = src[si++]; nsc: memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE); nal->data = dst; nal->size = di; nal->raw_data = src; nal->raw_size = si; return si; }
{ "code": [ " int64_t padding = small_padding ? AV_INPUT_BUFFER_PADDING_SIZE : MAX_MBPAIR_SIZE;", " av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size,", " length + padding);" ], "line_no": [ 11, 123, 125 ] }
int FUNC_0(const uint8_t *VAR_0, int VAR_1, H2645NAL *VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6; uint8_t *dst; int64_t padding = VAR_3 ? AV_INPUT_BUFFER_PADDING_SIZE : MAX_MBPAIR_SIZE; VAR_2->skipped_bytes = 0; #define STARTCODE_TEST \ if (VAR_4 + 2 < VAR_1 && VAR_0[VAR_4 + 1] == 0 && VAR_0[VAR_4 + 2] <= 3) { \ if (VAR_0[VAR_4 + 2] != 3 && VAR_0[VAR_4 + 2] != 0) { \ \ VAR_1 = VAR_4; \ } \ break; \ } #if HAVE_FAST_UNALIGNED #define FIND_FIRST_ZERO \ if (VAR_4 > 0 && !VAR_0[VAR_4]) \ VAR_4--; \ while (VAR_0[VAR_4]) \ VAR_4++ #if HAVE_FAST_64BIT for (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 9) { if (!((~AV_RN64A(VAR_0 + VAR_4) & (AV_RN64A(VAR_0 + VAR_4) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; VAR_4 -= 7; } #else for (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 5) { if (!((~AV_RN32A(VAR_0 + VAR_4) & (AV_RN32A(VAR_0 + VAR_4) - 0x01000101U)) & 0x80008080U)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; VAR_4 -= 3; } #endif #else for (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 2) { if (VAR_0[VAR_4]) continue; if (VAR_4 > 0 && VAR_0[VAR_4 - 1] == 0) VAR_4--; STARTCODE_TEST; } #endif if (VAR_4 >= VAR_1 - 1 && VAR_3) { VAR_2->data = VAR_2->raw_data = VAR_0; VAR_2->size = VAR_2->raw_size = VAR_1; return VAR_1; } av_fast_malloc(&VAR_2->rbsp_buffer, &VAR_2->rbsp_buffer_size, VAR_1 + padding); if (!VAR_2->rbsp_buffer) return AVERROR(ENOMEM); dst = VAR_2->rbsp_buffer; memcpy(dst, VAR_0, VAR_4); VAR_5 = VAR_6 = VAR_4; while (VAR_5 + 2 < VAR_1) { if (VAR_0[VAR_5 + 2] > 3) { dst[VAR_6++] = VAR_0[VAR_5++]; dst[VAR_6++] = VAR_0[VAR_5++]; } else if (VAR_0[VAR_5] == 0 && VAR_0[VAR_5 + 1] == 0 && VAR_0[VAR_5 + 2] != 0) { if (VAR_0[VAR_5 + 2] == 3) { dst[VAR_6++] = 0; dst[VAR_6++] = 0; VAR_5 += 3; if (VAR_2->skipped_bytes_pos) { VAR_2->skipped_bytes++; if (VAR_2->skipped_bytes_pos_size < VAR_2->skipped_bytes) { VAR_2->skipped_bytes_pos_size *= 2; av_assert0(VAR_2->skipped_bytes_pos_size >= VAR_2->skipped_bytes); av_reallocp_array(&VAR_2->skipped_bytes_pos, VAR_2->skipped_bytes_pos_size, sizeof(*VAR_2->skipped_bytes_pos)); if (!VAR_2->skipped_bytes_pos) { VAR_2->skipped_bytes_pos_size = 0; return AVERROR(ENOMEM); } } if (VAR_2->skipped_bytes_pos) VAR_2->skipped_bytes_pos[VAR_2->skipped_bytes-1] = VAR_6 - 1; } continue; } else goto nsc; } dst[VAR_6++] = VAR_0[VAR_5++]; } while (VAR_5 < VAR_1) dst[VAR_6++] = VAR_0[VAR_5++]; nsc: memset(dst + VAR_6, 0, AV_INPUT_BUFFER_PADDING_SIZE); VAR_2->data = dst; VAR_2->size = VAR_6; VAR_2->raw_data = VAR_0; VAR_2->raw_size = VAR_5; return VAR_5; }
[ "int FUNC_0(const uint8_t *VAR_0, int VAR_1,\nH2645NAL *VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6;", "uint8_t *dst;", "int64_t padding = VAR_3 ? AV_INPUT_BUFFER_PADDING_SIZE : MAX_MBPAIR_SIZE;", "VAR_2->skipped_bytes = 0;", "#define STARTCODE_TEST \\\nif (VAR_4 + 2 < VAR_1 && VAR_0[VAR_4 + 1] == 0 && VAR_0[VAR_4 + 2] <= 3) { \\", "if (VAR_0[VAR_4 + 2] != 3 && VAR_0[VAR_4 + 2] != 0) { \\", "\\\nVAR_1 = VAR_4; \\", "} \\", "break; \\", "}", "#if HAVE_FAST_UNALIGNED\n#define FIND_FIRST_ZERO \\\nif (VAR_4 > 0 && !VAR_0[VAR_4]) \\\nVAR_4--; \\", "while (VAR_0[VAR_4]) \\\nVAR_4++\n#if HAVE_FAST_64BIT\nfor (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 9) {", "if (!((~AV_RN64A(VAR_0 + VAR_4) &\n(AV_RN64A(VAR_0 + VAR_4) - 0x0100010001000101ULL)) &\n0x8000800080008080ULL))\ncontinue;", "FIND_FIRST_ZERO;", "STARTCODE_TEST;", "VAR_4 -= 7;", "}", "#else\nfor (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 5) {", "if (!((~AV_RN32A(VAR_0 + VAR_4) &\n(AV_RN32A(VAR_0 + VAR_4) - 0x01000101U)) &\n0x80008080U))\ncontinue;", "FIND_FIRST_ZERO;", "STARTCODE_TEST;", "VAR_4 -= 3;", "}", "#endif\n#else\nfor (VAR_4 = 0; VAR_4 + 1 < VAR_1; VAR_4 += 2) {", "if (VAR_0[VAR_4])\ncontinue;", "if (VAR_4 > 0 && VAR_0[VAR_4 - 1] == 0)\nVAR_4--;", "STARTCODE_TEST;", "}", "#endif\nif (VAR_4 >= VAR_1 - 1 && VAR_3) {", "VAR_2->data =\nVAR_2->raw_data = VAR_0;", "VAR_2->size =\nVAR_2->raw_size = VAR_1;", "return VAR_1;", "}", "av_fast_malloc(&VAR_2->rbsp_buffer, &VAR_2->rbsp_buffer_size,\nVAR_1 + padding);", "if (!VAR_2->rbsp_buffer)\nreturn AVERROR(ENOMEM);", "dst = VAR_2->rbsp_buffer;", "memcpy(dst, VAR_0, VAR_4);", "VAR_5 = VAR_6 = VAR_4;", "while (VAR_5 + 2 < VAR_1) {", "if (VAR_0[VAR_5 + 2] > 3) {", "dst[VAR_6++] = VAR_0[VAR_5++];", "dst[VAR_6++] = VAR_0[VAR_5++];", "} else if (VAR_0[VAR_5] == 0 && VAR_0[VAR_5 + 1] == 0 && VAR_0[VAR_5 + 2] != 0) {", "if (VAR_0[VAR_5 + 2] == 3) {", "dst[VAR_6++] = 0;", "dst[VAR_6++] = 0;", "VAR_5 += 3;", "if (VAR_2->skipped_bytes_pos) {", "VAR_2->skipped_bytes++;", "if (VAR_2->skipped_bytes_pos_size < VAR_2->skipped_bytes) {", "VAR_2->skipped_bytes_pos_size *= 2;", "av_assert0(VAR_2->skipped_bytes_pos_size >= VAR_2->skipped_bytes);", "av_reallocp_array(&VAR_2->skipped_bytes_pos,\nVAR_2->skipped_bytes_pos_size,\nsizeof(*VAR_2->skipped_bytes_pos));", "if (!VAR_2->skipped_bytes_pos) {", "VAR_2->skipped_bytes_pos_size = 0;", "return AVERROR(ENOMEM);", "}", "}", "if (VAR_2->skipped_bytes_pos)\nVAR_2->skipped_bytes_pos[VAR_2->skipped_bytes-1] = VAR_6 - 1;", "}", "continue;", "} else", "goto nsc;", "}", "dst[VAR_6++] = VAR_0[VAR_5++];", "}", "while (VAR_5 < VAR_1)\ndst[VAR_6++] = VAR_0[VAR_5++];", "nsc:\nmemset(dst + VAR_6, 0, AV_INPUT_BUFFER_PADDING_SIZE);", "VAR_2->data = dst;", "VAR_2->size = VAR_6;", "VAR_2->raw_data = VAR_0;", "VAR_2->raw_size = VAR_5;", "return VAR_5;", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37, 39 ], [ 41, 43, 45, 47 ], [ 49, 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69, 71, 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103, 107 ], [ 109, 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 123, 125 ], [ 127, 129 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173, 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 215, 217 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ] ]
25,850
static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, uint16_t **refcount_table, int64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t i, size; int ret; for(i = 0; i < s->refcount_table_size; i++) { uint64_t offset, cluster; offset = s->refcount_table[i]; cluster = offset >> s->cluster_bits; /* Refcount blocks are cluster aligned */ if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR refcount block %" PRId64 " is not " "cluster aligned; refcount table entry corrupted\n", i); res->corruptions++; *rebuild = true; continue; } if (cluster >= *nb_clusters) { fprintf(stderr, "%s refcount block %" PRId64 " is outside image\n", fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); if (fix & BDRV_FIX_ERRORS) { int64_t new_nb_clusters; if (offset > INT64_MAX - s->cluster_size) { ret = -EINVAL; goto resize_fail; } ret = bdrv_truncate(bs->file, offset + s->cluster_size); if (ret < 0) { goto resize_fail; } size = bdrv_getlength(bs->file); if (size < 0) { ret = size; goto resize_fail; } new_nb_clusters = size_to_clusters(s, size); assert(new_nb_clusters >= *nb_clusters); ret = realloc_refcount_array(s, refcount_table, nb_clusters, new_nb_clusters); if (ret < 0) { res->check_errors++; return ret; } if (cluster >= *nb_clusters) { ret = -EINVAL; goto resize_fail; } res->corruptions_fixed++; ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } /* No need to check whether the refcount is now greater than 1: * This area was just allocated and zeroed, so it can only be * exactly 1 after inc_refcounts() */ continue; resize_fail: res->corruptions++; *rebuild = true; fprintf(stderr, "ERROR could not resize image: %s\n", strerror(-ret)); } else { res->corruptions++; } continue; } if (offset != 0) { ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } if ((*refcount_table)[cluster] != 1) { fprintf(stderr, "ERROR refcount block %" PRId64 " refcount=%d\n", i, (*refcount_table)[cluster]); res->corruptions++; *rebuild = true; } } } return 0; }
true
qemu
7453c96b78c2b09aa72924f933bb9616e5474194
static int check_refblocks(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix, bool *rebuild, uint16_t **refcount_table, int64_t *nb_clusters) { BDRVQcowState *s = bs->opaque; int64_t i, size; int ret; for(i = 0; i < s->refcount_table_size; i++) { uint64_t offset, cluster; offset = s->refcount_table[i]; cluster = offset >> s->cluster_bits; if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR refcount block %" PRId64 " is not " "cluster aligned; refcount table entry corrupted\n", i); res->corruptions++; *rebuild = true; continue; } if (cluster >= *nb_clusters) { fprintf(stderr, "%s refcount block %" PRId64 " is outside image\n", fix & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); if (fix & BDRV_FIX_ERRORS) { int64_t new_nb_clusters; if (offset > INT64_MAX - s->cluster_size) { ret = -EINVAL; goto resize_fail; } ret = bdrv_truncate(bs->file, offset + s->cluster_size); if (ret < 0) { goto resize_fail; } size = bdrv_getlength(bs->file); if (size < 0) { ret = size; goto resize_fail; } new_nb_clusters = size_to_clusters(s, size); assert(new_nb_clusters >= *nb_clusters); ret = realloc_refcount_array(s, refcount_table, nb_clusters, new_nb_clusters); if (ret < 0) { res->check_errors++; return ret; } if (cluster >= *nb_clusters) { ret = -EINVAL; goto resize_fail; } res->corruptions_fixed++; ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } continue; resize_fail: res->corruptions++; *rebuild = true; fprintf(stderr, "ERROR could not resize image: %s\n", strerror(-ret)); } else { res->corruptions++; } continue; } if (offset != 0) { ret = inc_refcounts(bs, res, refcount_table, nb_clusters, offset, s->cluster_size); if (ret < 0) { return ret; } if ((*refcount_table)[cluster] != 1) { fprintf(stderr, "ERROR refcount block %" PRId64 " refcount=%d\n", i, (*refcount_table)[cluster]); res->corruptions++; *rebuild = true; } } } return 0; }
{ "code": [ " uint16_t **refcount_table, int64_t *nb_clusters)", " if ((*refcount_table)[cluster] != 1) {", " \" refcount=%d\\n\", i, (*refcount_table)[cluster]);" ], "line_no": [ 5, 175, 179 ] }
static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1, BdrvCheckMode VAR_2, bool *VAR_3, uint16_t **VAR_4, int64_t *VAR_5) { BDRVQcowState *s = VAR_0->opaque; int64_t i, size; int VAR_6; for(i = 0; i < s->refcount_table_size; i++) { uint64_t offset, cluster; offset = s->VAR_4[i]; cluster = offset >> s->cluster_bits; if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR refcount block %" PRId64 " is not " "cluster aligned; refcount table entry corrupted\n", i); VAR_1->corruptions++; *VAR_3 = true; continue; } if (cluster >= *VAR_5) { fprintf(stderr, "%s refcount block %" PRId64 " is outside image\n", VAR_2 & BDRV_FIX_ERRORS ? "Repairing" : "ERROR", i); if (VAR_2 & BDRV_FIX_ERRORS) { int64_t new_nb_clusters; if (offset > INT64_MAX - s->cluster_size) { VAR_6 = -EINVAL; goto resize_fail; } VAR_6 = bdrv_truncate(VAR_0->file, offset + s->cluster_size); if (VAR_6 < 0) { goto resize_fail; } size = bdrv_getlength(VAR_0->file); if (size < 0) { VAR_6 = size; goto resize_fail; } new_nb_clusters = size_to_clusters(s, size); assert(new_nb_clusters >= *VAR_5); VAR_6 = realloc_refcount_array(s, VAR_4, VAR_5, new_nb_clusters); if (VAR_6 < 0) { VAR_1->check_errors++; return VAR_6; } if (cluster >= *VAR_5) { VAR_6 = -EINVAL; goto resize_fail; } VAR_1->corruptions_fixed++; VAR_6 = inc_refcounts(VAR_0, VAR_1, VAR_4, VAR_5, offset, s->cluster_size); if (VAR_6 < 0) { return VAR_6; } continue; resize_fail: VAR_1->corruptions++; *VAR_3 = true; fprintf(stderr, "ERROR could not resize image: %s\n", strerror(-VAR_6)); } else { VAR_1->corruptions++; } continue; } if (offset != 0) { VAR_6 = inc_refcounts(VAR_0, VAR_1, VAR_4, VAR_5, offset, s->cluster_size); if (VAR_6 < 0) { return VAR_6; } if ((*VAR_4)[cluster] != 1) { fprintf(stderr, "ERROR refcount block %" PRId64 " refcount=%d\n", i, (*VAR_4)[cluster]); VAR_1->corruptions++; *VAR_3 = true; } } } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1,\nBdrvCheckMode VAR_2, bool *VAR_3,\nuint16_t **VAR_4, int64_t *VAR_5)\n{", "BDRVQcowState *s = VAR_0->opaque;", "int64_t i, size;", "int VAR_6;", "for(i = 0; i < s->refcount_table_size; i++) {", "uint64_t offset, cluster;", "offset = s->VAR_4[i];", "cluster = offset >> s->cluster_bits;", "if (offset_into_cluster(s, offset)) {", "fprintf(stderr, \"ERROR refcount block %\" PRId64 \" is not \"\n\"cluster aligned; refcount table entry corrupted\\n\", i);", "VAR_1->corruptions++;", "*VAR_3 = true;", "continue;", "}", "if (cluster >= *VAR_5) {", "fprintf(stderr, \"%s refcount block %\" PRId64 \" is outside image\\n\",\nVAR_2 & BDRV_FIX_ERRORS ? \"Repairing\" : \"ERROR\", i);", "if (VAR_2 & BDRV_FIX_ERRORS) {", "int64_t new_nb_clusters;", "if (offset > INT64_MAX - s->cluster_size) {", "VAR_6 = -EINVAL;", "goto resize_fail;", "}", "VAR_6 = bdrv_truncate(VAR_0->file, offset + s->cluster_size);", "if (VAR_6 < 0) {", "goto resize_fail;", "}", "size = bdrv_getlength(VAR_0->file);", "if (size < 0) {", "VAR_6 = size;", "goto resize_fail;", "}", "new_nb_clusters = size_to_clusters(s, size);", "assert(new_nb_clusters >= *VAR_5);", "VAR_6 = realloc_refcount_array(s, VAR_4,\nVAR_5, new_nb_clusters);", "if (VAR_6 < 0) {", "VAR_1->check_errors++;", "return VAR_6;", "}", "if (cluster >= *VAR_5) {", "VAR_6 = -EINVAL;", "goto resize_fail;", "}", "VAR_1->corruptions_fixed++;", "VAR_6 = inc_refcounts(VAR_0, VAR_1, VAR_4, VAR_5,\noffset, s->cluster_size);", "if (VAR_6 < 0) {", "return VAR_6;", "}", "continue;", "resize_fail:\nVAR_1->corruptions++;", "*VAR_3 = true;", "fprintf(stderr, \"ERROR could not resize image: %s\\n\",\nstrerror(-VAR_6));", "} else {", "VAR_1->corruptions++;", "}", "continue;", "}", "if (offset != 0) {", "VAR_6 = inc_refcounts(VAR_0, VAR_1, VAR_4, VAR_5,\noffset, s->cluster_size);", "if (VAR_6 < 0) {", "return VAR_6;", "}", "if ((*VAR_4)[cluster] != 1) {", "fprintf(stderr, \"ERROR refcount block %\" PRId64\n\" refcount=%d\\n\", i, (*VAR_4)[cluster]);", "VAR_1->corruptions++;", "*VAR_3 = true;", "}", "}", "}", "return 0;", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 129 ], [ 137 ], [ 141, 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ] ]
25,851
static void choose_pixel_fmt(AVStream *st, AVCodec *codec) { if(codec && codec->pix_fmts){ const enum PixelFormat *p= codec->pix_fmts; if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){ if(st->codec->codec_id==CODEC_ID_MJPEG){ p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}; }else if(st->codec->codec_id==CODEC_ID_LJPEG){ p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE}; } } for(; *p!=-1; p++){ if(*p == st->codec->pix_fmt) break; } if (*p == -1) { av_log(NULL, AV_LOG_WARNING, "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", av_pix_fmt_descriptors[st->codec->pix_fmt].name, codec->name, av_pix_fmt_descriptors[codec->pix_fmts[0]].name); st->codec->pix_fmt = codec->pix_fmts[0]; } } }
true
FFmpeg
b5ef6f8eb452c37b19d973d61548725d7b91113e
static void choose_pixel_fmt(AVStream *st, AVCodec *codec) { if(codec && codec->pix_fmts){ const enum PixelFormat *p= codec->pix_fmts; if(st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){ if(st->codec->codec_id==CODEC_ID_MJPEG){ p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}; }else if(st->codec->codec_id==CODEC_ID_LJPEG){ p= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE}; } } for(; *p!=-1; p++){ if(*p == st->codec->pix_fmt) break; } if (*p == -1) { av_log(NULL, AV_LOG_WARNING, "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", av_pix_fmt_descriptors[st->codec->pix_fmt].name, codec->name, av_pix_fmt_descriptors[codec->pix_fmts[0]].name); st->codec->pix_fmt = codec->pix_fmts[0]; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(AVStream *VAR_0, AVCodec *VAR_1) { if(VAR_1 && VAR_1->pix_fmts){ const enum PixelFormat *VAR_2= VAR_1->pix_fmts; if(VAR_0->VAR_1->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){ if(VAR_0->VAR_1->codec_id==CODEC_ID_MJPEG){ VAR_2= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE}; }else if(VAR_0->VAR_1->codec_id==CODEC_ID_LJPEG){ VAR_2= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE}; } } for(; *VAR_2!=-1; VAR_2++){ if(*VAR_2 == VAR_0->VAR_1->pix_fmt) break; } if (*VAR_2 == -1) { av_log(NULL, AV_LOG_WARNING, "Incompatible pixel format '%s' for VAR_1 '%s', auto-selecting format '%s'\n", av_pix_fmt_descriptors[VAR_0->VAR_1->pix_fmt].name, VAR_1->name, av_pix_fmt_descriptors[VAR_1->pix_fmts[0]].name); VAR_0->VAR_1->pix_fmt = VAR_1->pix_fmts[0]; } } }
[ "static void FUNC_0(AVStream *VAR_0, AVCodec *VAR_1)\n{", "if(VAR_1 && VAR_1->pix_fmts){", "const enum PixelFormat *VAR_2= VAR_1->pix_fmts;", "if(VAR_0->VAR_1->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL){", "if(VAR_0->VAR_1->codec_id==CODEC_ID_MJPEG){", "VAR_2= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_NONE};", "}else if(VAR_0->VAR_1->codec_id==CODEC_ID_LJPEG){", "VAR_2= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_YUVJ444P, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PIX_FMT_YUV444P, PIX_FMT_BGRA, PIX_FMT_NONE};", "}", "}", "for(; *VAR_2!=-1; VAR_2++){", "if(*VAR_2 == VAR_0->VAR_1->pix_fmt)\nbreak;", "}", "if (*VAR_2 == -1) {", "av_log(NULL, AV_LOG_WARNING,\n\"Incompatible pixel format '%s' for VAR_1 '%s', auto-selecting format '%s'\\n\",\nav_pix_fmt_descriptors[VAR_0->VAR_1->pix_fmt].name,\nVAR_1->name,\nav_pix_fmt_descriptors[VAR_1->pix_fmts[0]].name);", "VAR_0->VAR_1->pix_fmt = VAR_1->pix_fmts[0];", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 34, 36, 38, 40, 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ] ]
25,852
static void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g = VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; int i; g->enable = 0; QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } for (i = 0; i < g->conf.max_outputs; i++) { #if 0 g->req_state[i].x = 0; g->req_state[i].y = 0; if (i == 0) { g->req_state[0].width = 1024; g->req_state[0].height = 768; } else { g->req_state[i].width = 0; g->req_state[i].height = 0; } #endif g->scanout[i].resource_id = 0; g->scanout[i].width = 0; g->scanout[i].height = 0; g->scanout[i].x = 0; g->scanout[i].y = 0; g->scanout[i].ds = NULL; } g->enabled_output_bitmask = 1; #ifdef CONFIG_VIRGL if (g->use_virgl_renderer) { virtio_gpu_virgl_reset(g); g->use_virgl_renderer = 0; } #endif }
true
qemu
79d16c21a565927943486b26789caa62413ff371
static void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g = VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; int i; g->enable = 0; QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } for (i = 0; i < g->conf.max_outputs; i++) { #if 0 g->req_state[i].x = 0; g->req_state[i].y = 0; if (i == 0) { g->req_state[0].width = 1024; g->req_state[0].height = 768; } else { g->req_state[i].width = 0; g->req_state[i].height = 0; } #endif g->scanout[i].resource_id = 0; g->scanout[i].width = 0; g->scanout[i].height = 0; g->scanout[i].x = 0; g->scanout[i].y = 0; g->scanout[i].ds = NULL; } g->enabled_output_bitmask = 1; #ifdef CONFIG_VIRGL if (g->use_virgl_renderer) { virtio_gpu_virgl_reset(g); g->use_virgl_renderer = 0; } #endif }
{ "code": [ "#if 0", " g->req_state[i].x = 0;", " g->req_state[i].y = 0;", " if (i == 0) {", " g->req_state[0].width = 1024;", " g->req_state[0].height = 768;", " } else {", " g->req_state[i].width = 0;", " g->req_state[i].height = 0;", "#endif", " g->enabled_output_bitmask = 1;" ], "line_no": [ 25, 27, 29, 31, 33, 35, 37, 39, 41, 45, 61 ] }
static void FUNC_0(VirtIODevice *VAR_0) { VirtIOGPU *g = VIRTIO_GPU(VAR_0); struct virtio_gpu_simple_resource *VAR_1, *VAR_2; int VAR_3; g->enable = 0; QTAILQ_FOREACH_SAFE(VAR_1, &g->reslist, next, VAR_2) { virtio_gpu_resource_destroy(g, VAR_1); } for (VAR_3 = 0; VAR_3 < g->conf.max_outputs; VAR_3++) { #if 0 g->req_state[VAR_3].x = 0; g->req_state[VAR_3].y = 0; if (VAR_3 == 0) { g->req_state[0].width = 1024; g->req_state[0].height = 768; } else { g->req_state[VAR_3].width = 0; g->req_state[VAR_3].height = 0; } #endif g->scanout[VAR_3].resource_id = 0; g->scanout[VAR_3].width = 0; g->scanout[VAR_3].height = 0; g->scanout[VAR_3].x = 0; g->scanout[VAR_3].y = 0; g->scanout[VAR_3].ds = NULL; } g->enabled_output_bitmask = 1; #ifdef CONFIG_VIRGL if (g->use_virgl_renderer) { virtio_gpu_virgl_reset(g); g->use_virgl_renderer = 0; } #endif }
[ "static void FUNC_0(VirtIODevice *VAR_0)\n{", "VirtIOGPU *g = VIRTIO_GPU(VAR_0);", "struct virtio_gpu_simple_resource *VAR_1, *VAR_2;", "int VAR_3;", "g->enable = 0;", "QTAILQ_FOREACH_SAFE(VAR_1, &g->reslist, next, VAR_2) {", "virtio_gpu_resource_destroy(g, VAR_1);", "}", "for (VAR_3 = 0; VAR_3 < g->conf.max_outputs; VAR_3++) {", "#if 0\ng->req_state[VAR_3].x = 0;", "g->req_state[VAR_3].y = 0;", "if (VAR_3 == 0) {", "g->req_state[0].width = 1024;", "g->req_state[0].height = 768;", "} else {", "g->req_state[VAR_3].width = 0;", "g->req_state[VAR_3].height = 0;", "}", "#endif\ng->scanout[VAR_3].resource_id = 0;", "g->scanout[VAR_3].width = 0;", "g->scanout[VAR_3].height = 0;", "g->scanout[VAR_3].x = 0;", "g->scanout[VAR_3].y = 0;", "g->scanout[VAR_3].ds = NULL;", "}", "g->enabled_output_bitmask = 1;", "#ifdef CONFIG_VIRGL\nif (g->use_virgl_renderer) {", "virtio_gpu_virgl_reset(g);", "g->use_virgl_renderer = 0;", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ] ]
25,853
static void gen_divu(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb) { TCGv sr_cy = tcg_temp_new(); TCGv t0 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, srcb, 0); /* The result of divide-by-zero is undefined. Supress the host-side exception by dividing by 1. */ tcg_gen_or_tl(t0, srcb, sr_cy); tcg_gen_divu_tl(dest, srca, t0); tcg_temp_free(t0); tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1); gen_ove_cy(dc, sr_cy); tcg_temp_free(sr_cy); }
true
qemu
9745807191a81c45970f780166f44a7f93b18653
static void gen_divu(DisasContext *dc, TCGv dest, TCGv srca, TCGv srcb) { TCGv sr_cy = tcg_temp_new(); TCGv t0 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, srcb, 0); tcg_gen_or_tl(t0, srcb, sr_cy); tcg_gen_divu_tl(dest, srca, t0); tcg_temp_free(t0); tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1); gen_ove_cy(dc, sr_cy); tcg_temp_free(sr_cy); }
{ "code": [ " TCGv sr_cy = tcg_temp_new();", " tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", " tcg_temp_free(sr_cy);", " TCGv sr_cy = tcg_temp_new();", " tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", " tcg_temp_free(sr_cy);", " TCGv sr_cy = tcg_temp_new();", " tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", " tcg_temp_free(sr_cy);", " TCGv sr_cy = tcg_temp_new();", " tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", " gen_ove_cy(dc, sr_cy);", " tcg_temp_free(sr_cy);", " TCGv sr_cy = tcg_temp_new();", " tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, srcb, 0);", " tcg_gen_or_tl(t0, srcb, sr_cy);", " tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", " gen_ove_cy(dc, sr_cy);", " tcg_temp_free(sr_cy);" ], "line_no": [ 5, 25, 31, 5, 25, 31, 5, 25, 31, 5, 25, 29, 31, 5, 11, 17, 25, 29, 31 ] }
static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2, TCGv VAR_3) { TCGv sr_cy = tcg_temp_new(); TCGv t0 = tcg_temp_new(); tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, VAR_3, 0); tcg_gen_or_tl(t0, VAR_3, sr_cy); tcg_gen_divu_tl(VAR_1, VAR_2, t0); tcg_temp_free(t0); tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1); gen_ove_cy(VAR_0, sr_cy); tcg_temp_free(sr_cy); }
[ "static void FUNC_0(DisasContext *VAR_0, TCGv VAR_1, TCGv VAR_2, TCGv VAR_3)\n{", "TCGv sr_cy = tcg_temp_new();", "TCGv t0 = tcg_temp_new();", "tcg_gen_setcondi_tl(TCG_COND_EQ, sr_cy, VAR_3, 0);", "tcg_gen_or_tl(t0, VAR_3, sr_cy);", "tcg_gen_divu_tl(VAR_1, VAR_2, t0);", "tcg_temp_free(t0);", "tcg_gen_deposit_tl(cpu_sr, cpu_sr, sr_cy, ctz32(SR_CY), 1);", "gen_ove_cy(VAR_0, sr_cy);", "tcg_temp_free(sr_cy);", "}" ]
[ 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ] ]
25,855
av_cold int vp56_free(AVCodecContext *avctx) { VP56Context *s = avctx->priv_data; int pt; av_freep(&s->qscale_table); av_freep(&s->above_blocks); av_freep(&s->macroblocks); av_freep(&s->edge_emu_buffer_alloc); if (s->framep[VP56_FRAME_GOLDEN]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]); if (s->framep[VP56_FRAME_GOLDEN2]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]); if (s->framep[VP56_FRAME_PREVIOUS]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]); return 0;
true
FFmpeg
0a41faa9a77dc83d8d933e99f1ba902ecd146e79
av_cold int vp56_free(AVCodecContext *avctx) { VP56Context *s = avctx->priv_data; int pt; av_freep(&s->qscale_table); av_freep(&s->above_blocks); av_freep(&s->macroblocks); av_freep(&s->edge_emu_buffer_alloc); if (s->framep[VP56_FRAME_GOLDEN]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]); if (s->framep[VP56_FRAME_GOLDEN2]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]); if (s->framep[VP56_FRAME_PREVIOUS]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]); return 0;
{ "code": [], "line_no": [] }
av_cold int FUNC_0(AVCodecContext *avctx) { VP56Context *s = avctx->priv_data; int VAR_0; av_freep(&s->qscale_table); av_freep(&s->above_blocks); av_freep(&s->macroblocks); av_freep(&s->edge_emu_buffer_alloc); if (s->framep[VP56_FRAME_GOLDEN]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]); if (s->framep[VP56_FRAME_GOLDEN2]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]); if (s->framep[VP56_FRAME_PREVIOUS]->data[0]) avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]); return 0;
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "VP56Context *s = avctx->priv_data;", "int VAR_0;", "av_freep(&s->qscale_table);", "av_freep(&s->above_blocks);", "av_freep(&s->macroblocks);", "av_freep(&s->edge_emu_buffer_alloc);", "if (s->framep[VP56_FRAME_GOLDEN]->data[0])\navctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);", "if (s->framep[VP56_FRAME_GOLDEN2]->data[0])\navctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]);", "if (s->framep[VP56_FRAME_PREVIOUS]->data[0])\navctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9, 10 ], [ 11, 12 ], [ 13, 14 ], [ 15 ] ]
25,857
static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock *block, int stride, int x, int y) { int i; block->ref = pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF1); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF1); if (s->num_refs == 2) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF2); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF2) << 1; } if (!block->ref) { pred_block_dc(block, stride, x, y); for (i = 0; i < 3; i++) block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA); return; } if (s->globalmc_flag) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_GLOBAL); block->ref ^= dirac_get_arith_bit(arith, CTX_GLOBAL_BLOCK) << 2; } for (i = 0; i < s->num_refs; i++) if (block->ref & (i+1)) { if (block->ref & DIRAC_REF_MASK_GLOBAL) { global_mv(s, block, x, y, i); } else { pred_mv(block, stride, x, y, i); block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); } } }
true
FFmpeg
b5995856a4236c27f231210bb08d70688e045192
static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock *block, int stride, int x, int y) { int i; block->ref = pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF1); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF1); if (s->num_refs == 2) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF2); block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF2) << 1; } if (!block->ref) { pred_block_dc(block, stride, x, y); for (i = 0; i < 3; i++) block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA); return; } if (s->globalmc_flag) { block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_GLOBAL); block->ref ^= dirac_get_arith_bit(arith, CTX_GLOBAL_BLOCK) << 2; } for (i = 0; i < s->num_refs; i++) if (block->ref & (i+1)) { if (block->ref & DIRAC_REF_MASK_GLOBAL) { global_mv(s, block, x, y, i); } else { pred_mv(block, stride, x, y, i); block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); } } }
{ "code": [ " block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA);" ], "line_no": [ 33 ] }
static void FUNC_0(DiracContext *VAR_0, DiracArith VAR_1[8], DiracBlock *VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; VAR_2->ref = pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_REF1); VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_PMODE_REF1); if (VAR_0->num_refs == 2) { VAR_2->ref |= pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_REF2); VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_PMODE_REF2) << 1; } if (!VAR_2->ref) { pred_block_dc(VAR_2, VAR_3, VAR_4, VAR_5); for (VAR_6 = 0; VAR_6 < 3; VAR_6++) VAR_2->u.dc[VAR_6] += dirac_get_arith_int(VAR_1+1+VAR_6, CTX_DC_F1, CTX_DC_DATA); return; } if (VAR_0->globalmc_flag) { VAR_2->ref |= pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_GLOBAL); VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_GLOBAL_BLOCK) << 2; } for (VAR_6 = 0; VAR_6 < VAR_0->num_refs; VAR_6++) if (VAR_2->ref & (VAR_6+1)) { if (VAR_2->ref & DIRAC_REF_MASK_GLOBAL) { global_mv(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6); } else { pred_mv(VAR_2, VAR_3, VAR_4, VAR_5, VAR_6); VAR_2->u.mv[VAR_6][0] += dirac_get_arith_int(VAR_1 + 4 + 2 * VAR_6, CTX_MV_F1, CTX_MV_DATA); VAR_2->u.mv[VAR_6][1] += dirac_get_arith_int(VAR_1 + 5 + 2 * VAR_6, CTX_MV_F1, CTX_MV_DATA); } } }
[ "static void FUNC_0(DiracContext *VAR_0, DiracArith VAR_1[8], DiracBlock *VAR_2,\nint VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "VAR_2->ref = pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_REF1);", "VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_PMODE_REF1);", "if (VAR_0->num_refs == 2) {", "VAR_2->ref |= pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_REF2);", "VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_PMODE_REF2) << 1;", "}", "if (!VAR_2->ref) {", "pred_block_dc(VAR_2, VAR_3, VAR_4, VAR_5);", "for (VAR_6 = 0; VAR_6 < 3; VAR_6++)", "VAR_2->u.dc[VAR_6] += dirac_get_arith_int(VAR_1+1+VAR_6, CTX_DC_F1, CTX_DC_DATA);", "return;", "}", "if (VAR_0->globalmc_flag) {", "VAR_2->ref |= pred_block_mode(VAR_2, VAR_3, VAR_4, VAR_5, DIRAC_REF_MASK_GLOBAL);", "VAR_2->ref ^= dirac_get_arith_bit(VAR_1, CTX_GLOBAL_BLOCK) << 2;", "}", "for (VAR_6 = 0; VAR_6 < VAR_0->num_refs; VAR_6++)", "if (VAR_2->ref & (VAR_6+1)) {", "if (VAR_2->ref & DIRAC_REF_MASK_GLOBAL) {", "global_mv(VAR_0, VAR_2, VAR_4, VAR_5, VAR_6);", "} else {", "pred_mv(VAR_2, VAR_3, VAR_4, VAR_5, VAR_6);", "VAR_2->u.mv[VAR_6][0] += dirac_get_arith_int(VAR_1 + 4 + 2 * VAR_6, CTX_MV_F1, CTX_MV_DATA);", "VAR_2->u.mv[VAR_6][1] += dirac_get_arith_int(VAR_1 + 5 + 2 * VAR_6, CTX_MV_F1, CTX_MV_DATA);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
25,858
static void adb_mouse_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc); ADBMouseClass *amc = ADB_MOUSE_CLASS(oc); amc->parent_realize = dc->realize; dc->realize = adb_mouse_realizefn; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); adc->devreq = adb_mouse_request; dc->reset = adb_mouse_reset; dc->vmsd = &vmstate_adb_mouse; }
true
qemu
77cb0f5aafc8e6d0c6d3c339f381c9b7921648e0
static void adb_mouse_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc); ADBMouseClass *amc = ADB_MOUSE_CLASS(oc); amc->parent_realize = dc->realize; dc->realize = adb_mouse_realizefn; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); adc->devreq = adb_mouse_request; dc->reset = adb_mouse_reset; dc->vmsd = &vmstate_adb_mouse; }
{ "code": [ " DeviceClass *dc = DEVICE_CLASS(oc);", " ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc);", " set_bit(DEVICE_CATEGORY_INPUT, dc->categories);", "static void adb_mouse_class_init(ObjectClass *oc, void *data)", " DeviceClass *dc = DEVICE_CLASS(oc);", " ADBDeviceClass *adc = ADB_DEVICE_CLASS(oc);", " ADBMouseClass *amc = ADB_MOUSE_CLASS(oc);", " amc->parent_realize = dc->realize;", " dc->realize = adb_mouse_realizefn;", " set_bit(DEVICE_CATEGORY_INPUT, dc->categories);", " adc->devreq = adb_mouse_request;", " dc->reset = adb_mouse_reset;", " dc->vmsd = &vmstate_adb_mouse;" ], "line_no": [ 5, 7, 17, 1, 5, 7, 9, 13, 15, 17, 21, 23, 25 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); ADBDeviceClass *adc = ADB_DEVICE_CLASS(VAR_0); ADBMouseClass *amc = ADB_MOUSE_CLASS(VAR_0); amc->parent_realize = dc->realize; dc->realize = adb_mouse_realizefn; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); adc->devreq = adb_mouse_request; dc->reset = adb_mouse_reset; dc->vmsd = &vmstate_adb_mouse; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "ADBDeviceClass *adc = ADB_DEVICE_CLASS(VAR_0);", "ADBMouseClass *amc = ADB_MOUSE_CLASS(VAR_0);", "amc->parent_realize = dc->realize;", "dc->realize = adb_mouse_realizefn;", "set_bit(DEVICE_CATEGORY_INPUT, dc->categories);", "adc->devreq = adb_mouse_request;", "dc->reset = adb_mouse_reset;", "dc->vmsd = &vmstate_adb_mouse;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
25,860
static int do_sd_create(char *filename, int64_t vdi_size, uint32_t base_vid, uint32_t *vdi_id, int snapshot, const char *addr, const char *port) { SheepdogVdiReq hdr; SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr; int fd, ret; unsigned int wlen, rlen = 0; char buf[SD_MAX_VDI_LEN]; fd = connect_to_sdog(addr, port); if (fd < 0) { return fd; } memset(buf, 0, sizeof(buf)); strncpy(buf, filename, SD_MAX_VDI_LEN); memset(&hdr, 0, sizeof(hdr)); hdr.opcode = SD_OP_NEW_VDI; hdr.base_vdi_id = base_vid; wlen = SD_MAX_VDI_LEN; hdr.flags = SD_FLAG_CMD_WRITE; hdr.snapid = snapshot; hdr.data_length = wlen; hdr.vdi_size = vdi_size; ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen); closesocket(fd); if (ret) { return ret; } if (rsp->result != SD_RES_SUCCESS) { error_report("%s, %s", sd_strerror(rsp->result), filename); return -EIO; } if (vdi_id) { *vdi_id = rsp->vdi_id; } return 0; }
true
qemu
3178e2755ec5a7fb1afe583fb6ac2622c2c42184
static int do_sd_create(char *filename, int64_t vdi_size, uint32_t base_vid, uint32_t *vdi_id, int snapshot, const char *addr, const char *port) { SheepdogVdiReq hdr; SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr; int fd, ret; unsigned int wlen, rlen = 0; char buf[SD_MAX_VDI_LEN]; fd = connect_to_sdog(addr, port); if (fd < 0) { return fd; } memset(buf, 0, sizeof(buf)); strncpy(buf, filename, SD_MAX_VDI_LEN); memset(&hdr, 0, sizeof(hdr)); hdr.opcode = SD_OP_NEW_VDI; hdr.base_vdi_id = base_vid; wlen = SD_MAX_VDI_LEN; hdr.flags = SD_FLAG_CMD_WRITE; hdr.snapid = snapshot; hdr.data_length = wlen; hdr.vdi_size = vdi_size; ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen); closesocket(fd); if (ret) { return ret; } if (rsp->result != SD_RES_SUCCESS) { error_report("%s, %s", sd_strerror(rsp->result), filename); return -EIO; } if (vdi_id) { *vdi_id = rsp->vdi_id; } return 0; }
{ "code": [ " memset(buf, 0, sizeof(buf));", " strncpy(buf, filename, SD_MAX_VDI_LEN);" ], "line_no": [ 31, 33 ] }
static int FUNC_0(char *VAR_0, int64_t VAR_1, uint32_t VAR_2, uint32_t *VAR_3, int VAR_4, const char *VAR_5, const char *VAR_6) { SheepdogVdiReq hdr; SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr; int VAR_7, VAR_8; unsigned int VAR_9, VAR_10 = 0; char VAR_11[SD_MAX_VDI_LEN]; VAR_7 = connect_to_sdog(VAR_5, VAR_6); if (VAR_7 < 0) { return VAR_7; } memset(VAR_11, 0, sizeof(VAR_11)); strncpy(VAR_11, VAR_0, SD_MAX_VDI_LEN); memset(&hdr, 0, sizeof(hdr)); hdr.opcode = SD_OP_NEW_VDI; hdr.base_vdi_id = VAR_2; VAR_9 = SD_MAX_VDI_LEN; hdr.flags = SD_FLAG_CMD_WRITE; hdr.snapid = VAR_4; hdr.data_length = VAR_9; hdr.VAR_1 = VAR_1; VAR_8 = do_req(VAR_7, (SheepdogReq *)&hdr, VAR_11, &VAR_9, &VAR_10); closesocket(VAR_7); if (VAR_8) { return VAR_8; } if (rsp->result != SD_RES_SUCCESS) { error_report("%s, %s", sd_strerror(rsp->result), VAR_0); return -EIO; } if (VAR_3) { *VAR_3 = rsp->VAR_3; } return 0; }
[ "static int FUNC_0(char *VAR_0, int64_t VAR_1,\nuint32_t VAR_2, uint32_t *VAR_3, int VAR_4,\nconst char *VAR_5, const char *VAR_6)\n{", "SheepdogVdiReq hdr;", "SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;", "int VAR_7, VAR_8;", "unsigned int VAR_9, VAR_10 = 0;", "char VAR_11[SD_MAX_VDI_LEN];", "VAR_7 = connect_to_sdog(VAR_5, VAR_6);", "if (VAR_7 < 0) {", "return VAR_7;", "}", "memset(VAR_11, 0, sizeof(VAR_11));", "strncpy(VAR_11, VAR_0, SD_MAX_VDI_LEN);", "memset(&hdr, 0, sizeof(hdr));", "hdr.opcode = SD_OP_NEW_VDI;", "hdr.base_vdi_id = VAR_2;", "VAR_9 = SD_MAX_VDI_LEN;", "hdr.flags = SD_FLAG_CMD_WRITE;", "hdr.snapid = VAR_4;", "hdr.data_length = VAR_9;", "hdr.VAR_1 = VAR_1;", "VAR_8 = do_req(VAR_7, (SheepdogReq *)&hdr, VAR_11, &VAR_9, &VAR_10);", "closesocket(VAR_7);", "if (VAR_8) {", "return VAR_8;", "}", "if (rsp->result != SD_RES_SUCCESS) {", "error_report(\"%s, %s\", sd_strerror(rsp->result), VAR_0);", "return -EIO;", "}", "if (VAR_3) {", "*VAR_3 = rsp->VAR_3;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ] ]
25,861
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = data; SliceInfo si; int i; int slice_count; const uint8_t *slices_hdr = NULL; int last = 0; /* no supplementary picture */ if (buf_size == 0) { /* special case for last picture */ if (s->low_delay==0 && s->next_picture_ptr) { *pict = s->next_picture_ptr->f; s->next_picture_ptr = NULL; *got_picture_ptr = 1; } return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; buf_size -= 1 + 8 * slice_count; }else slice_count = avctx->slice_count; //parse first slice header to check whether this frame can be decoded if(get_slice_offset(avctx, slices_hdr, 0) < 0 || get_slice_offset(avctx, slices_hdr, 0) > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){ av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); } if ((!s->last_picture_ptr || !s->last_picture_ptr->f.data[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); } if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; /* first slice */ if (si.start == 0) { if (s->mb_num_left > 0) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); ff_er_frame_end(s); ff_MPV_frame_end(s); } if (s->width != si.width || s->height != si.height) { int err; av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n", si.width, si.height); s->width = si.width; s->height = si.height; avcodec_set_dimensions(s->avctx, s->width, s->height); if ((err = ff_MPV_common_frame_size_change(s)) < 0) return err; if ((err = rv34_decoder_realloc(r)) < 0) return err; } s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I; if (ff_MPV_frame_start(s, s->avctx) < 0) return -1; ff_er_frame_start(s); if (!r->tmp_b_block_base) { int i; r->tmp_b_block_base = av_malloc(s->linesize * 48); for (i = 0; i < 2; i++) r->tmp_b_block_y[i] = r->tmp_b_block_base + i * 16 * s->linesize; for (i = 0; i < 4; i++) r->tmp_b_block_uv[i] = r->tmp_b_block_base + 32 * s->linesize + (i >> 1) * 8 * s->uvlinesize + (i & 1) * 16; } r->cur_pts = si.pts; if (s->pict_type != AV_PICTURE_TYPE_B) { r->last_pts = r->next_pts; r->next_pts = r->cur_pts; } else { int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts); int dist0 = GET_PTS_DIFF(r->cur_pts, r->last_pts); int dist1 = GET_PTS_DIFF(r->next_pts, r->cur_pts); if(!refdist){ r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192; r->scaled_weight = 0; }else{ r->mv_weight1 = (dist0 << 14) / refdist; r->mv_weight2 = (dist1 << 14) / refdist; if((r->mv_weight1|r->mv_weight2) & 511){ r->weight1 = r->mv_weight1; r->weight2 = r->mv_weight2; r->scaled_weight = 0; }else{ r->weight1 = r->mv_weight1 >> 9; r->weight2 = r->mv_weight2 >> 9; r->scaled_weight = 1; } } } s->mb_x = s->mb_y = 0; ff_thread_finish_setup(s->avctx); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(s->avctx, AV_LOG_ERROR, "Decoder needs full frames in frame " "multithreading mode (start MB is %d).\n", si.start); } for(i = 0; i < slice_count; i++){ int offset = get_slice_offset(avctx, slices_hdr, i); int size; if(i+1 == slice_count) size = buf_size - offset; else size = get_slice_offset(avctx, slices_hdr, i+1) - offset; if(offset < 0 || offset > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } r->si.end = s->mb_width * s->mb_height; s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(i+1 < slice_count){ if (get_slice_offset(avctx, slices_hdr, i+1) < 0 || get_slice_offset(avctx, slices_hdr, i+1) > buf_size) { av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(i+2 < slice_count) size = get_slice_offset(avctx, slices_hdr, i+2) - offset; else size = buf_size - offset; }else r->si.end = si.start; } if (size < 0 || size > buf_size - offset) { av_log(avctx, AV_LOG_ERROR, "Slice size is invalid\n"); break; } last = rv34_decode_slice(r, r->si.end, buf + offset, size); if(last) break; } if (s->current_picture_ptr) { if (last) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); *got_picture_ptr = finish_frame(avctx, pict); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(avctx, AV_LOG_INFO, "marking unfished frame as finished\n"); /* always mark the current frame as finished, frame-mt supports * only complete frames */ ff_er_frame_end(s); ff_MPV_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); } } return avpkt->size; }
true
FFmpeg
68def00a6330e46eea2ee6735fa4ae91317e8f5c
int ff_rv34_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; RV34DecContext *r = avctx->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = data; SliceInfo si; int i; int slice_count; const uint8_t *slices_hdr = NULL; int last = 0; if (buf_size == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict = s->next_picture_ptr->f; s->next_picture_ptr = NULL; *got_picture_ptr = 1; } return 0; } if(!avctx->slice_count){ slice_count = (*buf++) + 1; slices_hdr = buf + 4; buf += 8 * slice_count; buf_size -= 1 + 8 * slice_count; }else slice_count = avctx->slice_count; if(get_slice_offset(avctx, slices_hdr, 0) < 0 || get_slice_offset(avctx, slices_hdr, 0) > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, 0), (buf_size-get_slice_offset(avctx, slices_hdr, 0))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){ av_log(avctx, AV_LOG_ERROR, "First slice header is incorrect\n"); } if ((!s->last_picture_ptr || !s->last_picture_ptr->f.data[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(avctx, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference data.\n"); } if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return avpkt->size; if (si.start == 0) { if (s->mb_num_left > 0) { av_log(avctx, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); ff_er_frame_end(s); ff_MPV_frame_end(s); } if (s->width != si.width || s->height != si.height) { int err; av_log(s->avctx, AV_LOG_WARNING, "Changing dimensions to %dx%d\n", si.width, si.height); s->width = si.width; s->height = si.height; avcodec_set_dimensions(s->avctx, s->width, s->height); if ((err = ff_MPV_common_frame_size_change(s)) < 0) return err; if ((err = rv34_decoder_realloc(r)) < 0) return err; } s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I; if (ff_MPV_frame_start(s, s->avctx) < 0) return -1; ff_er_frame_start(s); if (!r->tmp_b_block_base) { int i; r->tmp_b_block_base = av_malloc(s->linesize * 48); for (i = 0; i < 2; i++) r->tmp_b_block_y[i] = r->tmp_b_block_base + i * 16 * s->linesize; for (i = 0; i < 4; i++) r->tmp_b_block_uv[i] = r->tmp_b_block_base + 32 * s->linesize + (i >> 1) * 8 * s->uvlinesize + (i & 1) * 16; } r->cur_pts = si.pts; if (s->pict_type != AV_PICTURE_TYPE_B) { r->last_pts = r->next_pts; r->next_pts = r->cur_pts; } else { int refdist = GET_PTS_DIFF(r->next_pts, r->last_pts); int dist0 = GET_PTS_DIFF(r->cur_pts, r->last_pts); int dist1 = GET_PTS_DIFF(r->next_pts, r->cur_pts); if(!refdist){ r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192; r->scaled_weight = 0; }else{ r->mv_weight1 = (dist0 << 14) / refdist; r->mv_weight2 = (dist1 << 14) / refdist; if((r->mv_weight1|r->mv_weight2) & 511){ r->weight1 = r->mv_weight1; r->weight2 = r->mv_weight2; r->scaled_weight = 0; }else{ r->weight1 = r->mv_weight1 >> 9; r->weight2 = r->mv_weight2 >> 9; r->scaled_weight = 1; } } } s->mb_x = s->mb_y = 0; ff_thread_finish_setup(s->avctx); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(s->avctx, AV_LOG_ERROR, "Decoder needs full frames in frame " "multithreading mode (start MB is %d).\n", si.start); } for(i = 0; i < slice_count; i++){ int offset = get_slice_offset(avctx, slices_hdr, i); int size; if(i+1 == slice_count) size = buf_size - offset; else size = get_slice_offset(avctx, slices_hdr, i+1) - offset; if(offset < 0 || offset > buf_size){ av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } r->si.end = s->mb_width * s->mb_height; s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(i+1 < slice_count){ if (get_slice_offset(avctx, slices_hdr, i+1) < 0 || get_slice_offset(avctx, slices_hdr, i+1) > buf_size) { av_log(avctx, AV_LOG_ERROR, "Slice offset is invalid\n"); break; } init_get_bits(&s->gb, buf+get_slice_offset(avctx, slices_hdr, i+1), (buf_size-get_slice_offset(avctx, slices_hdr, i+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(i+2 < slice_count) size = get_slice_offset(avctx, slices_hdr, i+2) - offset; else size = buf_size - offset; }else r->si.end = si.start; } if (size < 0 || size > buf_size - offset) { av_log(avctx, AV_LOG_ERROR, "Slice size is invalid\n"); break; } last = rv34_decode_slice(r, r->si.end, buf + offset, size); if(last) break; } if (s->current_picture_ptr) { if (last) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); *got_picture_ptr = finish_frame(avctx, pict); } else if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) { av_log(avctx, AV_LOG_INFO, "marking unfished frame as finished\n"); ff_er_frame_end(s); ff_MPV_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); } } return avpkt->size; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->VAR_15; RV34DecContext *r = VAR_0->priv_data; MpegEncContext *s = &r->s; AVFrame *pict = VAR_1; SliceInfo si; int VAR_11; int VAR_7; const uint8_t *VAR_8 = NULL; int VAR_9 = 0; if (VAR_5 == 0) { if (s->low_delay==0 && s->next_picture_ptr) { *pict = s->next_picture_ptr->f; s->next_picture_ptr = NULL; *VAR_2 = 1; } return 0; } if(!VAR_0->VAR_7){ VAR_7 = (*VAR_4++) + 1; VAR_8 = VAR_4 + 4; VAR_4 += 8 * VAR_7; VAR_5 -= 1 + 8 * VAR_7; }else VAR_7 = VAR_0->VAR_7; if(get_slice_offset(VAR_0, VAR_8, 0) < 0 || get_slice_offset(VAR_0, VAR_8, 0) > VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "Slice VAR_14 is invalid\n"); } init_get_bits(&s->gb, VAR_4+get_slice_offset(VAR_0, VAR_8, 0), (VAR_5-get_slice_offset(VAR_0, VAR_8, 0))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){ av_log(VAR_0, AV_LOG_ERROR, "First slice header is incorrect\n"); } if ((!s->last_picture_ptr || !s->last_picture_ptr->f.VAR_1[0]) && si.type == AV_PICTURE_TYPE_B) { av_log(VAR_0, AV_LOG_ERROR, "Invalid decoder state: B-frame without " "reference VAR_1.\n"); } if( (VAR_0->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B) || (VAR_0->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I) || VAR_0->skip_frame >= AVDISCARD_ALL) return VAR_3->VAR_15; if (si.start == 0) { if (s->mb_num_left > 0) { av_log(VAR_0, AV_LOG_ERROR, "New frame but still %d MB left.\n", s->mb_num_left); ff_er_frame_end(s); ff_MPV_frame_end(s); } if (s->width != si.width || s->height != si.height) { int VAR_10; av_log(s->VAR_0, AV_LOG_WARNING, "Changing dimensions to %dx%d\n", si.width, si.height); s->width = si.width; s->height = si.height; avcodec_set_dimensions(s->VAR_0, s->width, s->height); if ((VAR_10 = ff_MPV_common_frame_size_change(s)) < 0) return VAR_10; if ((VAR_10 = rv34_decoder_realloc(r)) < 0) return VAR_10; } s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I; if (ff_MPV_frame_start(s, s->VAR_0) < 0) return -1; ff_er_frame_start(s); if (!r->tmp_b_block_base) { int VAR_11; r->tmp_b_block_base = av_malloc(s->linesize * 48); for (VAR_11 = 0; VAR_11 < 2; VAR_11++) r->tmp_b_block_y[VAR_11] = r->tmp_b_block_base + VAR_11 * 16 * s->linesize; for (VAR_11 = 0; VAR_11 < 4; VAR_11++) r->tmp_b_block_uv[VAR_11] = r->tmp_b_block_base + 32 * s->linesize + (VAR_11 >> 1) * 8 * s->uvlinesize + (VAR_11 & 1) * 16; } r->cur_pts = si.pts; if (s->pict_type != AV_PICTURE_TYPE_B) { r->last_pts = r->next_pts; r->next_pts = r->cur_pts; } else { int VAR_11 = GET_PTS_DIFF(r->next_pts, r->last_pts); int VAR_12 = GET_PTS_DIFF(r->cur_pts, r->last_pts); int VAR_13 = GET_PTS_DIFF(r->next_pts, r->cur_pts); if(!VAR_11){ r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192; r->scaled_weight = 0; }else{ r->mv_weight1 = (VAR_12 << 14) / VAR_11; r->mv_weight2 = (VAR_13 << 14) / VAR_11; if((r->mv_weight1|r->mv_weight2) & 511){ r->weight1 = r->mv_weight1; r->weight2 = r->mv_weight2; r->scaled_weight = 0; }else{ r->weight1 = r->mv_weight1 >> 9; r->weight2 = r->mv_weight2 >> 9; r->scaled_weight = 1; } } } s->mb_x = s->mb_y = 0; ff_thread_finish_setup(s->VAR_0); } else if (HAVE_THREADS && (s->VAR_0->active_thread_type & FF_THREAD_FRAME)) { av_log(s->VAR_0, AV_LOG_ERROR, "Decoder needs full frames in frame " "multithreading mode (start MB is %d).\n", si.start); } for(VAR_11 = 0; VAR_11 < VAR_7; VAR_11++){ int VAR_14 = get_slice_offset(VAR_0, VAR_8, VAR_11); int VAR_15; if(VAR_11+1 == VAR_7) VAR_15 = VAR_5 - VAR_14; else VAR_15 = get_slice_offset(VAR_0, VAR_8, VAR_11+1) - VAR_14; if(VAR_14 < 0 || VAR_14 > VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "Slice VAR_14 is invalid\n"); break; } r->si.end = s->mb_width * s->mb_height; s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start; if(VAR_11+1 < VAR_7){ if (get_slice_offset(VAR_0, VAR_8, VAR_11+1) < 0 || get_slice_offset(VAR_0, VAR_8, VAR_11+1) > VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "Slice VAR_14 is invalid\n"); break; } init_get_bits(&s->gb, VAR_4+get_slice_offset(VAR_0, VAR_8, VAR_11+1), (VAR_5-get_slice_offset(VAR_0, VAR_8, VAR_11+1))*8); if(r->parse_slice_header(r, &r->s.gb, &si) < 0){ if(VAR_11+2 < VAR_7) VAR_15 = get_slice_offset(VAR_0, VAR_8, VAR_11+2) - VAR_14; else VAR_15 = VAR_5 - VAR_14; }else r->si.end = si.start; } if (VAR_15 < 0 || VAR_15 > VAR_5 - VAR_14) { av_log(VAR_0, AV_LOG_ERROR, "Slice VAR_15 is invalid\n"); break; } VAR_9 = rv34_decode_slice(r, r->si.end, VAR_4 + VAR_14, VAR_15); if(VAR_9) break; } if (s->current_picture_ptr) { if (VAR_9) { if(r->loop_filter) r->loop_filter(r, s->mb_height - 1); *VAR_2 = finish_frame(VAR_0, pict); } else if (HAVE_THREADS && (s->VAR_0->active_thread_type & FF_THREAD_FRAME)) { av_log(VAR_0, AV_LOG_INFO, "marking unfished frame as finished\n"); ff_er_frame_end(s); ff_MPV_frame_end(s); s->mb_num_left = 0; ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); } } return VAR_3->VAR_15; }
[ "int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->VAR_15;", "RV34DecContext *r = VAR_0->priv_data;", "MpegEncContext *s = &r->s;", "AVFrame *pict = VAR_1;", "SliceInfo si;", "int VAR_11;", "int VAR_7;", "const uint8_t *VAR_8 = NULL;", "int VAR_9 = 0;", "if (VAR_5 == 0) {", "if (s->low_delay==0 && s->next_picture_ptr) {", "*pict = s->next_picture_ptr->f;", "s->next_picture_ptr = NULL;", "*VAR_2 = 1;", "}", "return 0;", "}", "if(!VAR_0->VAR_7){", "VAR_7 = (*VAR_4++) + 1;", "VAR_8 = VAR_4 + 4;", "VAR_4 += 8 * VAR_7;", "VAR_5 -= 1 + 8 * VAR_7;", "}else", "VAR_7 = VAR_0->VAR_7;", "if(get_slice_offset(VAR_0, VAR_8, 0) < 0 ||\nget_slice_offset(VAR_0, VAR_8, 0) > VAR_5){", "av_log(VAR_0, AV_LOG_ERROR, \"Slice VAR_14 is invalid\\n\");", "}", "init_get_bits(&s->gb, VAR_4+get_slice_offset(VAR_0, VAR_8, 0), (VAR_5-get_slice_offset(VAR_0, VAR_8, 0))*8);", "if(r->parse_slice_header(r, &r->s.gb, &si) < 0 || si.start){", "av_log(VAR_0, AV_LOG_ERROR, \"First slice header is incorrect\\n\");", "}", "if ((!s->last_picture_ptr || !s->last_picture_ptr->f.VAR_1[0]) &&\nsi.type == AV_PICTURE_TYPE_B) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid decoder state: B-frame without \"\n\"reference VAR_1.\\n\");", "}", "if( (VAR_0->skip_frame >= AVDISCARD_NONREF && si.type==AV_PICTURE_TYPE_B)\n|| (VAR_0->skip_frame >= AVDISCARD_NONKEY && si.type!=AV_PICTURE_TYPE_I)\n|| VAR_0->skip_frame >= AVDISCARD_ALL)\nreturn VAR_3->VAR_15;", "if (si.start == 0) {", "if (s->mb_num_left > 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"New frame but still %d MB left.\\n\",\ns->mb_num_left);", "ff_er_frame_end(s);", "ff_MPV_frame_end(s);", "}", "if (s->width != si.width || s->height != si.height) {", "int VAR_10;", "av_log(s->VAR_0, AV_LOG_WARNING, \"Changing dimensions to %dx%d\\n\",\nsi.width, si.height);", "s->width = si.width;", "s->height = si.height;", "avcodec_set_dimensions(s->VAR_0, s->width, s->height);", "if ((VAR_10 = ff_MPV_common_frame_size_change(s)) < 0)\nreturn VAR_10;", "if ((VAR_10 = rv34_decoder_realloc(r)) < 0)\nreturn VAR_10;", "}", "s->pict_type = si.type ? si.type : AV_PICTURE_TYPE_I;", "if (ff_MPV_frame_start(s, s->VAR_0) < 0)\nreturn -1;", "ff_er_frame_start(s);", "if (!r->tmp_b_block_base) {", "int VAR_11;", "r->tmp_b_block_base = av_malloc(s->linesize * 48);", "for (VAR_11 = 0; VAR_11 < 2; VAR_11++)", "r->tmp_b_block_y[VAR_11] = r->tmp_b_block_base\n+ VAR_11 * 16 * s->linesize;", "for (VAR_11 = 0; VAR_11 < 4; VAR_11++)", "r->tmp_b_block_uv[VAR_11] = r->tmp_b_block_base + 32 * s->linesize\n+ (VAR_11 >> 1) * 8 * s->uvlinesize\n+ (VAR_11 & 1) * 16;", "}", "r->cur_pts = si.pts;", "if (s->pict_type != AV_PICTURE_TYPE_B) {", "r->last_pts = r->next_pts;", "r->next_pts = r->cur_pts;", "} else {", "int VAR_11 = GET_PTS_DIFF(r->next_pts, r->last_pts);", "int VAR_12 = GET_PTS_DIFF(r->cur_pts, r->last_pts);", "int VAR_13 = GET_PTS_DIFF(r->next_pts, r->cur_pts);", "if(!VAR_11){", "r->mv_weight1 = r->mv_weight2 = r->weight1 = r->weight2 = 8192;", "r->scaled_weight = 0;", "}else{", "r->mv_weight1 = (VAR_12 << 14) / VAR_11;", "r->mv_weight2 = (VAR_13 << 14) / VAR_11;", "if((r->mv_weight1|r->mv_weight2) & 511){", "r->weight1 = r->mv_weight1;", "r->weight2 = r->mv_weight2;", "r->scaled_weight = 0;", "}else{", "r->weight1 = r->mv_weight1 >> 9;", "r->weight2 = r->mv_weight2 >> 9;", "r->scaled_weight = 1;", "}", "}", "}", "s->mb_x = s->mb_y = 0;", "ff_thread_finish_setup(s->VAR_0);", "} else if (HAVE_THREADS &&", "(s->VAR_0->active_thread_type & FF_THREAD_FRAME)) {", "av_log(s->VAR_0, AV_LOG_ERROR, \"Decoder needs full frames in frame \"\n\"multithreading mode (start MB is %d).\\n\", si.start);", "}", "for(VAR_11 = 0; VAR_11 < VAR_7; VAR_11++){", "int VAR_14 = get_slice_offset(VAR_0, VAR_8, VAR_11);", "int VAR_15;", "if(VAR_11+1 == VAR_7)\nVAR_15 = VAR_5 - VAR_14;", "else\nVAR_15 = get_slice_offset(VAR_0, VAR_8, VAR_11+1) - VAR_14;", "if(VAR_14 < 0 || VAR_14 > VAR_5){", "av_log(VAR_0, AV_LOG_ERROR, \"Slice VAR_14 is invalid\\n\");", "break;", "}", "r->si.end = s->mb_width * s->mb_height;", "s->mb_num_left = r->s.mb_x + r->s.mb_y*r->s.mb_width - r->si.start;", "if(VAR_11+1 < VAR_7){", "if (get_slice_offset(VAR_0, VAR_8, VAR_11+1) < 0 ||\nget_slice_offset(VAR_0, VAR_8, VAR_11+1) > VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"Slice VAR_14 is invalid\\n\");", "break;", "}", "init_get_bits(&s->gb, VAR_4+get_slice_offset(VAR_0, VAR_8, VAR_11+1), (VAR_5-get_slice_offset(VAR_0, VAR_8, VAR_11+1))*8);", "if(r->parse_slice_header(r, &r->s.gb, &si) < 0){", "if(VAR_11+2 < VAR_7)\nVAR_15 = get_slice_offset(VAR_0, VAR_8, VAR_11+2) - VAR_14;", "else\nVAR_15 = VAR_5 - VAR_14;", "}else", "r->si.end = si.start;", "}", "if (VAR_15 < 0 || VAR_15 > VAR_5 - VAR_14) {", "av_log(VAR_0, AV_LOG_ERROR, \"Slice VAR_15 is invalid\\n\");", "break;", "}", "VAR_9 = rv34_decode_slice(r, r->si.end, VAR_4 + VAR_14, VAR_15);", "if(VAR_9)\nbreak;", "}", "if (s->current_picture_ptr) {", "if (VAR_9) {", "if(r->loop_filter)\nr->loop_filter(r, s->mb_height - 1);", "*VAR_2 = finish_frame(VAR_0, pict);", "} else if (HAVE_THREADS &&", "(s->VAR_0->active_thread_type & FF_THREAD_FRAME)) {", "av_log(VAR_0, AV_LOG_INFO, \"marking unfished frame as finished\\n\");", "ff_er_frame_end(s);", "ff_MPV_frame_end(s);", "s->mb_num_left = 0;", "ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0);", "}", "}", "return VAR_3->VAR_15;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 16 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 33, 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41, 42 ], [ 43, 44 ], [ 45 ], [ 46, 47, 48, 49 ], [ 51 ], [ 52 ], [ 53, 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65, 66 ], [ 67, 68 ], [ 69 ], [ 70 ], [ 71, 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78, 79 ], [ 80 ], [ 81, 82, 83 ], [ 84 ], [ 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110 ], [ 111 ], [ 112 ], [ 113 ], [ 114, 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120, 121 ], [ 122, 123 ], [ 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128 ], [ 129 ], [ 130 ], [ 131, 132 ], [ 133 ], [ 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138, 139 ], [ 140, 141 ], [ 142 ], [ 143 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 149 ], [ 150, 151 ], [ 152 ], [ 153 ], [ 154 ], [ 155, 156 ], [ 157 ], [ 158 ], [ 159 ], [ 160 ], [ 163 ], [ 164 ], [ 165 ], [ 166 ], [ 167 ], [ 168 ], [ 169 ], [ 170 ] ]
25,863
static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { /* Note, the only difference between the 15Bpp and 16Bpp */ /* Format is the pixel format, the packets are processed the same. */ FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; unsigned char palette_idx1; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int lines; int compressed_lines; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; int pixel; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; frame_size = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); /* skip the magic number */ num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); /* skip padding */ if (frame_size > buf_size) frame_size = buf_size; frame_size -= 16; /* iterate through the chunks */ while ((frame_size > 0) && (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: /* For some reason, it seems that non-palettized flics do * include one of these chunks in their first frame. * Why I do not know, it seems rather extraneous. */ ff_dlog(avctx, "Unexpected Palette chunk %d in non-palettized FLC\n", chunk_type); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_DELTA: case FLI_DTA_LC: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_le16(&g2); if (line_packets < 0) { line_packets = -line_packets; y_ptr += line_packets * s->frame->linesize[0]; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { /* account for the skip bytes */ if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += (pixel_skip*2); /* Pixel is 2 bytes wide */ pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; pixel = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; } } else { if (bytestream2_tell(&g2) + 2*byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { *((signed short*)(&pixels[pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n"); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_BLACK: /* set the whole frame to 0x0000 which is black in both 15Bpp and 16Bpp modes. */ memset(pixels, 0x0000, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = (s->avctx->width * 2); while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n", pixel_countdown, lines); } } else { /* copy bytes if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { palette_idx1 = bytestream2_get_byte(&g2); pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } /* Now FLX is strange, in that it is "byte" as opposed to "pixel" run length compressed. * This does not give us any good opportunity to perform word endian conversion * during decompression. So if it is required (i.e., this is not a LE target, we do * a second pass over the line here, swapping the bytes. */ #if HAVE_BIGENDIAN pixel_ptr = y_ptr; pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]); pixel_ptr += 2; } #endif y_ptr += s->frame->linesize[0]; } break; case FLI_DTA_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; /* disregard the line packets; instead, iterate through all * pixels on a row */ bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; /* Width is in pixels, not bytes */ while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { pixel = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } else { /* copy pixels if byte_run < 0 */ byte_run = -byte_run; if (bytestream2_tell(&g2) + 2 * byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: case FLI_DTA_COPY: /* copy the chunk (uncompressed frame) */ if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*2) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { pixel_countdown = s->avctx->width; pixel_ptr = 0; while (pixel_countdown > 0) { *((signed short*)(&pixels[y_ptr + pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; pixel_countdown--; } if (s->avctx->width & 1) bytestream2_skip(&g2, 2); } } break; case FLI_MINI: /* some sort of a thumbnail? disregard this chunk... */ bytestream2_skip(&g2, chunk_size - 6); break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } /* by the end of the chunk, the stream ptr should equal the frame * size (minus 1, possibly); if it doesn't, issue a warning */ if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2)); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
true
FFmpeg
355e27e24dc88d6ba8f27501a34925d9d937a399
static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; unsigned char palette_idx1; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int lines; int compressed_lines; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; int pixel; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; pixels = s->frame->data[0]; pixel_limit = s->avctx->height * s->frame->linesize[0]; frame_size = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); if (frame_size > buf_size) frame_size = buf_size; frame_size -= 16; while ((frame_size > 0) && (num_chunks > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: ff_dlog(avctx, "Unexpected Palette chunk %d in non-palettized FLC\n", chunk_type); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_DELTA: case FLI_DTA_LC: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_le16(&g2); if (line_packets < 0) { line_packets = -line_packets; y_ptr += line_packets * s->frame->linesize[0]; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += (pixel_skip*2); pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; pixel = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; } } else { if (bytestream2_tell(&g2) + 2*byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { *((signed short*)(&pixels[pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; } } } y_ptr += s->frame->linesize[0]; } } break; case FLI_LC: av_log(avctx, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n"); bytestream2_skip(&g2, chunk_size - 6); break; case FLI_BLACK: memset(pixels, 0x0000, s->frame->linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; bytestream2_skip(&g2, 1); pixel_countdown = (s->avctx->width * 2); while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) (linea%d)\n", pixel_countdown, lines); } } else { byte_run = -byte_run; if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { palette_idx1 = bytestream2_get_byte(&g2); pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } #if HAVE_BIGENDIAN pixel_ptr = y_ptr; pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { *((signed short*)(&pixels[pixel_ptr])) = AV_RL16(&buf[pixel_ptr]); pixel_ptr += 2; } #endif y_ptr += s->frame->linesize[0]; } break; case FLI_DTA_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run > 0) { pixel = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = pixel; pixel_ptr += 2; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } else { byte_run = -byte_run; if (bytestream2_tell(&g2) + 2 * byte_run > stream_ptr_after_chunk) break; CHECK_PIXEL_PTR(2 * byte_run); for (j = 0; j < byte_run; j++) { *((signed short*)(&pixels[pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d)\n", pixel_countdown); } } } y_ptr += s->frame->linesize[0]; } break; case FLI_COPY: case FLI_DTA_COPY: if (chunk_size - 6 > (unsigned int)(FFALIGN(s->avctx->width, 2) * s->avctx->height)*2) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame->linesize[0] * s->avctx->height; y_ptr += s->frame->linesize[0]) { pixel_countdown = s->avctx->width; pixel_ptr = 0; while (pixel_countdown > 0) { *((signed short*)(&pixels[y_ptr + pixel_ptr])) = bytestream2_get_le16(&g2); pixel_ptr += 2; pixel_countdown--; } if (s->avctx->width & 1) bytestream2_skip(&g2, 2); } } break; case FLI_MINI: bytestream2_skip(&g2, chunk_size - 6); break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); } else { av_log(avctx, AV_LOG_ERROR, "Chunk overread\n"); break; } frame_size -= chunk_size; num_chunks--; } if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, bytestream2_tell(&g2)); if ((ret = av_frame_ref(data, s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { FlicDecodeContext *s = VAR_0->priv_data; GetByteContext g2; int VAR_5; unsigned char VAR_6; unsigned int VAR_7; int VAR_8; unsigned int VAR_9; int VAR_10; int VAR_11, VAR_12, VAR_13; int VAR_14; int VAR_15; signed short VAR_16; int VAR_17; int VAR_18; int VAR_19; int VAR_20; unsigned char *VAR_21; int VAR_22; unsigned int VAR_23; bytestream2_init(&g2, VAR_3, VAR_4); if ((VAR_13 = ff_reget_buffer(VAR_0, s->frame)) < 0) return VAR_13; VAR_21 = s->frame->VAR_1[0]; VAR_23 = s->VAR_0->height * s->frame->linesize[0]; VAR_7 = bytestream2_get_le32(&g2); bytestream2_skip(&g2, 2); VAR_8 = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); if (VAR_7 > VAR_4) VAR_7 = VAR_4; VAR_7 -= 16; while ((VAR_7 > 0) && (VAR_8 > 0) && bytestream2_get_bytes_left(&g2) >= 4) { int VAR_24; VAR_9 = bytestream2_get_le32(&g2); if (VAR_9 > VAR_7) { av_log(VAR_0, AV_LOG_WARNING, "Invalid VAR_9 = %u > VAR_7 = %u\n", VAR_9, VAR_7); VAR_9 = VAR_7; } VAR_24 = bytestream2_tell(&g2) - 4 + VAR_9; VAR_10 = bytestream2_get_le16(&g2); switch (VAR_10) { case FLI_256_COLOR: case FLI_COLOR: ff_dlog(VAR_0, "Unexpected Palette chunk %d in non-palettized FLC\n", VAR_10); bytestream2_skip(&g2, VAR_9 - 6); break; case FLI_DELTA: case FLI_DTA_LC: VAR_17 = 0; VAR_15 = bytestream2_get_le16(&g2); while (VAR_15 > 0) { if (bytestream2_tell(&g2) + 2 > VAR_24) break; VAR_16 = bytestream2_get_le16(&g2); if (VAR_16 < 0) { VAR_16 = -VAR_16; VAR_17 += VAR_16 * s->frame->linesize[0]; } else { VAR_15--; VAR_5 = VAR_17; CHECK_PIXEL_PTR(0); VAR_20 = s->VAR_0->width; for (VAR_11 = 0; VAR_11 < VAR_16; VAR_11++) { if (bytestream2_tell(&g2) + 2 > VAR_24) break; VAR_19 = bytestream2_get_byte(&g2); VAR_5 += (VAR_19*2); VAR_20 -= VAR_19; VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8); if (VAR_18 < 0) { VAR_18 = -VAR_18; VAR_22 = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++, VAR_20 -= 2) { *((signed short*)(&VAR_21[VAR_5])) = VAR_22; VAR_5 += 2; } } else { if (bytestream2_tell(&g2) + 2*VAR_18 > VAR_24) break; CHECK_PIXEL_PTR(2 * VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++, VAR_20--) { *((signed short*)(&VAR_21[VAR_5])) = bytestream2_get_le16(&g2); VAR_5 += 2; } } } VAR_17 += s->frame->linesize[0]; } } break; case FLI_LC: av_log(VAR_0, AV_LOG_ERROR, "Unexpected FLI_LC chunk in non-palettized FLC\n"); bytestream2_skip(&g2, VAR_9 - 6); break; case FLI_BLACK: memset(VAR_21, 0x0000, s->frame->linesize[0] * s->VAR_0->height); break; case FLI_BRUN: VAR_17 = 0; for (VAR_14 = 0; VAR_14 < s->VAR_0->height; VAR_14++) { VAR_5 = VAR_17; bytestream2_skip(&g2, 1); VAR_20 = (s->VAR_0->width * 2); while (VAR_20 > 0) { if (bytestream2_tell(&g2) + 1 > VAR_24) break; VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8); if (VAR_18 > 0) { VAR_6 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) { VAR_21[VAR_5++] = VAR_6; VAR_20--; if (VAR_20 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_20 < 0 (%d) (linea%d)\n", VAR_20, VAR_14); } } else { VAR_18 = -VAR_18; if (bytestream2_tell(&g2) + VAR_18 > VAR_24) break; CHECK_PIXEL_PTR(VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) { VAR_6 = bytestream2_get_byte(&g2); VAR_21[VAR_5++] = VAR_6; VAR_20--; if (VAR_20 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_20 < 0 (%d) at line %d\n", VAR_20, VAR_14); } } } #if HAVE_BIGENDIAN VAR_5 = VAR_17; VAR_20 = s->VAR_0->width; while (VAR_20 > 0) { *((signed short*)(&VAR_21[VAR_5])) = AV_RL16(&VAR_3[VAR_5]); VAR_5 += 2; } #endif VAR_17 += s->frame->linesize[0]; } break; case FLI_DTA_BRUN: VAR_17 = 0; for (VAR_14 = 0; VAR_14 < s->VAR_0->height; VAR_14++) { VAR_5 = VAR_17; bytestream2_skip(&g2, 1); VAR_20 = s->VAR_0->width; while (VAR_20 > 0) { if (bytestream2_tell(&g2) + 1 > VAR_24) break; VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8); if (VAR_18 > 0) { VAR_22 = bytestream2_get_le16(&g2); CHECK_PIXEL_PTR(2 * VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) { *((signed short*)(&VAR_21[VAR_5])) = VAR_22; VAR_5 += 2; VAR_20--; if (VAR_20 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_20 < 0 (%d)\n", VAR_20); } } else { VAR_18 = -VAR_18; if (bytestream2_tell(&g2) + 2 * VAR_18 > VAR_24) break; CHECK_PIXEL_PTR(2 * VAR_18); for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) { *((signed short*)(&VAR_21[VAR_5])) = bytestream2_get_le16(&g2); VAR_5 += 2; VAR_20--; if (VAR_20 < 0) av_log(VAR_0, AV_LOG_ERROR, "VAR_20 < 0 (%d)\n", VAR_20); } } } VAR_17 += s->frame->linesize[0]; } break; case FLI_COPY: case FLI_DTA_COPY: if (VAR_9 - 6 > (unsigned int)(FFALIGN(s->VAR_0->width, 2) * s->VAR_0->height)*2) { av_log(VAR_0, AV_LOG_ERROR, "In chunk FLI_COPY : source VAR_1 (%d bytes) " \ "bigger than image, skipping chunk\n", VAR_9 - 6); bytestream2_skip(&g2, VAR_9 - 6); } else { for (VAR_17 = 0; VAR_17 < s->frame->linesize[0] * s->VAR_0->height; VAR_17 += s->frame->linesize[0]) { VAR_20 = s->VAR_0->width; VAR_5 = 0; while (VAR_20 > 0) { *((signed short*)(&VAR_21[VAR_17 + VAR_5])) = bytestream2_get_le16(&g2); VAR_5 += 2; VAR_20--; } if (s->VAR_0->width & 1) bytestream2_skip(&g2, 2); } } break; case FLI_MINI: bytestream2_skip(&g2, VAR_9 - 6); break; default: av_log(VAR_0, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", VAR_10); break; } if (VAR_24 - bytestream2_tell(&g2) >= 0) { bytestream2_skip(&g2, VAR_24 - bytestream2_tell(&g2)); } else { av_log(VAR_0, AV_LOG_ERROR, "Chunk overread\n"); break; } VAR_7 -= VAR_9; VAR_8--; } if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1)) av_log(VAR_0, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", VAR_4, bytestream2_tell(&g2)); if ((VAR_13 = av_frame_ref(VAR_1, s->frame)) < 0) return VAR_13; *VAR_2 = 1; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "FlicDecodeContext *s = VAR_0->priv_data;", "GetByteContext g2;", "int VAR_5;", "unsigned char VAR_6;", "unsigned int VAR_7;", "int VAR_8;", "unsigned int VAR_9;", "int VAR_10;", "int VAR_11, VAR_12, VAR_13;", "int VAR_14;", "int VAR_15;", "signed short VAR_16;", "int VAR_17;", "int VAR_18;", "int VAR_19;", "int VAR_20;", "unsigned char *VAR_21;", "int VAR_22;", "unsigned int VAR_23;", "bytestream2_init(&g2, VAR_3, VAR_4);", "if ((VAR_13 = ff_reget_buffer(VAR_0, s->frame)) < 0)\nreturn VAR_13;", "VAR_21 = s->frame->VAR_1[0];", "VAR_23 = s->VAR_0->height * s->frame->linesize[0];", "VAR_7 = bytestream2_get_le32(&g2);", "bytestream2_skip(&g2, 2);", "VAR_8 = bytestream2_get_le16(&g2);", "bytestream2_skip(&g2, 8);", "if (VAR_7 > VAR_4)\nVAR_7 = VAR_4;", "VAR_7 -= 16;", "while ((VAR_7 > 0) && (VAR_8 > 0) &&\nbytestream2_get_bytes_left(&g2) >= 4) {", "int VAR_24;", "VAR_9 = bytestream2_get_le32(&g2);", "if (VAR_9 > VAR_7) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid VAR_9 = %u > VAR_7 = %u\\n\", VAR_9, VAR_7);", "VAR_9 = VAR_7;", "}", "VAR_24 = bytestream2_tell(&g2) - 4 + VAR_9;", "VAR_10 = bytestream2_get_le16(&g2);", "switch (VAR_10) {", "case FLI_256_COLOR:\ncase FLI_COLOR:\nff_dlog(VAR_0,\n\"Unexpected Palette chunk %d in non-palettized FLC\\n\",\nVAR_10);", "bytestream2_skip(&g2, VAR_9 - 6);", "break;", "case FLI_DELTA:\ncase FLI_DTA_LC:\nVAR_17 = 0;", "VAR_15 = bytestream2_get_le16(&g2);", "while (VAR_15 > 0) {", "if (bytestream2_tell(&g2) + 2 > VAR_24)\nbreak;", "VAR_16 = bytestream2_get_le16(&g2);", "if (VAR_16 < 0) {", "VAR_16 = -VAR_16;", "VAR_17 += VAR_16 * s->frame->linesize[0];", "} else {", "VAR_15--;", "VAR_5 = VAR_17;", "CHECK_PIXEL_PTR(0);", "VAR_20 = s->VAR_0->width;", "for (VAR_11 = 0; VAR_11 < VAR_16; VAR_11++) {", "if (bytestream2_tell(&g2) + 2 > VAR_24)\nbreak;", "VAR_19 = bytestream2_get_byte(&g2);", "VAR_5 += (VAR_19*2);", "VAR_20 -= VAR_19;", "VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8);", "if (VAR_18 < 0) {", "VAR_18 = -VAR_18;", "VAR_22 = bytestream2_get_le16(&g2);", "CHECK_PIXEL_PTR(2 * VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++, VAR_20 -= 2) {", "*((signed short*)(&VAR_21[VAR_5])) = VAR_22;", "VAR_5 += 2;", "}", "} else {", "if (bytestream2_tell(&g2) + 2*VAR_18 > VAR_24)\nbreak;", "CHECK_PIXEL_PTR(2 * VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++, VAR_20--) {", "*((signed short*)(&VAR_21[VAR_5])) = bytestream2_get_le16(&g2);", "VAR_5 += 2;", "}", "}", "}", "VAR_17 += s->frame->linesize[0];", "}", "}", "break;", "case FLI_LC:\nav_log(VAR_0, AV_LOG_ERROR, \"Unexpected FLI_LC chunk in non-palettized FLC\\n\");", "bytestream2_skip(&g2, VAR_9 - 6);", "break;", "case FLI_BLACK:\nmemset(VAR_21, 0x0000,\ns->frame->linesize[0] * s->VAR_0->height);", "break;", "case FLI_BRUN:\nVAR_17 = 0;", "for (VAR_14 = 0; VAR_14 < s->VAR_0->height; VAR_14++) {", "VAR_5 = VAR_17;", "bytestream2_skip(&g2, 1);", "VAR_20 = (s->VAR_0->width * 2);", "while (VAR_20 > 0) {", "if (bytestream2_tell(&g2) + 1 > VAR_24)\nbreak;", "VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8);", "if (VAR_18 > 0) {", "VAR_6 = bytestream2_get_byte(&g2);", "CHECK_PIXEL_PTR(VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) {", "VAR_21[VAR_5++] = VAR_6;", "VAR_20--;", "if (VAR_20 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_20 < 0 (%d) (linea%d)\\n\",\nVAR_20, VAR_14);", "}", "} else {", "VAR_18 = -VAR_18;", "if (bytestream2_tell(&g2) + VAR_18 > VAR_24)\nbreak;", "CHECK_PIXEL_PTR(VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) {", "VAR_6 = bytestream2_get_byte(&g2);", "VAR_21[VAR_5++] = VAR_6;", "VAR_20--;", "if (VAR_20 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_20 < 0 (%d) at line %d\\n\",\nVAR_20, VAR_14);", "}", "}", "}", "#if HAVE_BIGENDIAN\nVAR_5 = VAR_17;", "VAR_20 = s->VAR_0->width;", "while (VAR_20 > 0) {", "*((signed short*)(&VAR_21[VAR_5])) = AV_RL16(&VAR_3[VAR_5]);", "VAR_5 += 2;", "}", "#endif\nVAR_17 += s->frame->linesize[0];", "}", "break;", "case FLI_DTA_BRUN:\nVAR_17 = 0;", "for (VAR_14 = 0; VAR_14 < s->VAR_0->height; VAR_14++) {", "VAR_5 = VAR_17;", "bytestream2_skip(&g2, 1);", "VAR_20 = s->VAR_0->width;", "while (VAR_20 > 0) {", "if (bytestream2_tell(&g2) + 1 > VAR_24)\nbreak;", "VAR_18 = sign_extend(bytestream2_get_byte(&g2), 8);", "if (VAR_18 > 0) {", "VAR_22 = bytestream2_get_le16(&g2);", "CHECK_PIXEL_PTR(2 * VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) {", "*((signed short*)(&VAR_21[VAR_5])) = VAR_22;", "VAR_5 += 2;", "VAR_20--;", "if (VAR_20 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_20 < 0 (%d)\\n\",\nVAR_20);", "}", "} else {", "VAR_18 = -VAR_18;", "if (bytestream2_tell(&g2) + 2 * VAR_18 > VAR_24)\nbreak;", "CHECK_PIXEL_PTR(2 * VAR_18);", "for (VAR_12 = 0; VAR_12 < VAR_18; VAR_12++) {", "*((signed short*)(&VAR_21[VAR_5])) = bytestream2_get_le16(&g2);", "VAR_5 += 2;", "VAR_20--;", "if (VAR_20 < 0)\nav_log(VAR_0, AV_LOG_ERROR, \"VAR_20 < 0 (%d)\\n\",\nVAR_20);", "}", "}", "}", "VAR_17 += s->frame->linesize[0];", "}", "break;", "case FLI_COPY:\ncase FLI_DTA_COPY:\nif (VAR_9 - 6 > (unsigned int)(FFALIGN(s->VAR_0->width, 2) * s->VAR_0->height)*2) {", "av_log(VAR_0, AV_LOG_ERROR, \"In chunk FLI_COPY : source VAR_1 (%d bytes) \" \\\n\"bigger than image, skipping chunk\\n\", VAR_9 - 6);", "bytestream2_skip(&g2, VAR_9 - 6);", "} else {", "for (VAR_17 = 0; VAR_17 < s->frame->linesize[0] * s->VAR_0->height;", "VAR_17 += s->frame->linesize[0]) {", "VAR_20 = s->VAR_0->width;", "VAR_5 = 0;", "while (VAR_20 > 0) {", "*((signed short*)(&VAR_21[VAR_17 + VAR_5])) = bytestream2_get_le16(&g2);", "VAR_5 += 2;", "VAR_20--;", "}", "if (s->VAR_0->width & 1)\nbytestream2_skip(&g2, 2);", "}", "}", "break;", "case FLI_MINI:\nbytestream2_skip(&g2, VAR_9 - 6);", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Unrecognized chunk type: %d\\n\", VAR_10);", "break;", "}", "if (VAR_24 - bytestream2_tell(&g2) >= 0) {", "bytestream2_skip(&g2, VAR_24 - bytestream2_tell(&g2));", "} else {", "av_log(VAR_0, AV_LOG_ERROR, \"Chunk overread\\n\");", "break;", "}", "VAR_7 -= VAR_9;", "VAR_8--;", "}", "if ((bytestream2_get_bytes_left(&g2) != 0) && (bytestream2_get_bytes_left(&g2) != 1))\nav_log(VAR_0, AV_LOG_ERROR, \"Processed FLI chunk where chunk size = %d \" \\\n\"and final chunk ptr = %d\\n\", VAR_4, bytestream2_tell(&g2));", "if ((VAR_13 = av_frame_ref(VAR_1, s->frame)) < 0)\nreturn VAR_13;", "*VAR_2 = 1;", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67, 69 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 95 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 129 ], [ 131, 133, 141, 143, 145 ], [ 147 ], [ 149 ], [ 153, 155, 157 ], [ 159 ], [ 161 ], [ 163, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 189, 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 259, 263, 265 ], [ 267 ], [ 271, 273 ], [ 275 ], [ 277 ], [ 283 ], [ 285 ], [ 289 ], [ 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309, 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335, 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 359, 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373, 375 ], [ 377 ], [ 379 ], [ 383, 385 ], [ 387 ], [ 389 ], [ 395 ], [ 397 ], [ 401 ], [ 403, 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423, 425, 427 ], [ 429 ], [ 431 ], [ 433 ], [ 435, 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449, 451, 453 ], [ 455 ], [ 457 ], [ 459 ], [ 463 ], [ 465 ], [ 467 ], [ 471, 473, 477 ], [ 479, 481 ], [ 483 ], [ 485 ], [ 489 ], [ 491 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507 ], [ 509, 511 ], [ 513 ], [ 515 ], [ 517 ], [ 521, 525 ], [ 527 ], [ 531, 533 ], [ 535 ], [ 537 ], [ 541 ], [ 543 ], [ 545 ], [ 547 ], [ 549 ], [ 551 ], [ 555 ], [ 557 ], [ 559 ], [ 567, 569, 571 ], [ 575, 577 ], [ 581 ], [ 585 ], [ 587 ] ]
25,864
void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) { CPUSPARCState *env = cs->env_ptr; target_ulong pc_start, last_pc; DisasContext dc1, *dc = &dc1; int num_insns; int max_insns; unsigned int insn; memset(dc, 0, sizeof(DisasContext)); dc->tb = tb; pc_start = tb->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = tb->flags & TB_FLAG_MMU_MASK; dc->def = &env->def; dc->fpu_enabled = tb_fpu_enabled(tb->flags); dc->address_mask_32bit = tb_am_enabled(tb->flags); dc->singlestep = (cs->singlestep_enabled || singlestep); #ifndef CONFIG_USER_ONLY dc->supervisor = (tb->flags & TB_FLAG_SUPER) != 0; #endif #ifdef TARGET_SPARC64 dc->fprs_dirty = 0; dc->asi = (tb->flags >> TB_FLAG_ASI_SHIFT) & 0xff; #ifndef CONFIG_USER_ONLY dc->hypervisor = (tb->flags & TB_FLAG_HYPER) != 0; #endif #endif num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } gen_tb_start(tb); do { if (dc->npc & JUMP_PC) { assert(dc->jump_pc[1] == dc->pc + 4); tcg_gen_insn_start(dc->pc, dc->jump_pc[0] | JUMP_PC); } else { tcg_gen_insn_start(dc->pc, dc->npc); } num_insns++; last_pc = dc->pc; if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { if (dc->pc != pc_start) { save_state(dc); } gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } insn = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, insn); if (dc->is_br) break; /* if the next PC is different, we abort now */ if (dc->pc != (last_pc + 4)) break; /* if we reach a page boundary, we stop generation so that the PC of a TT_TFAULT exception is always in the right page */ if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; /* if single step mode, we generate only one instruction and generate an exception */ if (dc->singlestep) { break; } } while (!tcg_op_buf_full() && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && num_insns < max_insns); exit_gen_loop: if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { /* static PC and NPC: we can use direct chaining */ gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(tb, num_insns); tb->size = last_pc + 4 - pc_start; tb->icount = num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(pc_start)) { qemu_log_lock(); qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); qemu_log_unlock(); } #endif }
true
qemu
c5a49c63fa26e8825ad101dfe86339ae4c216539
void gen_intermediate_code(CPUState *cs, TranslationBlock * tb) { CPUSPARCState *env = cs->env_ptr; target_ulong pc_start, last_pc; DisasContext dc1, *dc = &dc1; int num_insns; int max_insns; unsigned int insn; memset(dc, 0, sizeof(DisasContext)); dc->tb = tb; pc_start = tb->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) tb->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = tb->flags & TB_FLAG_MMU_MASK; dc->def = &env->def; dc->fpu_enabled = tb_fpu_enabled(tb->flags); dc->address_mask_32bit = tb_am_enabled(tb->flags); dc->singlestep = (cs->singlestep_enabled || singlestep); #ifndef CONFIG_USER_ONLY dc->supervisor = (tb->flags & TB_FLAG_SUPER) != 0; #endif #ifdef TARGET_SPARC64 dc->fprs_dirty = 0; dc->asi = (tb->flags >> TB_FLAG_ASI_SHIFT) & 0xff; #ifndef CONFIG_USER_ONLY dc->hypervisor = (tb->flags & TB_FLAG_HYPER) != 0; #endif #endif num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } gen_tb_start(tb); do { if (dc->npc & JUMP_PC) { assert(dc->jump_pc[1] == dc->pc + 4); tcg_gen_insn_start(dc->pc, dc->jump_pc[0] | JUMP_PC); } else { tcg_gen_insn_start(dc->pc, dc->npc); } num_insns++; last_pc = dc->pc; if (unlikely(cpu_breakpoint_test(cs, dc->pc, BP_ANY))) { if (dc->pc != pc_start) { save_state(dc); } gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } insn = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, insn); if (dc->is_br) break; if (dc->pc != (last_pc + 4)) break; if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (dc->singlestep) { break; } } while (!tcg_op_buf_full() && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && num_insns < max_insns); exit_gen_loop: if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(tb, num_insns); tb->size = last_pc + 4 - pc_start; tb->icount = num_insns; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(pc_start)) { qemu_log_lock(); qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); qemu_log_unlock(); } #endif }
{ "code": [ " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " max_insns = tb->cflags & CF_COUNT_MASK;", " max_insns = tb->cflags & CF_COUNT_MASK;", " if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) {", " if (tb->cflags & CF_LAST_IO) {", " if (tb->cflags & CF_LAST_IO) {" ], "line_no": [ 67, 125, 67, 125, 179, 67, 125, 67, 125, 67, 125, 179, 67, 125, 179, 67, 125, 179, 67, 67, 125, 179, 67, 125, 179, 67, 125, 179, 67, 67, 125, 179, 179 ] }
void FUNC_0(CPUState *VAR_0, TranslationBlock * VAR_1) { CPUSPARCState *env = VAR_0->env_ptr; target_ulong pc_start, last_pc; DisasContext dc1, *dc = &dc1; int VAR_2; int VAR_3; unsigned int VAR_4; memset(dc, 0, sizeof(DisasContext)); dc->VAR_1 = VAR_1; pc_start = VAR_1->pc; dc->pc = pc_start; last_pc = dc->pc; dc->npc = (target_ulong) VAR_1->cs_base; dc->cc_op = CC_OP_DYNAMIC; dc->mem_idx = VAR_1->flags & TB_FLAG_MMU_MASK; dc->def = &env->def; dc->fpu_enabled = tb_fpu_enabled(VAR_1->flags); dc->address_mask_32bit = tb_am_enabled(VAR_1->flags); dc->singlestep = (VAR_0->singlestep_enabled || singlestep); #ifndef CONFIG_USER_ONLY dc->supervisor = (VAR_1->flags & TB_FLAG_SUPER) != 0; #endif #ifdef TARGET_SPARC64 dc->fprs_dirty = 0; dc->asi = (VAR_1->flags >> TB_FLAG_ASI_SHIFT) & 0xff; #ifndef CONFIG_USER_ONLY dc->hypervisor = (VAR_1->flags & TB_FLAG_HYPER) != 0; #endif #endif VAR_2 = 0; VAR_3 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_3 == 0) { VAR_3 = CF_COUNT_MASK; } if (VAR_3 > TCG_MAX_INSNS) { VAR_3 = TCG_MAX_INSNS; } gen_tb_start(VAR_1); do { if (dc->npc & JUMP_PC) { assert(dc->jump_pc[1] == dc->pc + 4); tcg_gen_insn_start(dc->pc, dc->jump_pc[0] | JUMP_PC); } else { tcg_gen_insn_start(dc->pc, dc->npc); } VAR_2++; last_pc = dc->pc; if (unlikely(cpu_breakpoint_test(VAR_0, dc->pc, BP_ANY))) { if (dc->pc != pc_start) { save_state(dc); } gen_helper_debug(cpu_env); tcg_gen_exit_tb(0); dc->is_br = 1; goto exit_gen_loop; } if (VAR_2 == VAR_3 && (VAR_1->cflags & CF_LAST_IO)) { gen_io_start(); } VAR_4 = cpu_ldl_code(env, dc->pc); disas_sparc_insn(dc, VAR_4); if (dc->is_br) break; if (dc->pc != (last_pc + 4)) break; if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (dc->singlestep) { break; } } while (!tcg_op_buf_full() && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) && VAR_2 < VAR_3); exit_gen_loop: if (VAR_1->cflags & CF_LAST_IO) { gen_io_end(); } if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { gen_goto_tb(dc, 0, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) { tcg_gen_movi_tl(cpu_pc, dc->pc); } save_npc(dc); tcg_gen_exit_tb(0); } } gen_tb_end(VAR_1, VAR_2); VAR_1->size = last_pc + 4 - pc_start; VAR_1->icount = VAR_2; #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(pc_start)) { qemu_log_lock(); qemu_log("--------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(VAR_0, pc_start, last_pc + 4 - pc_start, 0); qemu_log("\n"); qemu_log_unlock(); } #endif }
[ "void FUNC_0(CPUState *VAR_0, TranslationBlock * VAR_1)\n{", "CPUSPARCState *env = VAR_0->env_ptr;", "target_ulong pc_start, last_pc;", "DisasContext dc1, *dc = &dc1;", "int VAR_2;", "int VAR_3;", "unsigned int VAR_4;", "memset(dc, 0, sizeof(DisasContext));", "dc->VAR_1 = VAR_1;", "pc_start = VAR_1->pc;", "dc->pc = pc_start;", "last_pc = dc->pc;", "dc->npc = (target_ulong) VAR_1->cs_base;", "dc->cc_op = CC_OP_DYNAMIC;", "dc->mem_idx = VAR_1->flags & TB_FLAG_MMU_MASK;", "dc->def = &env->def;", "dc->fpu_enabled = tb_fpu_enabled(VAR_1->flags);", "dc->address_mask_32bit = tb_am_enabled(VAR_1->flags);", "dc->singlestep = (VAR_0->singlestep_enabled || singlestep);", "#ifndef CONFIG_USER_ONLY\ndc->supervisor = (VAR_1->flags & TB_FLAG_SUPER) != 0;", "#endif\n#ifdef TARGET_SPARC64\ndc->fprs_dirty = 0;", "dc->asi = (VAR_1->flags >> TB_FLAG_ASI_SHIFT) & 0xff;", "#ifndef CONFIG_USER_ONLY\ndc->hypervisor = (VAR_1->flags & TB_FLAG_HYPER) != 0;", "#endif\n#endif\nVAR_2 = 0;", "VAR_3 = VAR_1->cflags & CF_COUNT_MASK;", "if (VAR_3 == 0) {", "VAR_3 = CF_COUNT_MASK;", "}", "if (VAR_3 > TCG_MAX_INSNS) {", "VAR_3 = TCG_MAX_INSNS;", "}", "gen_tb_start(VAR_1);", "do {", "if (dc->npc & JUMP_PC) {", "assert(dc->jump_pc[1] == dc->pc + 4);", "tcg_gen_insn_start(dc->pc, dc->jump_pc[0] | JUMP_PC);", "} else {", "tcg_gen_insn_start(dc->pc, dc->npc);", "}", "VAR_2++;", "last_pc = dc->pc;", "if (unlikely(cpu_breakpoint_test(VAR_0, dc->pc, BP_ANY))) {", "if (dc->pc != pc_start) {", "save_state(dc);", "}", "gen_helper_debug(cpu_env);", "tcg_gen_exit_tb(0);", "dc->is_br = 1;", "goto exit_gen_loop;", "}", "if (VAR_2 == VAR_3 && (VAR_1->cflags & CF_LAST_IO)) {", "gen_io_start();", "}", "VAR_4 = cpu_ldl_code(env, dc->pc);", "disas_sparc_insn(dc, VAR_4);", "if (dc->is_br)\nbreak;", "if (dc->pc != (last_pc + 4))\nbreak;", "if ((dc->pc & (TARGET_PAGE_SIZE - 1)) == 0)\nbreak;", "if (dc->singlestep) {", "break;", "}", "} while (!tcg_op_buf_full() &&", "(dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32) &&\nVAR_2 < VAR_3);", "exit_gen_loop:\nif (VAR_1->cflags & CF_LAST_IO) {", "gen_io_end();", "}", "if (!dc->is_br) {", "if (dc->pc != DYNAMIC_PC &&\n(dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) {", "gen_goto_tb(dc, 0, dc->pc, dc->npc);", "} else {", "if (dc->pc != DYNAMIC_PC) {", "tcg_gen_movi_tl(cpu_pc, dc->pc);", "}", "save_npc(dc);", "tcg_gen_exit_tb(0);", "}", "}", "gen_tb_end(VAR_1, VAR_2);", "VAR_1->size = last_pc + 4 - pc_start;", "VAR_1->icount = VAR_2;", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)\n&& qemu_log_in_addr_range(pc_start)) {", "qemu_log_lock();", "qemu_log(\"--------------\\n\");", "qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));", "log_target_disas(VAR_0, pc_start, last_pc + 4 - pc_start, 0);", "qemu_log(\"\\n\");", "qemu_log_unlock();", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59, 61, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 137 ], [ 141, 143 ], [ 147, 149 ], [ 155, 157 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171, 173 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 221, 223, 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241, 243 ] ]
25,866
static void cortex_a15_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); set_feature(&cpu->env, ARM_FEATURE_V7); set_feature(&cpu->env, ARM_FEATURE_VFP4); set_feature(&cpu->env, ARM_FEATURE_VFP_FP16); set_feature(&cpu->env, ARM_FEATURE_NEON); set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); set_feature(&cpu->env, ARM_FEATURE_ARM_DIV); set_feature(&cpu->env, ARM_FEATURE_V7MP); set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); cpu->midr = 0x412fc0f1; cpu->reset_fpsid = 0x410430f0; cpu->mvfr0 = 0x10110222; cpu->mvfr1 = 0x11111111; cpu->ctr = 0x8444c004; cpu->reset_sctlr = 0x00c50078; cpu->id_pfr0 = 0x00001131; cpu->id_pfr1 = 0x00011011; cpu->id_dfr0 = 0x02010555; cpu->id_afr0 = 0x00000000; cpu->id_mmfr0 = 0x10201105; cpu->id_mmfr1 = 0x20000000; cpu->id_mmfr2 = 0x01240000; cpu->id_mmfr3 = 0x02102211; cpu->id_isar0 = 0x02101110; cpu->id_isar1 = 0x13112111; cpu->id_isar2 = 0x21232041; cpu->id_isar3 = 0x11112131; cpu->id_isar4 = 0x10011142; cpu->clidr = 0x0a200023; cpu->ccsidr[0] = 0x701fe00a; /* 32K L1 dcache */ cpu->ccsidr[1] = 0x201fe00a; /* 32K L1 icache */ cpu->ccsidr[2] = 0x711fe07a; /* 4096K L2 unified cache */ define_arm_cp_regs(cpu, cortexa15_cp_reginfo); }
true
qemu
de9b05b807918d40db9e26ddd6a54ad2978ac5b7
static void cortex_a15_initfn(Object *obj) { ARMCPU *cpu = ARM_CPU(obj); set_feature(&cpu->env, ARM_FEATURE_V7); set_feature(&cpu->env, ARM_FEATURE_VFP4); set_feature(&cpu->env, ARM_FEATURE_VFP_FP16); set_feature(&cpu->env, ARM_FEATURE_NEON); set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); set_feature(&cpu->env, ARM_FEATURE_ARM_DIV); set_feature(&cpu->env, ARM_FEATURE_V7MP); set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); cpu->midr = 0x412fc0f1; cpu->reset_fpsid = 0x410430f0; cpu->mvfr0 = 0x10110222; cpu->mvfr1 = 0x11111111; cpu->ctr = 0x8444c004; cpu->reset_sctlr = 0x00c50078; cpu->id_pfr0 = 0x00001131; cpu->id_pfr1 = 0x00011011; cpu->id_dfr0 = 0x02010555; cpu->id_afr0 = 0x00000000; cpu->id_mmfr0 = 0x10201105; cpu->id_mmfr1 = 0x20000000; cpu->id_mmfr2 = 0x01240000; cpu->id_mmfr3 = 0x02102211; cpu->id_isar0 = 0x02101110; cpu->id_isar1 = 0x13112111; cpu->id_isar2 = 0x21232041; cpu->id_isar3 = 0x11112131; cpu->id_isar4 = 0x10011142; cpu->clidr = 0x0a200023; cpu->ccsidr[0] = 0x701fe00a; cpu->ccsidr[1] = 0x201fe00a; cpu->ccsidr[2] = 0x711fe07a; define_arm_cp_regs(cpu, cortexa15_cp_reginfo); }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0) { ARMCPU *cpu = ARM_CPU(VAR_0); set_feature(&cpu->env, ARM_FEATURE_V7); set_feature(&cpu->env, ARM_FEATURE_VFP4); set_feature(&cpu->env, ARM_FEATURE_VFP_FP16); set_feature(&cpu->env, ARM_FEATURE_NEON); set_feature(&cpu->env, ARM_FEATURE_THUMB2EE); set_feature(&cpu->env, ARM_FEATURE_ARM_DIV); set_feature(&cpu->env, ARM_FEATURE_V7MP); set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER); set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS); cpu->midr = 0x412fc0f1; cpu->reset_fpsid = 0x410430f0; cpu->mvfr0 = 0x10110222; cpu->mvfr1 = 0x11111111; cpu->ctr = 0x8444c004; cpu->reset_sctlr = 0x00c50078; cpu->id_pfr0 = 0x00001131; cpu->id_pfr1 = 0x00011011; cpu->id_dfr0 = 0x02010555; cpu->id_afr0 = 0x00000000; cpu->id_mmfr0 = 0x10201105; cpu->id_mmfr1 = 0x20000000; cpu->id_mmfr2 = 0x01240000; cpu->id_mmfr3 = 0x02102211; cpu->id_isar0 = 0x02101110; cpu->id_isar1 = 0x13112111; cpu->id_isar2 = 0x21232041; cpu->id_isar3 = 0x11112131; cpu->id_isar4 = 0x10011142; cpu->clidr = 0x0a200023; cpu->ccsidr[0] = 0x701fe00a; cpu->ccsidr[1] = 0x201fe00a; cpu->ccsidr[2] = 0x711fe07a; define_arm_cp_regs(cpu, cortexa15_cp_reginfo); }
[ "static void FUNC_0(Object *VAR_0)\n{", "ARMCPU *cpu = ARM_CPU(VAR_0);", "set_feature(&cpu->env, ARM_FEATURE_V7);", "set_feature(&cpu->env, ARM_FEATURE_VFP4);", "set_feature(&cpu->env, ARM_FEATURE_VFP_FP16);", "set_feature(&cpu->env, ARM_FEATURE_NEON);", "set_feature(&cpu->env, ARM_FEATURE_THUMB2EE);", "set_feature(&cpu->env, ARM_FEATURE_ARM_DIV);", "set_feature(&cpu->env, ARM_FEATURE_V7MP);", "set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);", "set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);", "cpu->midr = 0x412fc0f1;", "cpu->reset_fpsid = 0x410430f0;", "cpu->mvfr0 = 0x10110222;", "cpu->mvfr1 = 0x11111111;", "cpu->ctr = 0x8444c004;", "cpu->reset_sctlr = 0x00c50078;", "cpu->id_pfr0 = 0x00001131;", "cpu->id_pfr1 = 0x00011011;", "cpu->id_dfr0 = 0x02010555;", "cpu->id_afr0 = 0x00000000;", "cpu->id_mmfr0 = 0x10201105;", "cpu->id_mmfr1 = 0x20000000;", "cpu->id_mmfr2 = 0x01240000;", "cpu->id_mmfr3 = 0x02102211;", "cpu->id_isar0 = 0x02101110;", "cpu->id_isar1 = 0x13112111;", "cpu->id_isar2 = 0x21232041;", "cpu->id_isar3 = 0x11112131;", "cpu->id_isar4 = 0x10011142;", "cpu->clidr = 0x0a200023;", "cpu->ccsidr[0] = 0x701fe00a;", "cpu->ccsidr[1] = 0x201fe00a;", "cpu->ccsidr[2] = 0x711fe07a;", "define_arm_cp_regs(cpu, cortexa15_cp_reginfo);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 26 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ], [ 48 ], [ 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ] ]
25,867
void OPPROTO op_check_reservation_64 (void) { if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003)) env->reserve = -1; RETURN(); }
true
qemu
6f2d8978728c48ca46f5c01835438508aace5c64
void OPPROTO op_check_reservation_64 (void) { if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003)) env->reserve = -1; RETURN(); }
{ "code": [ " env->reserve = -1;" ], "line_no": [ 7 ] }
void VAR_0 op_check_reservation_64 (void) { if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003)) env->reserve = -1; RETURN(); }
[ "void VAR_0 op_check_reservation_64 (void)\n{", "if ((uint64_t)env->reserve == (uint64_t)(T0 & ~0x00000003))\nenv->reserve = -1;", "RETURN();", "}" ]
[ 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ] ]
25,870
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, mb_x, mb_y, i, y, referenced; enum AVDiscard skip_thresh; AVFrame *av_uninit(curframe), *prev_frame; release_queued_segmaps(s, 0); if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) return ret; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; // release no longer referenced frames for (i = 0; i < 5; i++) if (s->frames[i].data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i], 1, 0); // find a free buffer for (i = 0; i < 5; i++) if (&s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (i == 5) { av_log(avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->data[0]) vp8_release_frame(s, curframe, 1, 0); curframe->key_frame = s->keyframe; curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; curframe->reference = referenced ? 3 : 0; if ((ret = vp8_alloc_frame(s, curframe))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); return ret; } // check if golden and altref are swapped if (s->update_altref != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; } else { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; } if (s->update_golden != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; } else { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; } if (s->update_last) { s->next_framep[VP56_FRAME_PREVIOUS] = curframe; } else { s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; } s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(avctx); // Given that arithmetic probabilities are updated every frame, it's quite likely // that the values we have on a random interframe are complete junk if we didn't // start decode on a keyframe. So just don't display anything rather than junk. if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); return AVERROR_INVALIDDATA; } s->linesize = curframe->linesize[0]; s->uvlinesize = curframe->linesize[1]; if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(21*s->linesize); memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); /* Zero macroblock structures for top/top-left prediction from outside the frame. */ memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks)); // top edge of 127 for intra prediction if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { s->top_border[0][15] = s->top_border[0][23] = 127; memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1); } memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); #define MARGIN (16 << 2) s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; int mb_xy = mb_y*s->mb_width; uint8_t *dst[3] = { curframe->data[0] + 16*mb_y*s->linesize, curframe->data[1] + 8*mb_y*s->uvlinesize, curframe->data[2] + 8*mb_y*s->uvlinesize }; memset(mb - 1, 0, sizeof(*mb)); // zero left macroblock memset(s->left_nnz, 0, sizeof(s->left_nnz)); AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); // left edge of 129 for intra prediction if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { for (i = 0; i < 3; i++) for (y = 0; y < 16>>!!i; y++) dst[i][y*curframe->linesize[i]-1] = 129; if (mb_y == 1) // top left edge is also 129 s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(prev_frame, mb_y, 0); for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { /* Prefetch the current frame, 4 MBs ahead */ s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2); decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy, prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS); if (!mb->skip) decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz); if (mb->mode <= MODE_I4x4) intra_predict(s, dst, mb, mb_x, mb_y); else inter_predict(s, dst, mb, mb_x, mb_y); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN); if (!mb->skip) { idct_mb(s, dst, mb); } else { AV_ZERO64(s->left_nnz); AV_WN64(s->top_nnz[mb_x], 0); // array of 9, so unaligned // Reset DC block predictors if they would exist if the mb had coefficients if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { s->left_nnz[8] = 0; s->top_nnz[mb_x][8] = 0; } } if (s->deblock_filter) filter_level_for_mb(s, mb, &s->filter_strength[mb_x]); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2); dst[0] += 16; dst[1] += 8; dst[2] += 8; s->mv_min.x -= 64; s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) filter_mb_row_simple(s, curframe, mb_y); else filter_mb_row(s, curframe, mb_y); } s->mv_min.y -= 64; s->mv_max.y -= 64; ff_thread_report_progress(curframe, mb_y, 0); } ff_thread_report_progress(curframe, INT_MAX, 0); skip_decode: // if future frames don't use the updated probabilities, // reset them to the values we saved if (!s->update_probabilities) s->prob[0] = s->prob[1]; memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); if (!s->invisible) { *(AVFrame*)data = *curframe; *data_size = sizeof(AVFrame); } return avpkt->size; }
true
FFmpeg
fb90785e98ac405198c0ca9fec133227f6d82826
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, mb_x, mb_y, i, y, referenced; enum AVDiscard skip_thresh; AVFrame *av_uninit(curframe), *prev_frame; release_queued_segmaps(s, 0); if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) return ret; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; for (i = 0; i < 5; i++) if (s->frames[i].data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i], 1, 0); for (i = 0; i < 5; i++) if (&s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (i == 5) { av_log(avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->data[0]) vp8_release_frame(s, curframe, 1, 0); curframe->key_frame = s->keyframe; curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; curframe->reference = referenced ? 3 : 0; if ((ret = vp8_alloc_frame(s, curframe))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); return ret; } if (s->update_altref != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; } else { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; } if (s->update_golden != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; } else { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; } if (s->update_last) { s->next_framep[VP56_FRAME_PREVIOUS] = curframe; } else { s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; } s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(avctx); if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); return AVERROR_INVALIDDATA; } s->linesize = curframe->linesize[0]; s->uvlinesize = curframe->linesize[1]; if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(21*s->linesize); memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks)); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { s->top_border[0][15] = s->top_border[0][23] = 127; memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1); } memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); #define MARGIN (16 << 2) s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; int mb_xy = mb_y*s->mb_width; uint8_t *dst[3] = { curframe->data[0] + 16*mb_y*s->linesize, curframe->data[1] + 8*mb_y*s->uvlinesize, curframe->data[2] + 8*mb_y*s->uvlinesize }; memset(mb - 1, 0, sizeof(*mb)); memset(s->left_nnz, 0, sizeof(s->left_nnz)); AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { for (i = 0; i < 3; i++) for (y = 0; y < 16>>!!i; y++) dst[i][y*curframe->linesize[i]-1] = 129; if (mb_y == 1) s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(prev_frame, mb_y, 0); for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2); decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy, prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS); if (!mb->skip) decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz); if (mb->mode <= MODE_I4x4) intra_predict(s, dst, mb, mb_x, mb_y); else inter_predict(s, dst, mb, mb_x, mb_y); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN); if (!mb->skip) { idct_mb(s, dst, mb); } else { AV_ZERO64(s->left_nnz); AV_WN64(s->top_nnz[mb_x], 0); if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { s->left_nnz[8] = 0; s->top_nnz[mb_x][8] = 0; } } if (s->deblock_filter) filter_level_for_mb(s, mb, &s->filter_strength[mb_x]); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2); dst[0] += 16; dst[1] += 8; dst[2] += 8; s->mv_min.x -= 64; s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) filter_mb_row_simple(s, curframe, mb_y); else filter_mb_row(s, curframe, mb_y); } s->mv_min.y -= 64; s->mv_max.y -= 64; ff_thread_report_progress(curframe, mb_y, 0); } ff_thread_report_progress(curframe, INT_MAX, 0); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); if (!s->invisible) { *(AVFrame*)data = *curframe; *data_size = sizeof(AVFrame); } return avpkt->size; }
{ "code": [ " return ret;", " return ret;", " if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||", " !s->framep[VP56_FRAME_GOLDEN] ||", " !s->framep[VP56_FRAME_GOLDEN2])) {", " av_log(avctx, AV_LOG_WARNING, \"Discarding interframe without a prior keyframe!\\n\");", " return AVERROR_INVALIDDATA;", " memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);" ], "line_no": [ 23, 23, 167, 169, 171, 173, 175, 411 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { VP8Context *s = VAR_0->priv_data; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; enum AVDiscard VAR_10; AVFrame *av_uninit(curframe), *prev_frame; release_queued_segmaps(s, 0); if ((VAR_4 = decode_frame_header(s, VAR_3->VAR_1, VAR_3->size)) < 0) return VAR_4; prev_frame = s->framep[VP56_FRAME_CURRENT]; VAR_9 = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; VAR_10 = !VAR_9 ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (VAR_0->skip_frame >= VAR_10) { s->invisible = 1; goto skip_decode; } s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_10; for (VAR_7 = 0; VAR_7 < 5; VAR_7++) if (s->frames[VAR_7].VAR_1[0] && &s->frames[VAR_7] != prev_frame && &s->frames[VAR_7] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[VAR_7], 1, 0); for (VAR_7 = 0; VAR_7 < 5; VAR_7++) if (&s->frames[VAR_7] != prev_frame && &s->frames[VAR_7] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[VAR_7]; break; } if (VAR_7 == 5) { av_log(VAR_0, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->VAR_1[0]) vp8_release_frame(s, curframe, 1, 0); curframe->key_frame = s->keyframe; curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; curframe->reference = VAR_9 ? 3 : 0; if ((VAR_4 = vp8_alloc_frame(s, curframe))) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed!\n"); return VAR_4; } if (s->update_altref != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; } else { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; } if (s->update_golden != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; } else { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; } if (s->update_last) { s->next_framep[VP56_FRAME_PREVIOUS] = curframe; } else { s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; } s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(VAR_0); if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(VAR_0, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); return AVERROR_INVALIDDATA; } s->linesize = curframe->linesize[0]; s->uvlinesize = curframe->linesize[1]; if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(21*s->linesize); memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks)); if (!(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) { s->top_border[0][15] = s->top_border[0][23] = 127; memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1); } memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); #define MARGIN (16 << 2) s->mv_min.VAR_8 = -MARGIN; s->mv_max.VAR_8 = ((s->mb_height - 1) << 6) + MARGIN; for (VAR_6 = 0; VAR_6 < s->mb_height; VAR_6++) { VP56RangeCoder *c = &s->coeff_partition[VAR_6 & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - VAR_6 - 1)*2; int mb_xy = VAR_6*s->mb_width; uint8_t *dst[3] = { curframe->VAR_1[0] + 16*VAR_6*s->linesize, curframe->VAR_1[1] + 8*VAR_6*s->uvlinesize, curframe->VAR_1[2] + 8*VAR_6*s->uvlinesize }; memset(mb - 1, 0, sizeof(*mb)); memset(s->left_nnz, 0, sizeof(s->left_nnz)); AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); if (!(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) { for (VAR_7 = 0; VAR_7 < 3; VAR_7++) for (VAR_8 = 0; VAR_8 < 16>>!!VAR_7; VAR_8++) dst[VAR_7][VAR_8*curframe->linesize[VAR_7]-1] = 129; if (VAR_6 == 1) s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(prev_frame, VAR_6, 0); for (VAR_5 = 0; VAR_5 < s->mb_width; VAR_5++, mb_xy++, mb++) { s->dsp.prefetch(dst[0] + (VAR_5&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dst[1] + (VAR_5&7)*s->uvlinesize + 64, dst[2] - dst[1], 2); decode_mb_mode(s, mb, VAR_5, VAR_6, curframe->ref_index[0] + mb_xy, prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL); prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_PREVIOUS); if (!mb->skip) decode_mb_coeffs(s, c, mb, s->top_nnz[VAR_5], s->left_nnz); if (mb->mode <= MODE_I4x4) intra_predict(s, dst, mb, VAR_5, VAR_6); else inter_predict(s, dst, mb, VAR_5, VAR_6); prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_GOLDEN); if (!mb->skip) { idct_mb(s, dst, mb); } else { AV_ZERO64(s->left_nnz); AV_WN64(s->top_nnz[VAR_5], 0); if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { s->left_nnz[8] = 0; s->top_nnz[VAR_5][8] = 0; } } if (s->deblock_filter) filter_level_for_mb(s, mb, &s->filter_strength[VAR_5]); prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_GOLDEN2); dst[0] += 16; dst[1] += 8; dst[2] += 8; s->mv_min.x -= 64; s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) filter_mb_row_simple(s, curframe, VAR_6); else filter_mb_row(s, curframe, VAR_6); } s->mv_min.VAR_8 -= 64; s->mv_max.VAR_8 -= 64; ff_thread_report_progress(curframe, VAR_6, 0); } ff_thread_report_progress(curframe, INT_MAX, 0); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); if (!s->invisible) { *(AVFrame*)VAR_1 = *curframe; *VAR_2 = sizeof(AVFrame); } return VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "VP8Context *s = VAR_0->priv_data;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "enum AVDiscard VAR_10;", "AVFrame *av_uninit(curframe), *prev_frame;", "release_queued_segmaps(s, 0);", "if ((VAR_4 = decode_frame_header(s, VAR_3->VAR_1, VAR_3->size)) < 0)\nreturn VAR_4;", "prev_frame = s->framep[VP56_FRAME_CURRENT];", "VAR_9 = s->update_last || s->update_golden == VP56_FRAME_CURRENT\n|| s->update_altref == VP56_FRAME_CURRENT;", "VAR_10 = !VAR_9 ? AVDISCARD_NONREF :\n!s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL;", "if (VAR_0->skip_frame >= VAR_10) {", "s->invisible = 1;", "goto skip_decode;", "}", "s->deblock_filter = s->filter.level && VAR_0->skip_loop_filter < VAR_10;", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "if (s->frames[VAR_7].VAR_1[0] &&\n&s->frames[VAR_7] != prev_frame &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_PREVIOUS] &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN] &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN2])\nvp8_release_frame(s, &s->frames[VAR_7], 1, 0);", "for (VAR_7 = 0; VAR_7 < 5; VAR_7++)", "if (&s->frames[VAR_7] != prev_frame &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_PREVIOUS] &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN] &&\n&s->frames[VAR_7] != s->framep[VP56_FRAME_GOLDEN2]) {", "curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[VAR_7];", "break;", "}", "if (VAR_7 == 5) {", "av_log(VAR_0, AV_LOG_FATAL, \"Ran out of free frames!\\n\");", "abort();", "}", "if (curframe->VAR_1[0])\nvp8_release_frame(s, curframe, 1, 0);", "curframe->key_frame = s->keyframe;", "curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;", "curframe->reference = VAR_9 ? 3 : 0;", "if ((VAR_4 = vp8_alloc_frame(s, curframe))) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed!\\n\");", "return VAR_4;", "}", "if (s->update_altref != VP56_FRAME_NONE) {", "s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref];", "} else {", "s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2];", "}", "if (s->update_golden != VP56_FRAME_NONE) {", "s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden];", "} else {", "s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN];", "}", "if (s->update_last) {", "s->next_framep[VP56_FRAME_PREVIOUS] = curframe;", "} else {", "s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS];", "}", "s->next_framep[VP56_FRAME_CURRENT] = curframe;", "ff_thread_finish_setup(VAR_0);", "if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] ||\n!s->framep[VP56_FRAME_GOLDEN] ||\n!s->framep[VP56_FRAME_GOLDEN2])) {", "av_log(VAR_0, AV_LOG_WARNING, \"Discarding interframe without a prior keyframe!\\n\");", "return AVERROR_INVALIDDATA;", "}", "s->linesize = curframe->linesize[0];", "s->uvlinesize = curframe->linesize[1];", "if (!s->edge_emu_buffer)\ns->edge_emu_buffer = av_malloc(21*s->linesize);", "memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz));", "memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks));", "if (!(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) {", "s->top_border[0][15] = s->top_border[0][23] = 127;", "memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1);", "}", "memset(s->ref_count, 0, sizeof(s->ref_count));", "if (s->keyframe)\nmemset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4);", "#define MARGIN (16 << 2)\ns->mv_min.VAR_8 = -MARGIN;", "s->mv_max.VAR_8 = ((s->mb_height - 1) << 6) + MARGIN;", "for (VAR_6 = 0; VAR_6 < s->mb_height; VAR_6++) {", "VP56RangeCoder *c = &s->coeff_partition[VAR_6 & (s->num_coeff_partitions-1)];", "VP8Macroblock *mb = s->macroblocks + (s->mb_height - VAR_6 - 1)*2;", "int mb_xy = VAR_6*s->mb_width;", "uint8_t *dst[3] = {", "curframe->VAR_1[0] + 16*VAR_6*s->linesize,\ncurframe->VAR_1[1] + 8*VAR_6*s->uvlinesize,\ncurframe->VAR_1[2] + 8*VAR_6*s->uvlinesize\n};", "memset(mb - 1, 0, sizeof(*mb));", "memset(s->left_nnz, 0, sizeof(s->left_nnz));", "AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101);", "if (!(VAR_0->flags & CODEC_FLAG_EMU_EDGE)) {", "for (VAR_7 = 0; VAR_7 < 3; VAR_7++)", "for (VAR_8 = 0; VAR_8 < 16>>!!VAR_7; VAR_8++)", "dst[VAR_7][VAR_8*curframe->linesize[VAR_7]-1] = 129;", "if (VAR_6 == 1)\ns->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129;", "}", "s->mv_min.x = -MARGIN;", "s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;", "if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map)\nff_thread_await_progress(prev_frame, VAR_6, 0);", "for (VAR_5 = 0; VAR_5 < s->mb_width; VAR_5++, mb_xy++, mb++) {", "s->dsp.prefetch(dst[0] + (VAR_5&3)*4*s->linesize + 64, s->linesize, 4);", "s->dsp.prefetch(dst[1] + (VAR_5&7)*s->uvlinesize + 64, dst[2] - dst[1], 2);", "decode_mb_mode(s, mb, VAR_5, VAR_6, curframe->ref_index[0] + mb_xy,\nprev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL);", "prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_PREVIOUS);", "if (!mb->skip)\ndecode_mb_coeffs(s, c, mb, s->top_nnz[VAR_5], s->left_nnz);", "if (mb->mode <= MODE_I4x4)\nintra_predict(s, dst, mb, VAR_5, VAR_6);", "else\ninter_predict(s, dst, mb, VAR_5, VAR_6);", "prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_GOLDEN);", "if (!mb->skip) {", "idct_mb(s, dst, mb);", "} else {", "AV_ZERO64(s->left_nnz);", "AV_WN64(s->top_nnz[VAR_5], 0);", "if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) {", "s->left_nnz[8] = 0;", "s->top_nnz[VAR_5][8] = 0;", "}", "}", "if (s->deblock_filter)\nfilter_level_for_mb(s, mb, &s->filter_strength[VAR_5]);", "prefetch_motion(s, mb, VAR_5, VAR_6, mb_xy, VP56_FRAME_GOLDEN2);", "dst[0] += 16;", "dst[1] += 8;", "dst[2] += 8;", "s->mv_min.x -= 64;", "s->mv_max.x -= 64;", "}", "if (s->deblock_filter) {", "if (s->filter.simple)\nfilter_mb_row_simple(s, curframe, VAR_6);", "else\nfilter_mb_row(s, curframe, VAR_6);", "}", "s->mv_min.VAR_8 -= 64;", "s->mv_max.VAR_8 -= 64;", "ff_thread_report_progress(curframe, VAR_6, 0);", "}", "ff_thread_report_progress(curframe, INT_MAX, 0);", "skip_decode:\nif (!s->update_probabilities)\ns->prob[0] = s->prob[1];", "memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4);", "if (!s->invisible) {", "*(AVFrame*)VAR_1 = *curframe;", "*VAR_2 = sizeof(AVFrame);", "}", "return VAR_3->size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 27 ], [ 31, 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61, 63, 65, 67, 69 ], [ 75 ], [ 77, 79, 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 157 ], [ 167, 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 193 ], [ 199 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 221, 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239, 241, 243, 245 ], [ 249 ], [ 251 ], [ 253 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267, 269 ], [ 271 ], [ 275 ], [ 277 ], [ 279, 281 ], [ 285 ], [ 289 ], [ 291 ], [ 295, 297 ], [ 301 ], [ 305, 307 ], [ 311, 313 ], [ 315, 317 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 351, 353 ], [ 357 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 377 ], [ 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 391 ], [ 393 ], [ 397 ], [ 399, 405, 407 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 425 ], [ 427 ] ]
25,871
static void serial_update_parameters(SerialState *s) { int speed, parity, data_bits, stop_bits, frame_size; QEMUSerialSetParams ssp; if (s->divider == 0) return; /* Start bit. */ frame_size = 1; if (s->lcr & 0x08) { /* Parity bit. */ frame_size++; if (s->lcr & 0x10) parity = 'E'; else parity = 'O'; } else { parity = 'N'; } if (s->lcr & 0x04) stop_bits = 2; else stop_bits = 1; data_bits = (s->lcr & 0x03) + 5; frame_size += data_bits + stop_bits; speed = s->baudbase / s->divider; ssp.speed = speed; ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); DPRINTF("speed=%d parity=%c data=%d stop=%d\n", speed, parity, data_bits, stop_bits); }
true
qemu
3592fe0c919cf27a81d8e9f9b4f269553418bb01
static void serial_update_parameters(SerialState *s) { int speed, parity, data_bits, stop_bits, frame_size; QEMUSerialSetParams ssp; if (s->divider == 0) return; frame_size = 1; if (s->lcr & 0x08) { frame_size++; if (s->lcr & 0x10) parity = 'E'; else parity = 'O'; } else { parity = 'N'; } if (s->lcr & 0x04) stop_bits = 2; else stop_bits = 1; data_bits = (s->lcr & 0x03) + 5; frame_size += data_bits + stop_bits; speed = s->baudbase / s->divider; ssp.speed = speed; ssp.parity = parity; ssp.data_bits = data_bits; ssp.stop_bits = stop_bits; s->char_transmit_time = (NANOSECONDS_PER_SECOND / speed) * frame_size; qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); DPRINTF("speed=%d parity=%c data=%d stop=%d\n", speed, parity, data_bits, stop_bits); }
{ "code": [ " if (s->divider == 0)" ], "line_no": [ 11 ] }
static void FUNC_0(SerialState *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; QEMUSerialSetParams ssp; if (VAR_0->divider == 0) return; VAR_5 = 1; if (VAR_0->lcr & 0x08) { VAR_5++; if (VAR_0->lcr & 0x10) VAR_2 = 'E'; else VAR_2 = 'O'; } else { VAR_2 = 'N'; } if (VAR_0->lcr & 0x04) VAR_4 = 2; else VAR_4 = 1; VAR_3 = (VAR_0->lcr & 0x03) + 5; VAR_5 += VAR_3 + VAR_4; VAR_1 = VAR_0->baudbase / VAR_0->divider; ssp.VAR_1 = VAR_1; ssp.VAR_2 = VAR_2; ssp.VAR_3 = VAR_3; ssp.VAR_4 = VAR_4; VAR_0->char_transmit_time = (NANOSECONDS_PER_SECOND / VAR_1) * VAR_5; qemu_chr_fe_ioctl(VAR_0->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); DPRINTF("VAR_1=%d VAR_2=%c data=%d stop=%d\n", VAR_1, VAR_2, VAR_3, VAR_4); }
[ "static void FUNC_0(SerialState *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "QEMUSerialSetParams ssp;", "if (VAR_0->divider == 0)\nreturn;", "VAR_5 = 1;", "if (VAR_0->lcr & 0x08) {", "VAR_5++;", "if (VAR_0->lcr & 0x10)\nVAR_2 = 'E';", "else\nVAR_2 = 'O';", "} else {", "VAR_2 = 'N';", "}", "if (VAR_0->lcr & 0x04)\nVAR_4 = 2;", "else\nVAR_4 = 1;", "VAR_3 = (VAR_0->lcr & 0x03) + 5;", "VAR_5 += VAR_3 + VAR_4;", "VAR_1 = VAR_0->baudbase / VAR_0->divider;", "ssp.VAR_1 = VAR_1;", "ssp.VAR_2 = VAR_2;", "ssp.VAR_3 = VAR_3;", "ssp.VAR_4 = VAR_4;", "VAR_0->char_transmit_time = (NANOSECONDS_PER_SECOND / VAR_1) * VAR_5;", "qemu_chr_fe_ioctl(VAR_0->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);", "DPRINTF(\"VAR_1=%d VAR_2=%c data=%d stop=%d\\n\",\nVAR_1, VAR_2, VAR_3, VAR_4);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ] ]
25,873
static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16]) { int i, a1, b1, c1, d1; int16_t tmp[16]; for (i = 0; i < 4; i++) { a1 = (dc[i * 4 + 0] + dc[i * 4 + 2]) * 23170; b1 = (dc[i * 4 + 0] - dc[i * 4 + 2]) * 23170; c1 = dc[i * 4 + 1] * 12540 - dc[i * 4 + 3] * 30274; d1 = dc[i * 4 + 1] * 30274 + dc[i * 4 + 3] * 12540; tmp[i * 4 + 0] = (a1 + d1) >> 14; tmp[i * 4 + 3] = (a1 - d1) >> 14; tmp[i * 4 + 1] = (b1 + c1) >> 14; tmp[i * 4 + 2] = (b1 - c1) >> 14; } for (i = 0; i < 4; i++) { a1 = (tmp[i + 0] + tmp[i + 8]) * 23170; b1 = (tmp[i + 0] - tmp[i + 8]) * 23170; c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274; d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540; AV_ZERO64(dc + i * 4); block[0][i][0] = (a1 + d1 + 0x20000) >> 18; block[3][i][0] = (a1 - d1 + 0x20000) >> 18; block[1][i][0] = (b1 + c1 + 0x20000) >> 18; block[2][i][0] = (b1 - c1 + 0x20000) >> 18; } }
true
FFmpeg
ccce2248bf56692fc7bd436ca2c9acca772d486a
static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16]) { int i, a1, b1, c1, d1; int16_t tmp[16]; for (i = 0; i < 4; i++) { a1 = (dc[i * 4 + 0] + dc[i * 4 + 2]) * 23170; b1 = (dc[i * 4 + 0] - dc[i * 4 + 2]) * 23170; c1 = dc[i * 4 + 1] * 12540 - dc[i * 4 + 3] * 30274; d1 = dc[i * 4 + 1] * 30274 + dc[i * 4 + 3] * 12540; tmp[i * 4 + 0] = (a1 + d1) >> 14; tmp[i * 4 + 3] = (a1 - d1) >> 14; tmp[i * 4 + 1] = (b1 + c1) >> 14; tmp[i * 4 + 2] = (b1 - c1) >> 14; } for (i = 0; i < 4; i++) { a1 = (tmp[i + 0] + tmp[i + 8]) * 23170; b1 = (tmp[i + 0] - tmp[i + 8]) * 23170; c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274; d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540; AV_ZERO64(dc + i * 4); block[0][i][0] = (a1 + d1 + 0x20000) >> 18; block[3][i][0] = (a1 - d1 + 0x20000) >> 18; block[1][i][0] = (b1 + c1 + 0x20000) >> 18; block[2][i][0] = (b1 - c1 + 0x20000) >> 18; } }
{ "code": [ " int i, a1, b1, c1, d1;", " tmp[i * 4 + 0] = (a1 + d1) >> 14;", " tmp[i * 4 + 3] = (a1 - d1) >> 14;", " tmp[i * 4 + 1] = (b1 + c1) >> 14;", " tmp[i * 4 + 2] = (b1 - c1) >> 14;", " block[0][i][0] = (a1 + d1 + 0x20000) >> 18;", " block[3][i][0] = (a1 - d1 + 0x20000) >> 18;", " block[1][i][0] = (b1 + c1 + 0x20000) >> 18;", " block[2][i][0] = (b1 - c1 + 0x20000) >> 18;" ], "line_no": [ 5, 21, 23, 25, 27, 45, 47, 49, 51 ] }
static void FUNC_0(int16_t VAR_0[4][4][16], int16_t VAR_1[16]) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int16_t tmp[16]; for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_3 = (VAR_1[VAR_2 * 4 + 0] + VAR_1[VAR_2 * 4 + 2]) * 23170; VAR_4 = (VAR_1[VAR_2 * 4 + 0] - VAR_1[VAR_2 * 4 + 2]) * 23170; VAR_5 = VAR_1[VAR_2 * 4 + 1] * 12540 - VAR_1[VAR_2 * 4 + 3] * 30274; VAR_6 = VAR_1[VAR_2 * 4 + 1] * 30274 + VAR_1[VAR_2 * 4 + 3] * 12540; tmp[VAR_2 * 4 + 0] = (VAR_3 + VAR_6) >> 14; tmp[VAR_2 * 4 + 3] = (VAR_3 - VAR_6) >> 14; tmp[VAR_2 * 4 + 1] = (VAR_4 + VAR_5) >> 14; tmp[VAR_2 * 4 + 2] = (VAR_4 - VAR_5) >> 14; } for (VAR_2 = 0; VAR_2 < 4; VAR_2++) { VAR_3 = (tmp[VAR_2 + 0] + tmp[VAR_2 + 8]) * 23170; VAR_4 = (tmp[VAR_2 + 0] - tmp[VAR_2 + 8]) * 23170; VAR_5 = tmp[VAR_2 + 4] * 12540 - tmp[VAR_2 + 12] * 30274; VAR_6 = tmp[VAR_2 + 4] * 30274 + tmp[VAR_2 + 12] * 12540; AV_ZERO64(VAR_1 + VAR_2 * 4); VAR_0[0][VAR_2][0] = (VAR_3 + VAR_6 + 0x20000) >> 18; VAR_0[3][VAR_2][0] = (VAR_3 - VAR_6 + 0x20000) >> 18; VAR_0[1][VAR_2][0] = (VAR_4 + VAR_5 + 0x20000) >> 18; VAR_0[2][VAR_2][0] = (VAR_4 - VAR_5 + 0x20000) >> 18; } }
[ "static void FUNC_0(int16_t VAR_0[4][4][16], int16_t VAR_1[16])\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int16_t tmp[16];", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_3 = (VAR_1[VAR_2 * 4 + 0] + VAR_1[VAR_2 * 4 + 2]) * 23170;", "VAR_4 = (VAR_1[VAR_2 * 4 + 0] - VAR_1[VAR_2 * 4 + 2]) * 23170;", "VAR_5 = VAR_1[VAR_2 * 4 + 1] * 12540 - VAR_1[VAR_2 * 4 + 3] * 30274;", "VAR_6 = VAR_1[VAR_2 * 4 + 1] * 30274 + VAR_1[VAR_2 * 4 + 3] * 12540;", "tmp[VAR_2 * 4 + 0] = (VAR_3 + VAR_6) >> 14;", "tmp[VAR_2 * 4 + 3] = (VAR_3 - VAR_6) >> 14;", "tmp[VAR_2 * 4 + 1] = (VAR_4 + VAR_5) >> 14;", "tmp[VAR_2 * 4 + 2] = (VAR_4 - VAR_5) >> 14;", "}", "for (VAR_2 = 0; VAR_2 < 4; VAR_2++) {", "VAR_3 = (tmp[VAR_2 + 0] + tmp[VAR_2 + 8]) * 23170;", "VAR_4 = (tmp[VAR_2 + 0] - tmp[VAR_2 + 8]) * 23170;", "VAR_5 = tmp[VAR_2 + 4] * 12540 - tmp[VAR_2 + 12] * 30274;", "VAR_6 = tmp[VAR_2 + 4] * 30274 + tmp[VAR_2 + 12] * 12540;", "AV_ZERO64(VAR_1 + VAR_2 * 4);", "VAR_0[0][VAR_2][0] = (VAR_3 + VAR_6 + 0x20000) >> 18;", "VAR_0[3][VAR_2][0] = (VAR_3 - VAR_6 + 0x20000) >> 18;", "VAR_0[1][VAR_2][0] = (VAR_4 + VAR_5 + 0x20000) >> 18;", "VAR_0[2][VAR_2][0] = (VAR_4 - VAR_5 + 0x20000) >> 18;", "}", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
25,874
static void generate_noise(G723_1_Context *p) { int i, j, idx, t; int off[SUBFRAMES]; int signs[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11]; int tmp[SUBFRAME_LEN * 2]; int16_t *vector_ptr; int64_t sum; int b0, c, delta, x, shift; p->pitch_lag[0] = cng_rand(&p->cng_random_seed, 21) + 123; p->pitch_lag[1] = cng_rand(&p->cng_random_seed, 19) + 123; for (i = 0; i < SUBFRAMES; i++) { p->subframe[i].ad_cb_gain = cng_rand(&p->cng_random_seed, 50) + 1; p->subframe[i].ad_cb_lag = cng_adaptive_cb_lag[i]; } for (i = 0; i < SUBFRAMES / 2; i++) { t = cng_rand(&p->cng_random_seed, 1 << 13); off[i * 2] = t & 1; off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN; t >>= 2; for (j = 0; j < 11; j++) { signs[i * 11 + j] = (t & 1) * 2 - 1 << 14; t >>= 1; } } idx = 0; for (i = 0; i < SUBFRAMES; i++) { for (j = 0; j < SUBFRAME_LEN / 2; j++) tmp[j] = j; t = SUBFRAME_LEN / 2; for (j = 0; j < pulses[i]; j++, idx++) { int idx2 = cng_rand(&p->cng_random_seed, t); pos[idx] = tmp[idx2] * 2 + off[i]; tmp[idx2] = tmp[--t]; } } vector_ptr = p->audio + LPC_ORDER; memcpy(vector_ptr, p->prev_excitation, PITCH_MAX * sizeof(*p->excitation)); for (i = 0; i < SUBFRAMES; i += 2) { ff_g723_1_gen_acb_excitation(vector_ptr, vector_ptr, p->pitch_lag[i >> 1], &p->subframe[i], p->cur_rate); ff_g723_1_gen_acb_excitation(vector_ptr + SUBFRAME_LEN, vector_ptr + SUBFRAME_LEN, p->pitch_lag[i >> 1], &p->subframe[i + 1], p->cur_rate); t = 0; for (j = 0; j < SUBFRAME_LEN * 2; j++) t |= FFABS(vector_ptr[j]); t = FFMIN(t, 0x7FFF); if (!t) { shift = 0; } else { shift = -10 + av_log2(t); if (shift < -2) shift = -2; } sum = 0; if (shift < 0) { for (j = 0; j < SUBFRAME_LEN * 2; j++) { t = vector_ptr[j] << -shift; sum += t * t; tmp[j] = t; } } else { for (j = 0; j < SUBFRAME_LEN * 2; j++) { t = vector_ptr[j] >> shift; sum += t * t; tmp[j] = t; } } b0 = 0; for (j = 0; j < 11; j++) b0 += tmp[pos[(i / 2) * 11 + j]] * signs[(i / 2) * 11 + j]; b0 = b0 * 2 * 2979LL + (1 << 29) >> 30; // approximated division by 11 c = p->cur_gain * (p->cur_gain * SUBFRAME_LEN >> 5); if (shift * 2 + 3 >= 0) c >>= shift * 2 + 3; else c <<= -(shift * 2 + 3); c = (av_clipl_int32(sum << 1) - c) * 2979LL >> 15; delta = b0 * b0 * 2 - c; if (delta <= 0) { x = -b0; } else { delta = square_root(delta); x = delta - b0; t = delta + b0; if (FFABS(t) < FFABS(x)) x = -t; } shift++; if (shift < 0) x >>= -shift; else x <<= shift; x = av_clip(x, -10000, 10000); for (j = 0; j < 11; j++) { idx = (i / 2) * 11 + j; vector_ptr[pos[idx]] = av_clip_int16(vector_ptr[pos[idx]] + (x * signs[idx] >> 15)); } /* copy decoded data to serve as a history for the next decoded subframes */ memcpy(vector_ptr + PITCH_MAX, vector_ptr, sizeof(*vector_ptr) * SUBFRAME_LEN * 2); vector_ptr += SUBFRAME_LEN * 2; } /* Save the excitation for the next frame */ memcpy(p->prev_excitation, p->audio + LPC_ORDER + FRAME_LEN, PITCH_MAX * sizeof(*p->excitation)); }
true
FFmpeg
d3088e0fd8749788818cb5df92abaa3b12e409e1
static void generate_noise(G723_1_Context *p) { int i, j, idx, t; int off[SUBFRAMES]; int signs[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11]; int tmp[SUBFRAME_LEN * 2]; int16_t *vector_ptr; int64_t sum; int b0, c, delta, x, shift; p->pitch_lag[0] = cng_rand(&p->cng_random_seed, 21) + 123; p->pitch_lag[1] = cng_rand(&p->cng_random_seed, 19) + 123; for (i = 0; i < SUBFRAMES; i++) { p->subframe[i].ad_cb_gain = cng_rand(&p->cng_random_seed, 50) + 1; p->subframe[i].ad_cb_lag = cng_adaptive_cb_lag[i]; } for (i = 0; i < SUBFRAMES / 2; i++) { t = cng_rand(&p->cng_random_seed, 1 << 13); off[i * 2] = t & 1; off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN; t >>= 2; for (j = 0; j < 11; j++) { signs[i * 11 + j] = (t & 1) * 2 - 1 << 14; t >>= 1; } } idx = 0; for (i = 0; i < SUBFRAMES; i++) { for (j = 0; j < SUBFRAME_LEN / 2; j++) tmp[j] = j; t = SUBFRAME_LEN / 2; for (j = 0; j < pulses[i]; j++, idx++) { int idx2 = cng_rand(&p->cng_random_seed, t); pos[idx] = tmp[idx2] * 2 + off[i]; tmp[idx2] = tmp[--t]; } } vector_ptr = p->audio + LPC_ORDER; memcpy(vector_ptr, p->prev_excitation, PITCH_MAX * sizeof(*p->excitation)); for (i = 0; i < SUBFRAMES; i += 2) { ff_g723_1_gen_acb_excitation(vector_ptr, vector_ptr, p->pitch_lag[i >> 1], &p->subframe[i], p->cur_rate); ff_g723_1_gen_acb_excitation(vector_ptr + SUBFRAME_LEN, vector_ptr + SUBFRAME_LEN, p->pitch_lag[i >> 1], &p->subframe[i + 1], p->cur_rate); t = 0; for (j = 0; j < SUBFRAME_LEN * 2; j++) t |= FFABS(vector_ptr[j]); t = FFMIN(t, 0x7FFF); if (!t) { shift = 0; } else { shift = -10 + av_log2(t); if (shift < -2) shift = -2; } sum = 0; if (shift < 0) { for (j = 0; j < SUBFRAME_LEN * 2; j++) { t = vector_ptr[j] << -shift; sum += t * t; tmp[j] = t; } } else { for (j = 0; j < SUBFRAME_LEN * 2; j++) { t = vector_ptr[j] >> shift; sum += t * t; tmp[j] = t; } } b0 = 0; for (j = 0; j < 11; j++) b0 += tmp[pos[(i / 2) * 11 + j]] * signs[(i / 2) * 11 + j]; b0 = b0 * 2 * 2979LL + (1 << 29) >> 30; c = p->cur_gain * (p->cur_gain * SUBFRAME_LEN >> 5); if (shift * 2 + 3 >= 0) c >>= shift * 2 + 3; else c <<= -(shift * 2 + 3); c = (av_clipl_int32(sum << 1) - c) * 2979LL >> 15; delta = b0 * b0 * 2 - c; if (delta <= 0) { x = -b0; } else { delta = square_root(delta); x = delta - b0; t = delta + b0; if (FFABS(t) < FFABS(x)) x = -t; } shift++; if (shift < 0) x >>= -shift; else x <<= shift; x = av_clip(x, -10000, 10000); for (j = 0; j < 11; j++) { idx = (i / 2) * 11 + j; vector_ptr[pos[idx]] = av_clip_int16(vector_ptr[pos[idx]] + (x * signs[idx] >> 15)); } memcpy(vector_ptr + PITCH_MAX, vector_ptr, sizeof(*vector_ptr) * SUBFRAME_LEN * 2); vector_ptr += SUBFRAME_LEN * 2; } memcpy(p->prev_excitation, p->audio + LPC_ORDER + FRAME_LEN, PITCH_MAX * sizeof(*p->excitation)); }
{ "code": [ " signs[i * 11 + j] = (t & 1) * 2 - 1 << 14;", " t = vector_ptr[j] << -shift;", " x <<= shift;" ], "line_no": [ 49, 137, 213 ] }
static void FUNC_0(G723_1_Context *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; int VAR_5[SUBFRAMES]; int VAR_6[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11]; int VAR_7[SUBFRAME_LEN * 2]; int16_t *vector_ptr; int64_t sum; int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12; VAR_0->pitch_lag[0] = cng_rand(&VAR_0->cng_random_seed, 21) + 123; VAR_0->pitch_lag[1] = cng_rand(&VAR_0->cng_random_seed, 19) + 123; for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1++) { VAR_0->subframe[VAR_1].ad_cb_gain = cng_rand(&VAR_0->cng_random_seed, 50) + 1; VAR_0->subframe[VAR_1].ad_cb_lag = cng_adaptive_cb_lag[VAR_1]; } for (VAR_1 = 0; VAR_1 < SUBFRAMES / 2; VAR_1++) { VAR_4 = cng_rand(&VAR_0->cng_random_seed, 1 << 13); VAR_5[VAR_1 * 2] = VAR_4 & 1; VAR_5[VAR_1 * 2 + 1] = ((VAR_4 >> 1) & 1) + SUBFRAME_LEN; VAR_4 >>= 2; for (VAR_2 = 0; VAR_2 < 11; VAR_2++) { VAR_6[VAR_1 * 11 + VAR_2] = (VAR_4 & 1) * 2 - 1 << 14; VAR_4 >>= 1; } } VAR_3 = 0; for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1++) { for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN / 2; VAR_2++) VAR_7[VAR_2] = VAR_2; VAR_4 = SUBFRAME_LEN / 2; for (VAR_2 = 0; VAR_2 < pulses[VAR_1]; VAR_2++, VAR_3++) { int idx2 = cng_rand(&VAR_0->cng_random_seed, VAR_4); pos[VAR_3] = VAR_7[idx2] * 2 + VAR_5[VAR_1]; VAR_7[idx2] = VAR_7[--VAR_4]; } } vector_ptr = VAR_0->audio + LPC_ORDER; memcpy(vector_ptr, VAR_0->prev_excitation, PITCH_MAX * sizeof(*VAR_0->excitation)); for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1 += 2) { ff_g723_1_gen_acb_excitation(vector_ptr, vector_ptr, VAR_0->pitch_lag[VAR_1 >> 1], &VAR_0->subframe[VAR_1], VAR_0->cur_rate); ff_g723_1_gen_acb_excitation(vector_ptr + SUBFRAME_LEN, vector_ptr + SUBFRAME_LEN, VAR_0->pitch_lag[VAR_1 >> 1], &VAR_0->subframe[VAR_1 + 1], VAR_0->cur_rate); VAR_4 = 0; for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++) VAR_4 |= FFABS(vector_ptr[VAR_2]); VAR_4 = FFMIN(VAR_4, 0x7FFF); if (!VAR_4) { VAR_12 = 0; } else { VAR_12 = -10 + av_log2(VAR_4); if (VAR_12 < -2) VAR_12 = -2; } sum = 0; if (VAR_12 < 0) { for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++) { VAR_4 = vector_ptr[VAR_2] << -VAR_12; sum += VAR_4 * VAR_4; VAR_7[VAR_2] = VAR_4; } } else { for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++) { VAR_4 = vector_ptr[VAR_2] >> VAR_12; sum += VAR_4 * VAR_4; VAR_7[VAR_2] = VAR_4; } } VAR_8 = 0; for (VAR_2 = 0; VAR_2 < 11; VAR_2++) VAR_8 += VAR_7[pos[(VAR_1 / 2) * 11 + VAR_2]] * VAR_6[(VAR_1 / 2) * 11 + VAR_2]; VAR_8 = VAR_8 * 2 * 2979LL + (1 << 29) >> 30; VAR_9 = VAR_0->cur_gain * (VAR_0->cur_gain * SUBFRAME_LEN >> 5); if (VAR_12 * 2 + 3 >= 0) VAR_9 >>= VAR_12 * 2 + 3; else VAR_9 <<= -(VAR_12 * 2 + 3); VAR_9 = (av_clipl_int32(sum << 1) - VAR_9) * 2979LL >> 15; VAR_10 = VAR_8 * VAR_8 * 2 - VAR_9; if (VAR_10 <= 0) { VAR_11 = -VAR_8; } else { VAR_10 = square_root(VAR_10); VAR_11 = VAR_10 - VAR_8; VAR_4 = VAR_10 + VAR_8; if (FFABS(VAR_4) < FFABS(VAR_11)) VAR_11 = -VAR_4; } VAR_12++; if (VAR_12 < 0) VAR_11 >>= -VAR_12; else VAR_11 <<= VAR_12; VAR_11 = av_clip(VAR_11, -10000, 10000); for (VAR_2 = 0; VAR_2 < 11; VAR_2++) { VAR_3 = (VAR_1 / 2) * 11 + VAR_2; vector_ptr[pos[VAR_3]] = av_clip_int16(vector_ptr[pos[VAR_3]] + (VAR_11 * VAR_6[VAR_3] >> 15)); } memcpy(vector_ptr + PITCH_MAX, vector_ptr, sizeof(*vector_ptr) * SUBFRAME_LEN * 2); vector_ptr += SUBFRAME_LEN * 2; } memcpy(VAR_0->prev_excitation, VAR_0->audio + LPC_ORDER + FRAME_LEN, PITCH_MAX * sizeof(*VAR_0->excitation)); }
[ "static void FUNC_0(G723_1_Context *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "int VAR_5[SUBFRAMES];", "int VAR_6[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11];", "int VAR_7[SUBFRAME_LEN * 2];", "int16_t *vector_ptr;", "int64_t sum;", "int VAR_8, VAR_9, VAR_10, VAR_11, VAR_12;", "VAR_0->pitch_lag[0] = cng_rand(&VAR_0->cng_random_seed, 21) + 123;", "VAR_0->pitch_lag[1] = cng_rand(&VAR_0->cng_random_seed, 19) + 123;", "for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1++) {", "VAR_0->subframe[VAR_1].ad_cb_gain = cng_rand(&VAR_0->cng_random_seed, 50) + 1;", "VAR_0->subframe[VAR_1].ad_cb_lag = cng_adaptive_cb_lag[VAR_1];", "}", "for (VAR_1 = 0; VAR_1 < SUBFRAMES / 2; VAR_1++) {", "VAR_4 = cng_rand(&VAR_0->cng_random_seed, 1 << 13);", "VAR_5[VAR_1 * 2] = VAR_4 & 1;", "VAR_5[VAR_1 * 2 + 1] = ((VAR_4 >> 1) & 1) + SUBFRAME_LEN;", "VAR_4 >>= 2;", "for (VAR_2 = 0; VAR_2 < 11; VAR_2++) {", "VAR_6[VAR_1 * 11 + VAR_2] = (VAR_4 & 1) * 2 - 1 << 14;", "VAR_4 >>= 1;", "}", "}", "VAR_3 = 0;", "for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN / 2; VAR_2++)", "VAR_7[VAR_2] = VAR_2;", "VAR_4 = SUBFRAME_LEN / 2;", "for (VAR_2 = 0; VAR_2 < pulses[VAR_1]; VAR_2++, VAR_3++) {", "int idx2 = cng_rand(&VAR_0->cng_random_seed, VAR_4);", "pos[VAR_3] = VAR_7[idx2] * 2 + VAR_5[VAR_1];", "VAR_7[idx2] = VAR_7[--VAR_4];", "}", "}", "vector_ptr = VAR_0->audio + LPC_ORDER;", "memcpy(vector_ptr, VAR_0->prev_excitation,\nPITCH_MAX * sizeof(*VAR_0->excitation));", "for (VAR_1 = 0; VAR_1 < SUBFRAMES; VAR_1 += 2) {", "ff_g723_1_gen_acb_excitation(vector_ptr, vector_ptr,\nVAR_0->pitch_lag[VAR_1 >> 1], &VAR_0->subframe[VAR_1],\nVAR_0->cur_rate);", "ff_g723_1_gen_acb_excitation(vector_ptr + SUBFRAME_LEN,\nvector_ptr + SUBFRAME_LEN,\nVAR_0->pitch_lag[VAR_1 >> 1], &VAR_0->subframe[VAR_1 + 1],\nVAR_0->cur_rate);", "VAR_4 = 0;", "for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++)", "VAR_4 |= FFABS(vector_ptr[VAR_2]);", "VAR_4 = FFMIN(VAR_4, 0x7FFF);", "if (!VAR_4) {", "VAR_12 = 0;", "} else {", "VAR_12 = -10 + av_log2(VAR_4);", "if (VAR_12 < -2)\nVAR_12 = -2;", "}", "sum = 0;", "if (VAR_12 < 0) {", "for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++) {", "VAR_4 = vector_ptr[VAR_2] << -VAR_12;", "sum += VAR_4 * VAR_4;", "VAR_7[VAR_2] = VAR_4;", "}", "} else {", "for (VAR_2 = 0; VAR_2 < SUBFRAME_LEN * 2; VAR_2++) {", "VAR_4 = vector_ptr[VAR_2] >> VAR_12;", "sum += VAR_4 * VAR_4;", "VAR_7[VAR_2] = VAR_4;", "}", "}", "VAR_8 = 0;", "for (VAR_2 = 0; VAR_2 < 11; VAR_2++)", "VAR_8 += VAR_7[pos[(VAR_1 / 2) * 11 + VAR_2]] * VAR_6[(VAR_1 / 2) * 11 + VAR_2];", "VAR_8 = VAR_8 * 2 * 2979LL + (1 << 29) >> 30;", "VAR_9 = VAR_0->cur_gain * (VAR_0->cur_gain * SUBFRAME_LEN >> 5);", "if (VAR_12 * 2 + 3 >= 0)\nVAR_9 >>= VAR_12 * 2 + 3;", "else\nVAR_9 <<= -(VAR_12 * 2 + 3);", "VAR_9 = (av_clipl_int32(sum << 1) - VAR_9) * 2979LL >> 15;", "VAR_10 = VAR_8 * VAR_8 * 2 - VAR_9;", "if (VAR_10 <= 0) {", "VAR_11 = -VAR_8;", "} else {", "VAR_10 = square_root(VAR_10);", "VAR_11 = VAR_10 - VAR_8;", "VAR_4 = VAR_10 + VAR_8;", "if (FFABS(VAR_4) < FFABS(VAR_11))\nVAR_11 = -VAR_4;", "}", "VAR_12++;", "if (VAR_12 < 0)\nVAR_11 >>= -VAR_12;", "else\nVAR_11 <<= VAR_12;", "VAR_11 = av_clip(VAR_11, -10000, 10000);", "for (VAR_2 = 0; VAR_2 < 11; VAR_2++) {", "VAR_3 = (VAR_1 / 2) * 11 + VAR_2;", "vector_ptr[pos[VAR_3]] = av_clip_int16(vector_ptr[pos[VAR_3]] +\n(VAR_11 * VAR_6[VAR_3] >> 15));", "}", "memcpy(vector_ptr + PITCH_MAX, vector_ptr,\nsizeof(*vector_ptr) * SUBFRAME_LEN * 2);", "vector_ptr += SUBFRAME_LEN * 2;", "}", "memcpy(VAR_0->prev_excitation, VAR_0->audio + LPC_ORDER + FRAME_LEN,\nPITCH_MAX * sizeof(*VAR_0->excitation));", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93, 95, 97 ], [ 99, 101, 103, 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173, 175 ], [ 177, 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211, 213 ], [ 215 ], [ 219 ], [ 221 ], [ 223, 225 ], [ 227 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 243, 245 ], [ 247 ] ]
25,875
struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **errp) { GuestFileHandle *gfh = guest_file_handle_find(handle, errp); GuestFileRead *read_data = NULL; guchar *buf; FILE *fh; size_t read_count; if (!gfh) { return NULL; } if (!has_count) { count = QGA_READ_COUNT_DEFAULT; } else if (count < 0) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); return NULL; } fh = gfh->fh; buf = g_malloc0(count+1); read_count = fread(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to read file"); slog("guest-file-read failed, handle: %" PRId64, handle); } else { buf[read_count] = 0; read_data = g_malloc0(sizeof(GuestFileRead)); read_data->count = read_count; read_data->eof = feof(fh); if (read_count) { read_data->buf_b64 = g_base64_encode(buf, read_count); } } g_free(buf); clearerr(fh); return read_data; }
true
qemu
f3a06403b82c7f036564e4caf18b52ce6885fcfb
struct GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, int64_t count, Error **errp) { GuestFileHandle *gfh = guest_file_handle_find(handle, errp); GuestFileRead *read_data = NULL; guchar *buf; FILE *fh; size_t read_count; if (!gfh) { return NULL; } if (!has_count) { count = QGA_READ_COUNT_DEFAULT; } else if (count < 0) { error_setg(errp, "value '%" PRId64 "' is invalid for argument count", count); return NULL; } fh = gfh->fh; buf = g_malloc0(count+1); read_count = fread(buf, 1, count, fh); if (ferror(fh)) { error_setg_errno(errp, errno, "failed to read file"); slog("guest-file-read failed, handle: %" PRId64, handle); } else { buf[read_count] = 0; read_data = g_malloc0(sizeof(GuestFileRead)); read_data->count = read_count; read_data->eof = feof(fh); if (read_count) { read_data->buf_b64 = g_base64_encode(buf, read_count); } } g_free(buf); clearerr(fh); return read_data; }
{ "code": [ " read_data = g_malloc0(sizeof(GuestFileRead));", " read_data = g_malloc0(sizeof(GuestFileRead));" ], "line_no": [ 59, 59 ] }
struct GuestFileRead *FUNC_0(int64_t VAR_0, bool VAR_1, int64_t VAR_2, Error **VAR_3) { GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_3); GuestFileRead *VAR_4 = NULL; guchar *buf; FILE *fh; size_t read_count; if (!gfh) { return NULL; } if (!VAR_1) { VAR_2 = QGA_READ_COUNT_DEFAULT; } else if (VAR_2 < 0) { error_setg(VAR_3, "value '%" PRId64 "' is invalid for argument VAR_2", VAR_2); return NULL; } fh = gfh->fh; buf = g_malloc0(VAR_2+1); read_count = fread(buf, 1, VAR_2, fh); if (ferror(fh)) { error_setg_errno(VAR_3, errno, "failed to read file"); slog("guest-file-read failed, VAR_0: %" PRId64, VAR_0); } else { buf[read_count] = 0; VAR_4 = g_malloc0(sizeof(GuestFileRead)); VAR_4->VAR_2 = read_count; VAR_4->eof = feof(fh); if (read_count) { VAR_4->buf_b64 = g_base64_encode(buf, read_count); } } g_free(buf); clearerr(fh); return VAR_4; }
[ "struct GuestFileRead *FUNC_0(int64_t VAR_0, bool VAR_1,\nint64_t VAR_2, Error **VAR_3)\n{", "GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_3);", "GuestFileRead *VAR_4 = NULL;", "guchar *buf;", "FILE *fh;", "size_t read_count;", "if (!gfh) {", "return NULL;", "}", "if (!VAR_1) {", "VAR_2 = QGA_READ_COUNT_DEFAULT;", "} else if (VAR_2 < 0) {", "error_setg(VAR_3, \"value '%\" PRId64 \"' is invalid for argument VAR_2\",\nVAR_2);", "return NULL;", "}", "fh = gfh->fh;", "buf = g_malloc0(VAR_2+1);", "read_count = fread(buf, 1, VAR_2, fh);", "if (ferror(fh)) {", "error_setg_errno(VAR_3, errno, \"failed to read file\");", "slog(\"guest-file-read failed, VAR_0: %\" PRId64, VAR_0);", "} else {", "buf[read_count] = 0;", "VAR_4 = g_malloc0(sizeof(GuestFileRead));", "VAR_4->VAR_2 = read_count;", "VAR_4->eof = feof(fh);", "if (read_count) {", "VAR_4->buf_b64 = g_base64_encode(buf, read_count);", "}", "}", "g_free(buf);", "clearerr(fh);", "return VAR_4;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
25,876
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, int is_read) { BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, is_read); VirtIOBlock *s = req->dev; if (action == BLOCK_ERR_IGNORE) { bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read); return 0; } if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC) || action == BLOCK_ERR_STOP_ANY) { req->next = s->rq; s->rq = req; bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read); vm_stop(0); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read); } return 1; }
true
qemu
908bb9497bcb5543930cc345326afff939a6ffa4
static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, int is_read) { BlockInterfaceErrorAction action = drive_get_on_error(req->dev->bs, is_read); VirtIOBlock *s = req->dev; if (action == BLOCK_ERR_IGNORE) { bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read); return 0; } if ((error == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC) || action == BLOCK_ERR_STOP_ANY) { req->next = s->rq; s->rq = req; bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read); vm_stop(0); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read); } return 1; }
{ "code": [ " bdrv_mon_event(req->dev->bs, BDRV_ACTION_IGNORE, is_read);", " bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read);", " bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read);" ], "line_no": [ 17, 33, 41 ] }
static int FUNC_0(VirtIOBlockReq *VAR_0, int VAR_1, int VAR_2) { BlockInterfaceErrorAction action = drive_get_on_error(VAR_0->dev->bs, VAR_2); VirtIOBlock *s = VAR_0->dev; if (action == BLOCK_ERR_IGNORE) { bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_IGNORE, VAR_2); return 0; } if ((VAR_1 == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC) || action == BLOCK_ERR_STOP_ANY) { VAR_0->next = s->rq; s->rq = VAR_0; bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_STOP, VAR_2); vm_stop(0); } else { virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR); bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_REPORT, VAR_2); } return 1; }
[ "static int FUNC_0(VirtIOBlockReq *VAR_0, int VAR_1,\nint VAR_2)\n{", "BlockInterfaceErrorAction action =\ndrive_get_on_error(VAR_0->dev->bs, VAR_2);", "VirtIOBlock *s = VAR_0->dev;", "if (action == BLOCK_ERR_IGNORE) {", "bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_IGNORE, VAR_2);", "return 0;", "}", "if ((VAR_1 == ENOSPC && action == BLOCK_ERR_STOP_ENOSPC)\n|| action == BLOCK_ERR_STOP_ANY) {", "VAR_0->next = s->rq;", "s->rq = VAR_0;", "bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_STOP, VAR_2);", "vm_stop(0);", "} else {", "virtio_blk_req_complete(VAR_0, VIRTIO_BLK_S_IOERR);", "bdrv_mon_event(VAR_0->dev->bs, BDRV_ACTION_REPORT, VAR_2);", "}", "return 1;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ] ]
25,877
int av_read_pause(AVFormatContext *s) { if (s->iformat->read_pause) return s->iformat->read_pause(s); if (s->pb && s->pb->read_pause) return av_url_read_fpause(s->pb, 1); return AVERROR(ENOSYS); }
false
FFmpeg
fd2982a0a01942091b2f08e17486ff4562f675a6
int av_read_pause(AVFormatContext *s) { if (s->iformat->read_pause) return s->iformat->read_pause(s); if (s->pb && s->pb->read_pause) return av_url_read_fpause(s->pb, 1); return AVERROR(ENOSYS); }
{ "code": [], "line_no": [] }
int FUNC_0(AVFormatContext *VAR_0) { if (VAR_0->iformat->read_pause) return VAR_0->iformat->read_pause(VAR_0); if (VAR_0->pb && VAR_0->pb->read_pause) return av_url_read_fpause(VAR_0->pb, 1); return AVERROR(ENOSYS); }
[ "int FUNC_0(AVFormatContext *VAR_0)\n{", "if (VAR_0->iformat->read_pause)\nreturn VAR_0->iformat->read_pause(VAR_0);", "if (VAR_0->pb && VAR_0->pb->read_pause)\nreturn av_url_read_fpause(VAR_0->pb, 1);", "return AVERROR(ENOSYS);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ] ]
25,878
static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; struct iscsi_data data; IscsiAIOCB *acb; acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); acb->iscsilun = iscsilun; acb->bh = NULL; acb->status = -EINPROGRESS; acb->buf = NULL; acb->ioh = buf; if (req != SG_IO) { iscsi_ioctl_handle_emulated(acb, req, buf); return &acb->common; acb->task = malloc(sizeof(struct scsi_task)); if (acb->task == NULL) { error_report("iSCSI: Failed to allocate task for scsi command. %s", iscsi_get_error(iscsi)); memset(acb->task, 0, sizeof(struct scsi_task)); switch (acb->ioh->dxfer_direction) { case SG_DXFER_TO_DEV: acb->task->xfer_dir = SCSI_XFER_WRITE; break; case SG_DXFER_FROM_DEV: acb->task->xfer_dir = SCSI_XFER_READ; break; default: acb->task->xfer_dir = SCSI_XFER_NONE; break; acb->task->cdb_size = acb->ioh->cmd_len; memcpy(&acb->task->cdb[0], acb->ioh->cmdp, acb->ioh->cmd_len); acb->task->expxferlen = acb->ioh->dxfer_len; data.size = 0; if (acb->task->xfer_dir == SCSI_XFER_WRITE) { if (acb->ioh->iovec_count == 0) { data.data = acb->ioh->dxferp; data.size = acb->ioh->dxfer_len; } else { scsi_task_set_iov_out(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task, iscsi_aio_ioctl_cb, (data.size > 0) ? &data : NULL, acb) != 0) { scsi_free_scsi_task(acb->task); /* tell libiscsi to read straight into the buffer we got from ioctl */ if (acb->task->xfer_dir == SCSI_XFER_READ) { if (acb->ioh->iovec_count == 0) { scsi_task_add_data_in_buffer(acb->task, acb->ioh->dxfer_len, acb->ioh->dxferp); } else { scsi_task_set_iov_in(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); iscsi_set_events(iscsilun); return &acb->common;
true
qemu
a6b3167fa0e825aebb5a7cd8b437b6d41584a196
static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; struct iscsi_data data; IscsiAIOCB *acb; acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); acb->iscsilun = iscsilun; acb->bh = NULL; acb->status = -EINPROGRESS; acb->buf = NULL; acb->ioh = buf; if (req != SG_IO) { iscsi_ioctl_handle_emulated(acb, req, buf); return &acb->common; acb->task = malloc(sizeof(struct scsi_task)); if (acb->task == NULL) { error_report("iSCSI: Failed to allocate task for scsi command. %s", iscsi_get_error(iscsi)); memset(acb->task, 0, sizeof(struct scsi_task)); switch (acb->ioh->dxfer_direction) { case SG_DXFER_TO_DEV: acb->task->xfer_dir = SCSI_XFER_WRITE; break; case SG_DXFER_FROM_DEV: acb->task->xfer_dir = SCSI_XFER_READ; break; default: acb->task->xfer_dir = SCSI_XFER_NONE; break; acb->task->cdb_size = acb->ioh->cmd_len; memcpy(&acb->task->cdb[0], acb->ioh->cmdp, acb->ioh->cmd_len); acb->task->expxferlen = acb->ioh->dxfer_len; data.size = 0; if (acb->task->xfer_dir == SCSI_XFER_WRITE) { if (acb->ioh->iovec_count == 0) { data.data = acb->ioh->dxferp; data.size = acb->ioh->dxfer_len; } else { scsi_task_set_iov_out(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); if (iscsi_scsi_command_async(iscsi, iscsilun->lun, acb->task, iscsi_aio_ioctl_cb, (data.size > 0) ? &data : NULL, acb) != 0) { scsi_free_scsi_task(acb->task); if (acb->task->xfer_dir == SCSI_XFER_READ) { if (acb->ioh->iovec_count == 0) { scsi_task_add_data_in_buffer(acb->task, acb->ioh->dxfer_len, acb->ioh->dxferp); } else { scsi_task_set_iov_in(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); iscsi_set_events(iscsilun); return &acb->common;
{ "code": [], "line_no": [] }
static BlockAIOCB *FUNC_0(BlockDriverState *bs, unsigned long int req, void *buf, BlockCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *VAR_0 = iscsilun->VAR_0; struct iscsi_data VAR_1; IscsiAIOCB *acb; acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); acb->iscsilun = iscsilun; acb->bh = NULL; acb->status = -EINPROGRESS; acb->buf = NULL; acb->ioh = buf; if (req != SG_IO) { iscsi_ioctl_handle_emulated(acb, req, buf); return &acb->common; acb->task = malloc(sizeof(struct scsi_task)); if (acb->task == NULL) { error_report("iSCSI: Failed to allocate task for scsi command. %s", iscsi_get_error(VAR_0)); memset(acb->task, 0, sizeof(struct scsi_task)); switch (acb->ioh->dxfer_direction) { case SG_DXFER_TO_DEV: acb->task->xfer_dir = SCSI_XFER_WRITE; break; case SG_DXFER_FROM_DEV: acb->task->xfer_dir = SCSI_XFER_READ; break; default: acb->task->xfer_dir = SCSI_XFER_NONE; break; acb->task->cdb_size = acb->ioh->cmd_len; memcpy(&acb->task->cdb[0], acb->ioh->cmdp, acb->ioh->cmd_len); acb->task->expxferlen = acb->ioh->dxfer_len; VAR_1.size = 0; if (acb->task->xfer_dir == SCSI_XFER_WRITE) { if (acb->ioh->iovec_count == 0) { VAR_1.VAR_1 = acb->ioh->dxferp; VAR_1.size = acb->ioh->dxfer_len; } else { scsi_task_set_iov_out(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); if (iscsi_scsi_command_async(VAR_0, iscsilun->lun, acb->task, iscsi_aio_ioctl_cb, (VAR_1.size > 0) ? &VAR_1 : NULL, acb) != 0) { scsi_free_scsi_task(acb->task); if (acb->task->xfer_dir == SCSI_XFER_READ) { if (acb->ioh->iovec_count == 0) { scsi_task_add_data_in_buffer(acb->task, acb->ioh->dxfer_len, acb->ioh->dxferp); } else { scsi_task_set_iov_in(acb->task, (struct scsi_iovec *) acb->ioh->dxferp, acb->ioh->iovec_count); iscsi_set_events(iscsilun); return &acb->common;
[ "static BlockAIOCB *FUNC_0(BlockDriverState *bs,\nunsigned long int req, void *buf,\nBlockCompletionFunc *cb, void *opaque)\n{", "IscsiLun *iscsilun = bs->opaque;", "struct iscsi_context *VAR_0 = iscsilun->VAR_0;", "struct iscsi_data VAR_1;", "IscsiAIOCB *acb;", "acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque);", "acb->iscsilun = iscsilun;", "acb->bh = NULL;", "acb->status = -EINPROGRESS;", "acb->buf = NULL;", "acb->ioh = buf;", "if (req != SG_IO) {", "iscsi_ioctl_handle_emulated(acb, req, buf);", "return &acb->common;", "acb->task = malloc(sizeof(struct scsi_task));", "if (acb->task == NULL) {", "error_report(\"iSCSI: Failed to allocate task for scsi command. %s\",\niscsi_get_error(VAR_0));", "memset(acb->task, 0, sizeof(struct scsi_task));", "switch (acb->ioh->dxfer_direction) {", "case SG_DXFER_TO_DEV:\nacb->task->xfer_dir = SCSI_XFER_WRITE;", "break;", "case SG_DXFER_FROM_DEV:\nacb->task->xfer_dir = SCSI_XFER_READ;", "break;", "default:\nacb->task->xfer_dir = SCSI_XFER_NONE;", "break;", "acb->task->cdb_size = acb->ioh->cmd_len;", "memcpy(&acb->task->cdb[0], acb->ioh->cmdp, acb->ioh->cmd_len);", "acb->task->expxferlen = acb->ioh->dxfer_len;", "VAR_1.size = 0;", "if (acb->task->xfer_dir == SCSI_XFER_WRITE) {", "if (acb->ioh->iovec_count == 0) {", "VAR_1.VAR_1 = acb->ioh->dxferp;", "VAR_1.size = acb->ioh->dxfer_len;", "} else {", "scsi_task_set_iov_out(acb->task,\n(struct scsi_iovec *) acb->ioh->dxferp,\nacb->ioh->iovec_count);", "if (iscsi_scsi_command_async(VAR_0, iscsilun->lun, acb->task,\niscsi_aio_ioctl_cb,\n(VAR_1.size > 0) ? &VAR_1 : NULL,\nacb) != 0) {", "scsi_free_scsi_task(acb->task);", "if (acb->task->xfer_dir == SCSI_XFER_READ) {", "if (acb->ioh->iovec_count == 0) {", "scsi_task_add_data_in_buffer(acb->task,\nacb->ioh->dxfer_len,\nacb->ioh->dxferp);", "} else {", "scsi_task_set_iov_in(acb->task,\n(struct scsi_iovec *) acb->ioh->dxferp,\nacb->ioh->iovec_count);", "iscsi_set_events(iscsilun);", "return &acb->common;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20, 21 ], [ 22 ], [ 23 ], [ 24, 25 ], [ 26 ], [ 27, 28 ], [ 29 ], [ 30, 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42, 43, 44 ], [ 45, 46, 47, 48 ], [ 49 ], [ 51 ], [ 52 ], [ 53, 54, 55 ], [ 56 ], [ 57, 58, 59 ], [ 60 ], [ 61 ] ]
25,879
static void *thread_function(void *data) { GMainLoop *loop; loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); return NULL; }
true
qemu
9732baf67850dac57dfc7dc8980bf408889a8973
static void *thread_function(void *data) { GMainLoop *loop; loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); return NULL; }
{ "code": [ " GMainLoop *loop;", " loop = g_main_loop_new(NULL, FALSE);" ], "line_no": [ 5, 7 ] }
static void *FUNC_0(void *VAR_0) { GMainLoop *loop; loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(loop); return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "GMainLoop *loop;", "loop = g_main_loop_new(NULL, FALSE);", "g_main_loop_run(loop);", "return NULL;", "}" ]
[ 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
25,880
static DisplaySurface* sdl_create_displaysurface(int width, int height) { DisplaySurface *surface = (DisplaySurface*) g_malloc0(sizeof(DisplaySurface)); if (surface == NULL) { fprintf(stderr, "sdl_create_displaysurface: malloc failed\n"); exit(1); } surface->width = width; surface->height = height; if (scaling_active) { int linesize; PixelFormat pf; if (host_format.BytesPerPixel != 2 && host_format.BytesPerPixel != 4) { linesize = width * 4; pf = qemu_default_pixelformat(32); } else { linesize = width * host_format.BytesPerPixel; pf = sdl_to_qemu_pixelformat(&host_format); } qemu_alloc_display(surface, width, height, linesize, pf, 0); return surface; } if (host_format.BitsPerPixel == 16) do_sdl_resize(width, height, 16); else do_sdl_resize(width, height, 32); surface->pf = sdl_to_qemu_pixelformat(real_screen->format); surface->linesize = real_screen->pitch; surface->data = real_screen->pixels; #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_REALPIXELS_FLAG | QEMU_BIG_ENDIAN_FLAG; #else surface->flags = QEMU_REALPIXELS_FLAG; #endif allocator = 1; return surface; }
true
qemu
63ea491d4efc1e02cda3d335db3a46c81adf14ee
static DisplaySurface* sdl_create_displaysurface(int width, int height) { DisplaySurface *surface = (DisplaySurface*) g_malloc0(sizeof(DisplaySurface)); if (surface == NULL) { fprintf(stderr, "sdl_create_displaysurface: malloc failed\n"); exit(1); } surface->width = width; surface->height = height; if (scaling_active) { int linesize; PixelFormat pf; if (host_format.BytesPerPixel != 2 && host_format.BytesPerPixel != 4) { linesize = width * 4; pf = qemu_default_pixelformat(32); } else { linesize = width * host_format.BytesPerPixel; pf = sdl_to_qemu_pixelformat(&host_format); } qemu_alloc_display(surface, width, height, linesize, pf, 0); return surface; } if (host_format.BitsPerPixel == 16) do_sdl_resize(width, height, 16); else do_sdl_resize(width, height, 32); surface->pf = sdl_to_qemu_pixelformat(real_screen->format); surface->linesize = real_screen->pitch; surface->data = real_screen->pixels; #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_REALPIXELS_FLAG | QEMU_BIG_ENDIAN_FLAG; #else surface->flags = QEMU_REALPIXELS_FLAG; #endif allocator = 1; return surface; }
{ "code": [ " if (surface == NULL) {", " fprintf(stderr, \"sdl_create_displaysurface: malloc failed\\n\");", " exit(1);" ], "line_no": [ 7, 9, 11 ] }
static DisplaySurface* FUNC_0(int width, int height) { DisplaySurface *surface = (DisplaySurface*) g_malloc0(sizeof(DisplaySurface)); if (surface == NULL) { fprintf(stderr, "FUNC_0: malloc failed\n"); exit(1); } surface->width = width; surface->height = height; if (scaling_active) { int VAR_0; PixelFormat pf; if (host_format.BytesPerPixel != 2 && host_format.BytesPerPixel != 4) { VAR_0 = width * 4; pf = qemu_default_pixelformat(32); } else { VAR_0 = width * host_format.BytesPerPixel; pf = sdl_to_qemu_pixelformat(&host_format); } qemu_alloc_display(surface, width, height, VAR_0, pf, 0); return surface; } if (host_format.BitsPerPixel == 16) do_sdl_resize(width, height, 16); else do_sdl_resize(width, height, 32); surface->pf = sdl_to_qemu_pixelformat(real_screen->format); surface->VAR_0 = real_screen->pitch; surface->data = real_screen->pixels; #ifdef HOST_WORDS_BIGENDIAN surface->flags = QEMU_REALPIXELS_FLAG | QEMU_BIG_ENDIAN_FLAG; #else surface->flags = QEMU_REALPIXELS_FLAG; #endif allocator = 1; return surface; }
[ "static DisplaySurface* FUNC_0(int width, int height)\n{", "DisplaySurface *surface = (DisplaySurface*) g_malloc0(sizeof(DisplaySurface));", "if (surface == NULL) {", "fprintf(stderr, \"FUNC_0: malloc failed\\n\");", "exit(1);", "}", "surface->width = width;", "surface->height = height;", "if (scaling_active) {", "int VAR_0;", "PixelFormat pf;", "if (host_format.BytesPerPixel != 2 && host_format.BytesPerPixel != 4) {", "VAR_0 = width * 4;", "pf = qemu_default_pixelformat(32);", "} else {", "VAR_0 = width * host_format.BytesPerPixel;", "pf = sdl_to_qemu_pixelformat(&host_format);", "}", "qemu_alloc_display(surface, width, height, VAR_0, pf, 0);", "return surface;", "}", "if (host_format.BitsPerPixel == 16)\ndo_sdl_resize(width, height, 16);", "else\ndo_sdl_resize(width, height, 32);", "surface->pf = sdl_to_qemu_pixelformat(real_screen->format);", "surface->VAR_0 = real_screen->pitch;", "surface->data = real_screen->pixels;", "#ifdef HOST_WORDS_BIGENDIAN\nsurface->flags = QEMU_REALPIXELS_FLAG | QEMU_BIG_ENDIAN_FLAG;", "#else\nsurface->flags = QEMU_REALPIXELS_FLAG;", "#endif\nallocator = 1;", "return surface;", "}" ]
[ 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55, 57 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73, 75 ], [ 77, 79 ], [ 83 ], [ 85 ] ]
25,881
static int _get_transform_coeffs(uint8_t *exps, uint8_t *bap, float chcoeff, float *samples, int start, int end, int dith_flag, GetBitContext *gb, dither_state *state) { int16_t mantissa; int i; int gcode; mant_group l3_grp, l5_grp, l11_grp; for (i = 0; i < 3; i++) l3_grp.gcodes[i] = l5_grp.gcodes[i] = l11_grp.gcodes[i] = -1; l3_grp.gcptr = l5_grp.gcptr = 3; l11_grp.gcptr = 2; i = 0; while (i < start) samples[i++] = 0; for (i = start; i < end; i++) { switch (bap[i]) { case 0: if (!dith_flag) mantissa = 0; else mantissa = dither_int16(state); samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 1: if (l3_grp.gcptr > 2) { gcode = get_bits(gb, qntztab[1]); if (gcode > 26) return -1; l3_grp.gcodes[0] = gcode / 9; l3_grp.gcodes[1] = (gcode % 9) / 3; l3_grp.gcodes[2] = (gcode % 9) % 3; l3_grp.gcptr = 0; } mantissa = l3_q_tab[l3_grp.gcodes[l3_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 2: if (l5_grp.gcptr > 2) { gcode = get_bits(gb, qntztab[2]); if (gcode > 124) return -1; l5_grp.gcodes[0] = gcode / 25; l5_grp.gcodes[1] = (gcode % 25) / 5; l5_grp.gcodes[2] = (gcode % 25) % 5; l5_grp.gcptr = 0; } mantissa = l5_q_tab[l5_grp.gcodes[l5_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 3: mantissa = get_bits(gb, qntztab[3]); if (mantissa > 6) return -1; mantissa = l7_q_tab[mantissa]; samples[i] = to_float(exps[i], mantissa); break; case 4: if (l11_grp.gcptr > 1) { gcode = get_bits(gb, qntztab[4]); if (gcode > 120) return -1; l11_grp.gcodes[0] = gcode / 11; l11_grp.gcodes[1] = gcode % 11; } mantissa = l11_q_tab[l11_grp.gcodes[l11_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 5: mantissa = get_bits(gb, qntztab[5]); if (mantissa > 14) return -1; mantissa = l15_q_tab[mantissa]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; default: mantissa = get_bits(gb, qntztab[bap[i]]) << (16 - qntztab[bap[i]]); samples[i] = to_float(exps[i], mantissa) * chcoeff; break; } } i = end; while (i < 256) samples[i++] = 0; return 0; }
false
FFmpeg
0058584580b87feb47898e60e4b80c7f425882ad
static int _get_transform_coeffs(uint8_t *exps, uint8_t *bap, float chcoeff, float *samples, int start, int end, int dith_flag, GetBitContext *gb, dither_state *state) { int16_t mantissa; int i; int gcode; mant_group l3_grp, l5_grp, l11_grp; for (i = 0; i < 3; i++) l3_grp.gcodes[i] = l5_grp.gcodes[i] = l11_grp.gcodes[i] = -1; l3_grp.gcptr = l5_grp.gcptr = 3; l11_grp.gcptr = 2; i = 0; while (i < start) samples[i++] = 0; for (i = start; i < end; i++) { switch (bap[i]) { case 0: if (!dith_flag) mantissa = 0; else mantissa = dither_int16(state); samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 1: if (l3_grp.gcptr > 2) { gcode = get_bits(gb, qntztab[1]); if (gcode > 26) return -1; l3_grp.gcodes[0] = gcode / 9; l3_grp.gcodes[1] = (gcode % 9) / 3; l3_grp.gcodes[2] = (gcode % 9) % 3; l3_grp.gcptr = 0; } mantissa = l3_q_tab[l3_grp.gcodes[l3_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 2: if (l5_grp.gcptr > 2) { gcode = get_bits(gb, qntztab[2]); if (gcode > 124) return -1; l5_grp.gcodes[0] = gcode / 25; l5_grp.gcodes[1] = (gcode % 25) / 5; l5_grp.gcodes[2] = (gcode % 25) % 5; l5_grp.gcptr = 0; } mantissa = l5_q_tab[l5_grp.gcodes[l5_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 3: mantissa = get_bits(gb, qntztab[3]); if (mantissa > 6) return -1; mantissa = l7_q_tab[mantissa]; samples[i] = to_float(exps[i], mantissa); break; case 4: if (l11_grp.gcptr > 1) { gcode = get_bits(gb, qntztab[4]); if (gcode > 120) return -1; l11_grp.gcodes[0] = gcode / 11; l11_grp.gcodes[1] = gcode % 11; } mantissa = l11_q_tab[l11_grp.gcodes[l11_grp.gcptr++]]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; case 5: mantissa = get_bits(gb, qntztab[5]); if (mantissa > 14) return -1; mantissa = l15_q_tab[mantissa]; samples[i] = to_float(exps[i], mantissa) * chcoeff; break; default: mantissa = get_bits(gb, qntztab[bap[i]]) << (16 - qntztab[bap[i]]); samples[i] = to_float(exps[i], mantissa) * chcoeff; break; } } i = end; while (i < 256) samples[i++] = 0; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, float VAR_2, float *VAR_3, int VAR_4, int VAR_5, int VAR_6, GetBitContext *VAR_7, dither_state *VAR_8) { int16_t mantissa; int VAR_9; int VAR_10; mant_group l3_grp, l5_grp, l11_grp; for (VAR_9 = 0; VAR_9 < 3; VAR_9++) l3_grp.gcodes[VAR_9] = l5_grp.gcodes[VAR_9] = l11_grp.gcodes[VAR_9] = -1; l3_grp.gcptr = l5_grp.gcptr = 3; l11_grp.gcptr = 2; VAR_9 = 0; while (VAR_9 < VAR_4) VAR_3[VAR_9++] = 0; for (VAR_9 = VAR_4; VAR_9 < VAR_5; VAR_9++) { switch (VAR_1[VAR_9]) { case 0: if (!VAR_6) mantissa = 0; else mantissa = dither_int16(VAR_8); VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; case 1: if (l3_grp.gcptr > 2) { VAR_10 = get_bits(VAR_7, qntztab[1]); if (VAR_10 > 26) return -1; l3_grp.gcodes[0] = VAR_10 / 9; l3_grp.gcodes[1] = (VAR_10 % 9) / 3; l3_grp.gcodes[2] = (VAR_10 % 9) % 3; l3_grp.gcptr = 0; } mantissa = l3_q_tab[l3_grp.gcodes[l3_grp.gcptr++]]; VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; case 2: if (l5_grp.gcptr > 2) { VAR_10 = get_bits(VAR_7, qntztab[2]); if (VAR_10 > 124) return -1; l5_grp.gcodes[0] = VAR_10 / 25; l5_grp.gcodes[1] = (VAR_10 % 25) / 5; l5_grp.gcodes[2] = (VAR_10 % 25) % 5; l5_grp.gcptr = 0; } mantissa = l5_q_tab[l5_grp.gcodes[l5_grp.gcptr++]]; VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; case 3: mantissa = get_bits(VAR_7, qntztab[3]); if (mantissa > 6) return -1; mantissa = l7_q_tab[mantissa]; VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa); break; case 4: if (l11_grp.gcptr > 1) { VAR_10 = get_bits(VAR_7, qntztab[4]); if (VAR_10 > 120) return -1; l11_grp.gcodes[0] = VAR_10 / 11; l11_grp.gcodes[1] = VAR_10 % 11; } mantissa = l11_q_tab[l11_grp.gcodes[l11_grp.gcptr++]]; VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; case 5: mantissa = get_bits(VAR_7, qntztab[5]); if (mantissa > 14) return -1; mantissa = l15_q_tab[mantissa]; VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; default: mantissa = get_bits(VAR_7, qntztab[VAR_1[VAR_9]]) << (16 - qntztab[VAR_1[VAR_9]]); VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2; break; } } VAR_9 = VAR_5; while (VAR_9 < 256) VAR_3[VAR_9++] = 0; return 0; }
[ "static int FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, float VAR_2,\nfloat *VAR_3, int VAR_4, int VAR_5, int VAR_6, GetBitContext *VAR_7,\ndither_state *VAR_8)\n{", "int16_t mantissa;", "int VAR_9;", "int VAR_10;", "mant_group l3_grp, l5_grp, l11_grp;", "for (VAR_9 = 0; VAR_9 < 3; VAR_9++)", "l3_grp.gcodes[VAR_9] = l5_grp.gcodes[VAR_9] = l11_grp.gcodes[VAR_9] = -1;", "l3_grp.gcptr = l5_grp.gcptr = 3;", "l11_grp.gcptr = 2;", "VAR_9 = 0;", "while (VAR_9 < VAR_4)\nVAR_3[VAR_9++] = 0;", "for (VAR_9 = VAR_4; VAR_9 < VAR_5; VAR_9++) {", "switch (VAR_1[VAR_9]) {", "case 0:\nif (!VAR_6)\nmantissa = 0;", "else\nmantissa = dither_int16(VAR_8);", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "case 1:\nif (l3_grp.gcptr > 2) {", "VAR_10 = get_bits(VAR_7, qntztab[1]);", "if (VAR_10 > 26)\nreturn -1;", "l3_grp.gcodes[0] = VAR_10 / 9;", "l3_grp.gcodes[1] = (VAR_10 % 9) / 3;", "l3_grp.gcodes[2] = (VAR_10 % 9) % 3;", "l3_grp.gcptr = 0;", "}", "mantissa = l3_q_tab[l3_grp.gcodes[l3_grp.gcptr++]];", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "case 2:\nif (l5_grp.gcptr > 2) {", "VAR_10 = get_bits(VAR_7, qntztab[2]);", "if (VAR_10 > 124)\nreturn -1;", "l5_grp.gcodes[0] = VAR_10 / 25;", "l5_grp.gcodes[1] = (VAR_10 % 25) / 5;", "l5_grp.gcodes[2] = (VAR_10 % 25) % 5;", "l5_grp.gcptr = 0;", "}", "mantissa = l5_q_tab[l5_grp.gcodes[l5_grp.gcptr++]];", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "case 3:\nmantissa = get_bits(VAR_7, qntztab[3]);", "if (mantissa > 6)\nreturn -1;", "mantissa = l7_q_tab[mantissa];", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa);", "break;", "case 4:\nif (l11_grp.gcptr > 1) {", "VAR_10 = get_bits(VAR_7, qntztab[4]);", "if (VAR_10 > 120)\nreturn -1;", "l11_grp.gcodes[0] = VAR_10 / 11;", "l11_grp.gcodes[1] = VAR_10 % 11;", "}", "mantissa = l11_q_tab[l11_grp.gcodes[l11_grp.gcptr++]];", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "case 5:\nmantissa = get_bits(VAR_7, qntztab[5]);", "if (mantissa > 14)\nreturn -1;", "mantissa = l15_q_tab[mantissa];", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "default:\nmantissa = get_bits(VAR_7, qntztab[VAR_1[VAR_9]]) << (16 - qntztab[VAR_1[VAR_9]]);", "VAR_3[VAR_9] = to_float(VAR_0[VAR_9], mantissa) * VAR_2;", "break;", "}", "}", "VAR_9 = VAR_5;", "while (VAR_9 < 256)\nVAR_3[VAR_9++] = 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43, 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113, 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129, 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185, 187 ], [ 191 ], [ 193 ] ]
25,882
static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm0, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm0, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm2, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm2, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
false
FFmpeg
0493e42eb2f9fbf42d0aee0b48a84f81f19fb7fa
static void DEF(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm0, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm0, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm2, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm2, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
{ "code": [], "line_no": [] }
static void FUNC_0(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h) { MOVQ_BFE(mm6); __asm__ volatile( "lea (%3, %3), %%"REG_a" \n\t" "movq (%1), %%mm0 \n\t" ".p2align 3 \n\t" "1: \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm2 \n\t" PAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm0, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm0, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "movq (%1, %3), %%mm1 \n\t" "movq (%1, %%"REG_a"), %%mm0 \n\t" PAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5) "movq (%2), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm4, %%mm2, %%mm6) "movq (%2, %3), %%mm3 \n\t" PAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6) "movq %%mm2, (%2) \n\t" "movq %%mm1, (%2, %3) \n\t" "add %%"REG_a", %1 \n\t" "add %%"REG_a", %2 \n\t" "subl $4, %0 \n\t" "jnz 1b \n\t" :"+g"(h), "+S"(pixels), "+D"(block) :"r"((x86_reg)line_size) :REG_a, "memory"); }
[ "static void FUNC_0(avg, pixels8_y2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\n{", "MOVQ_BFE(mm6);", "__asm__ volatile(\n\"lea (%3, %3), %%\"REG_a\" \\n\\t\"\n\"movq (%1), %%mm0 \\n\\t\"\n\".p2align 3 \\n\\t\"\n\"1: \\n\\t\"\n\"movq (%1, %3), %%mm1 \\n\\t\"\n\"movq (%1, %%\"REG_a\"), %%mm2 \\n\\t\"\nPAVGBP(%%mm1, %%mm0, %%mm4, %%mm2, %%mm1, %%mm5)\n\"movq (%2), %%mm3 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm4, %%mm0, %%mm6)\n\"movq (%2, %3), %%mm3 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6)\n\"movq %%mm0, (%2) \\n\\t\"\n\"movq %%mm1, (%2, %3) \\n\\t\"\n\"add %%\"REG_a\", %1 \\n\\t\"\n\"add %%\"REG_a\", %2 \\n\\t\"\n\"movq (%1, %3), %%mm1 \\n\\t\"\n\"movq (%1, %%\"REG_a\"), %%mm0 \\n\\t\"\nPAVGBP(%%mm1, %%mm2, %%mm4, %%mm0, %%mm1, %%mm5)\n\"movq (%2), %%mm3 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm4, %%mm2, %%mm6)\n\"movq (%2, %3), %%mm3 \\n\\t\"\nPAVGB_MMX(%%mm3, %%mm5, %%mm1, %%mm6)\n\"movq %%mm2, (%2) \\n\\t\"\n\"movq %%mm1, (%2, %3) \\n\\t\"\n\"add %%\"REG_a\", %1 \\n\\t\"\n\"add %%\"REG_a\", %2 \\n\\t\"\n\"subl $4, %0 \\n\\t\"\n\"jnz 1b \\n\\t\"\n:\"+g\"(h), \"+S\"(pixels), \"+D\"(block)\n:\"r\"((x86_reg)line_size)\n:REG_a, \"memory\");", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 65, 67, 69, 71, 73 ], [ 75 ] ]