Hi, On Wed, Aug 17, 2011 at 9:57 AM, Diego Biurrun <di...@biurrun.de> wrote: > On Wed, Aug 17, 2011 at 09:44:39AM -0700, Ronald S. Bultje wrote: >> >> On Wed, Aug 17, 2011 at 9:17 AM, Diego Biurrun <di...@biurrun.de> wrote: >> > if(simple || !CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ >> > + uint16_t *tmp_cb, *tmp_cr; >> > for (i = 0; i < 8; i++) { >> > - uint16_t *tmp_cb = (uint16_t*)(dest_cb + >> > i*uvlinesize); >> > - for (j = 0; j < 8; j++) >> > - tmp_cb[j] = get_bits(&gb, bit_depth); >> > + tmp_cb = (uint16_t*)(dest_cb + i*uvlinesize); >> > + tmp_cr = (uint16_t*)(dest_cr + i*uvlinesize); >> > } >> >> You understand that whatever happens below this is out of context and >> thus this code cannot possibly work, right? > > I'm not sure I'm following you, the scope of the variables is increased > here, so I'm missing the issue you are hinting at. IIUC what you mean > by "out of context", i.e. out of scope, then the code would not even > compile, which it does...
variable x, y; for (i = 0; i < 8; i++) { x = i; y = i; } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { // do something with x; } } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { // do something with y; } } do you understand why this doesn't do what the below code does? for (i = 0; i < 8; i++) { x = i; for (j = 0; j < 8; j++) { // do something with x; } } // and then same for y here Ronald _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel