static void write_modes_sb(VP9_COMP *cpi, const TileInfo *const tile, vpx_writer *w, TOKENEXTRA **tok, const TOKENEXTRA *const tok_end, int mi_row, int mi_col, BLOCK_SIZE bsize) { const VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &cpi->td.mb.e_mbd; const int bsl = b_width_log2_lookup[bsize]; const int bs = (1 << bsl) / 4; PARTITION_TYPE partition; BLOCK_SIZE subsize; const MODE_INFO *m = NULL; if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]; partition = partition_lookup[bsl][m->sb_type]; write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w); subsize = get_subsize(bsize, partition); if (subsize < BLOCK_8X8) { write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); } else { switch (partition) { case PARTITION_NONE: write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); break; case PARTITION_HORZ: write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); if (mi_row + bs < cm->mi_rows) write_modes_b(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col); break; case PARTITION_VERT: write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col); if (mi_col + bs < cm->mi_cols) write_modes_b(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs); break; case PARTITION_SPLIT: write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col, subsize); write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col + bs, subsize); write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col, subsize); write_modes_sb(cpi, tile, w, tok, tok_end, mi_row + bs, mi_col + bs, subsize); break; default: assert(0); } } // update partition context if (bsize >= BLOCK_8X8 && (bsize == BLOCK_8X8 || partition != PARTITION_SPLIT)) update_partition_context(xd, mi_row, mi_col, subsize, bsize); }
/* * Write MSC Command */ void msc_cmd_write() { int msc_pt_handle; uint32_t processed_bytes; msc_pt_handle = 0; if (open_partition("MSC", PARTITION_OPEN_WRITE, &msc_pt_handle)) goto finish; write_partition(msc_pt_handle, &msc_cmd, sizeof(msc_cmd), &processed_bytes); finish: close_partition(msc_pt_handle); return; }
void run() { int j,k; double Rblob,temp,lambdaM; fprintf(comp_log,"Time N Split Merge MPlev lambdaM\n"); while (SimTime < EndTime) { tot_cputime_ref = clock(); numk2 = 0; rk4(TimeStep); SimTime += TimeStep; for (j=0; j<N; ++j) if (blobguts[j].a2 < 0.0) { fprintf(diag_log, "Time: %12.4e. WARNING: Negative a2 in element %d\n", SimTime,j); for (k=0; k<N; ++k) fprintf(diag_log, "str=%10.3e x=%10.3e y=%10.3e s2=%10.3e a2=%10.3e\n", mblob[k].blob0.strength, mblob[k].blob0.x,mblob[k].blob0.y, blobguts[k].s2,blobguts[k].a2); exit(0); } /* Constrain the bdy conditions */ /* if ( (BoundaryStep > 0.0) && ((SimTime+0.499*TimeStep) >= BoundaryStep*BoundaryFrame) ) { ++BoundaryFrame; BoundaryConstrain(); } */ if ( (InterpStep > 0.0) && ((SimTime+0.499*TimeStep) >= InterpStep*Interps) ) { RHE_interp2(InterpVar,InterpPopulationControl); ++Interps; } if ((SimTime+0.499*TimeStep) >= FrameStep*Frame) { if (write_vel) write_vels(Frame); #ifdef MULTIPROC /* Have only the 'root' node do the writes */ MPI_Comm_rank(MPI_COMM_WORLD, &rank); if (rank == 0) { if (write_vtx) write_vorts(Frame); if (write_partitions) write_partition(Frame); } #else /* single processor */ if (write_vel) write_vels(Frame); if (write_partitions) write_partition(Frame); #endif ++Frame; Rblob = 0.0; lambdaM = 0.0; for (j=0; j<N; ++j) { temp = 2.0* (tmpparms[j].du11*(tmpparms[j].cos2-tmpparms[j].sin2)+ (tmpparms[j].du12+tmpparms[j].du21)*tmpparms[j].sincos); if (lambdaM < temp) lambdaM = temp; temp = 2.0* (tmpparms[j].du11*(tmpparms[j].cos2-tmpparms[j].sin2)- (tmpparms[j].du12+tmpparms[j].du21)*tmpparms[j].sincos); if (lambdaM < temp) lambdaM = temp; } fprintf(comp_log,"%8.2e %-5d %-5d %-5d %-5d %8.2e\n", SimTime,N,totsplit+nsplit,totmerge+nmerge, mplevels,lambdaM); fflush(comp_log); fflush(diag_log); fflush(mpi_log); } } /* end while loop */ fprintf(comp_log,"Simulation complete.\n"); fprintf(comp_log,"Total splitting events: %d\n",totsplit); fprintf(comp_log,"Total merging events: %d\n",totmerge); fclose(cpu_log); }