The estate tax is calculated based on the net value of your Mother's personal assets, plus the assets in the survivor trust (i.e. "A" trust) and plus the assets in the QTIP, not on the "gain" since your Father's death. The assets in the credit shelter trust are not subject to estate tax at all.
Your mother also has a $1,500,000 exemption to apply against the taxable estate.
For example: Lets assume the fair market value of the assets yu have in the "A" trust, as of the date of your Mother's death is $1,500,000, $1,000,000 in the "B" (i.e. credit shelter trust) and $1,250,000 in the QTIP trust. The gross estate is $2,750,000 (i.e. $1,500,000+$1,250,000). The taxable estate will be $1,250,000 (i.e. $2,750,000-$1,500,000). The assets in the credit shelter trust are not taxed in your Mother's estate.
Each person's estate is taxed separately at their death. For individuals who died in 2004 and 2005 the estate tax exemption is $1,500,000.
The assets you inherit from your other's estate and the QTIP will have a cost basis equivalent to their fair market value as of the date of her death. The cost basis of the assets you inherit from the credit shelter trust will be whatever the Trusts' basis in the assets are (i.e. FMV as of date of death of your Father or purchase cost if purchased after Father's death).