We are tasked with evaluating the integral:
\[
I = \int_{0}^{\pi/4} \frac{\cos^2 x}{\cos^2 x + 4\sin^2 x} \, dx.
\]
Step 1: substituting \( \tan x = t \)
Let:
\[
\tan x = t, \quad \sec^2 x \, dx = dt.
\]
The limits of integration change as:
\[
x = 0 \implies t = 0, \quad x = \frac{\pi}{4} \implies t = 1.
\]
Substituting into the integral:
\[
I = \int_{0}^{1} \frac{\frac{1}{1+t^2}}{\frac{1}{1+t^2} + 4 \cdot \frac{t^2}{1+t^2}} \, dt.
\]
Simplifying:
\[
I = \int_{0}^{1} \frac{1}{1 + t^2 + 4t^2} \, dt = \int_{0}^{1} \frac{1}{1 + 4t^2 + t^2} \, dt.
\]
Step 2: Simplify further
Combining terms, we get:
\[
I = \int_{0}^{1} \frac{1}{1 + 4t^2} \, dt.
\]
Step 3: Decompose and integrate
Using partial fractions:
\[
I = \frac{1}{3} \int_{0}^{1} \left( \frac{4}{1 + 4t^2} - \frac{1}{1 + t^2} \right) \, dt.
\]
Splitting the integral:
\[
I = \frac{1}{3} \left[ \int_{0}^{1} \frac{4}{1 + 4t^2} \, dt - \int_{0}^{1} \frac{1}{1 + t^2} \, dt \right].
\]
Step 4: Evaluate each term
1. For the first term:
\[
\int \frac{4}{1 + 4t^2} \, dt = \int \frac{1}{\frac{1}{4} + t^2} \, dt = 2 \tan^{-1}(2t).
\]
2. For the second term:
\[
\int \frac{1}{1 + t^2} \, dt = \tan^{-1}(t).
\]
Substituting back:
\[
I = \frac{1}{3} \left[ 2 \tan^{-1}(2) - \tan^{-1}(1) \right].
\]
Step 5: Simplify the result
Using \(\tan^{-1}(1) = \frac{\pi}{4}\), we get:
\[
I = \frac{1}{3} \left[ 2 \tan^{-1}(2) - \frac{\pi}{4} \right].
\]
Simplifying further:
\[
I = -\frac{\pi}{12} + \frac{2}{3} \tan^{-1}(2).
\]
Final Answer:
\[
\boxed{-\frac{\pi}{12} + \frac{2}{3} \tan^{-1} 2}.
\]